Skip to content

Instantly share code, notes, and snippets.

@RhetTbull
RhetTbull / vision.py
Last active May 27, 2024 20:57
Use Apple's Vision framework from Python to detect text in images
""" Use Apple's Vision Framework via PyObjC to detect text in images
To use:
python3 -m pip install pyobjc-core pyobjc-framework-Quartz pyobjc-framework-Vision wurlitzer
"""
import pathlib
@douglashill
douglashill / MenuAlignment.swift
Last active April 15, 2023 15:45
Swizzles the iOS contextual menu and share sheet to improve usability by showing the icon on the leading side. Read more: https://douglashill.co/menu-icon-swizzling/
// Douglas Hill, March 2020
// Code for the article at https://douglashill.co/menu-icon-swizzling/
import UIKit
struct MenuAlignmentFixError: Error, CustomStringConvertible {
let description: String
}
@JonnyBeeGod
JonnyBeeGod / CountdownTests.swift
Created December 25, 2019 06:41
This code allows for testing UNNotificationCenter and UNNotificationSettings
func testNotifications() {
// map all authorizationStatus with expected Result
let authorizationStatusMap: [UNAuthorizationStatus: Int] = [.authorized: 1, .denied: 0, .notDetermined: 0, .provisional: 1]
UNNotificationSettings.swizzleAuthorizationStatus()
authorizationStatusMap.forEach { (key: UNAuthorizationStatus, value: Int) in
UNNotificationSettings.fakeAuthorizationStatus = key
let mockCenter = UserNotificationCenterMock()
let mockCoder = MockNSCoder()
@atyachin
atyachin / Android-Emulator-on-AWS-EC2.txt
Last active May 8, 2024 10:35
Installing and running Android Emulator on Amazon AWS EC2 (Ubuntu 16.04 / m5.xlarge)
Update (2022): https://gist.github.com/atyachin/2f7c6054c4cd6945397165a23623987d
Steps for installing the Android Emulator from EC2 console:
-----------------------------------------------------------
sudo apt install default-jdk
wget https://dl.google.com/android/repository/sdk-tools-linux-4333796.zip
unzip sdk-tools-linux-4333796.zip -d android-sdk
sudo mv android-sdk /opt/
export ANDROID_SDK_ROOT=/opt/android-sdk
@ernestkamara
ernestkamara / AdbCommands
Created June 26, 2018 08:42 — forked from Pulimet/AdbCommands
Adb useful commands list
== Adb Server
adb kill-server
adb start-server
== Adb Reboot
adb reboot
adb reboot recovery
adb reboot-bootloader
== Shell
@kimyvgy
kimyvgy / MANUAL.md
Created May 24, 2018 01:52 — forked from s-lyn/MANUAL.md
Deploy nodejs app with gitlab.com and pm2

Deploy nodejs app with gitlab.com and pm2

This manual is about setting up an automatic deploy workflow using nodejs, PM2, nginx and GitLab CI. It is tested on:

  • Target server: Ubuntu 16.04 x64. This is suitable for Ubuntu 14.x.
  • Windows 10 on my PC to work.
@snowyu
snowyu / README.md
Created September 30, 2017 22:14 — forked from githubutilities/README.md
Shadowsocks proxy and ssh proxy

Shadowsocks Proxy

apt-get install python-pip
pip install shadowsocks

sudo ssserver -p 443 -k password -m aes-256-cfb --user nobody -d start
@dabing1022
dabing1022 / 0.1-export-plist.sh
Created April 27, 2017 01:44 — forked from mxpr/0.1-export-plist.sh
Export Options Plist flag in xcodebuild
# Switch xcrun to leverage Xcode 7
# Note: This won't be needed once Xcode 7 is released
# and becomes the primary Xcode in use.
export DEVELOPER_DIR=/Applications/Xcode-beta.app/Contents/Developer/
# Export Archive
xcrun xcodebuild -exportArchive -exportOptionsPlist exportPlist.plist -archivePath /path/to/app.xcarchive -exportPath /path/to/app.ipa
@tettoffensive
tettoffensive / UIAlertAction+Swizzle.swift
Created April 7, 2017 23:29
How to Swizzle what looks like an init method in Swift that's really a class method in Obj-C
typealias UIAlertActionHandler = ((UIAlertAction) -> Swift.Void)?
private struct AssociatedKeys {
static var handler = "cc_handler"
}
private let swizzling: (UIAlertAction.Type) -> () = { action in
// in swift this looks like an init, but in obj-c it's really actionWithTitle:style:handler class method
let originalSelector = #selector(UIAlertAction.init(title:style:handler:))
let swizzledSelector = #selector(UIAlertAction.action(testTitle:style:handler:)) // so swizzling an init won't work. we have to use another class method
@nicloay
nicloay / .luacheckrc
Created February 17, 2017 07:35
defold luacheck rc module (exclude defold api from warnings). source https://github.com/dapetcu21/breakthrough-ai/blob/master/.luacheckrc
std = "max"
files['.luacheckrc'].global = false
unused_args = false
globals = {
"sys",
"go",
"gui",
"label",
"render",