Skip to content

Instantly share code, notes, and snippets.

View gaelfoppolo's full-sized avatar

Gaël Foppolo gaelfoppolo

View GitHub Profile
@gaelfoppolo
gaelfoppolo / retrieve_fastlane_session.rb
Created February 10, 2021 14:51
Auto-setting FASTLANE_SESSION on CI
lane :retrieve_fastlane_session do
# runs shell
# this needs SPACESHIP_SKIP_2FA_UPGRADE=1 flag
spaceauth_output = `bundle exec fastlane spaceauth`
# regex the output for the value we need
fastlane_session_regex = %r{Pass the following via the FASTLANE_SESSION environment variable:\n(?<session>.+)\n\n\nExample:\n.+}
new_session = nil
if match = spaceauth_output.match(fastlane_session_regex)
# strip out the fancy formatting
ssh -i path/to/your/key.pem ubuntu@ec2–19–124–171–90.eu-central-1.compute.amazonaws.com
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
/* ... */
NotificationCenter.default.addObserver(self,
selector: #selector(AppDelegate.applicationDidTimeout(notification:)),
name: .appTimeout,
object: nil
)
func applicationDidTimeout(notification: NSNotification) {
print("application did timeout, perform actions")
}
import UIKit
UIApplicationMain(
CommandLine.argc,
UnsafeMutableRawPointer(CommandLine.unsafeArgv)
.bindMemory(
to: UnsafeMutablePointer<Int8>.self,
capacity: Int(CommandLine.argc)),
NSStringFromClass(TimerApplication.self),
NSStringFromClass(AppDelegate.self)
import Foundation
extension Notification.Name {
static let appTimeout = Notification.Name("appTimeout")
}
import UIKit
class TimerApplication: UIApplication {
// the timeout in seconds, after which should perform custom actions
// such as disconnecting the user
private var timeoutInSeconds: TimeInterval {
// 2 minutes
return 2 * 60
}
import coremltools
caffe_model = ('oxford102.caffemodel', 'deploy.prototxt')
labels = 'list.txt'
coreml_model = coremltools.converters.caffe.convert(
caffe_model,
class_labels=labels,
image_input_names='data'
pink primrose
hard-leaved pocket orchid
canterbury bells
sweet pea
english marigold
tiger lily
moon orchid
bird of paradise
monkshood
globe thistle