Skip to content

Instantly share code, notes, and snippets.

View hamdshah's full-sized avatar

Hamdullah shah hamdshah

  • Software Engineer
  • London, UK
View GitHub Profile
@hamdshah
hamdshah / screen-gif.sh
Created April 15, 2020 12:28 — forked from julesjans/screen-gif.sh
Capture iOS Simulator to animated gif
# Turn on the simulator screen capture
xcrun simctl io booted recordVideo ~/simulator.mov
# Convert the iPhone 6s screen shot into a gif:
ffmpeg -i ~/simulator.mov -vf scale=320:-1 -r 6 -f gif -y simulator.gif
protocol PushHandler : class {
func shouldDisplayNotification(for item: PushNotificationItem) -> Bool
func handlePush(item: PushNotificationItem)
}
extension PushHandler {
func handlePush(item: PushNotificationItem) {}
func canHandlePush(item: PushNotificationItem) -> Bool {
return false
@hamdshah
hamdshah / ocr-shot.sh
Last active March 19, 2018 13:00 — forked from pnc/ocr-shot.sh
#!/bin/bash
set -e
CONTENTS=$(tesseract -c language_model_penalty_non_dict_word=0.8 --tessdata-dir /usr/local/share/ "$1" stdout -l eng | xml esc)
hex=$((cat <<EOF
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
@hamdshah
hamdshah / gist:4093265
Created November 17, 2012 04:27 — forked from krzysztofzablocki/gist:4091783
Free memory on iOS
-(float) get_free_memory {
mach_port_t host_port;
mach_msg_type_number_t host_size;
vm_size_t pagesize;
host_port = mach_host_self();
host_size = sizeof(vm_statistics_data_t) / sizeof(integer_t);
host_page_size(host_port, &pagesize);
vm_statistics_data_t vm_stat;
if (host_statistics(host_port, HOST_VM_INFO, (host_info_t)&vm_stat, &host_size) != KERN_SUCCESS) {