Skip to content

Instantly share code, notes, and snippets.

View jkereako's full-sized avatar

Jeff Kereakoglow jkereako

View GitHub Profile
@jkereako
jkereako / startup.applescript
Last active August 22, 2020 18:01
Toying with a start-up script for my MacBook Pro.
# Open Safari
tell application "Safari"
# Default to HackerNews
open location "https://news.ycombinator.com"
activate
end tell
# Open Outlook if you have it.
try
tell application "Microsoft Outlook"
#!/bin/sh
find_latest_ruby_version() {
help_find_latest_version "rbenv"
}
find_latest_python_version() {
help_find_latest_version "pyenv"
}
@jkereako
jkereako / config.yaml
Last active August 11, 2022 18:18
Startup script for MITM Proxy.
scripts: [~/.mitmproxy/scripts/toggle_macos_proxies.py, ~/.mitmproxy/scripts/error_response.py]
view_filter: "~dst amazon.com|google.com"
console_mouse: false
console_palette: dark
console_eventlog_verbosity: error
import Foundation
class Dynamic<T> {
var bind :(T) -> () = { _ in }
var value :T? {
didSet {
bind(value!)
}
@jkereako
jkereako / ffmpeg.sh
Created November 23, 2017 03:30
How to embed subtitles into an MP4
ffmpeg -i video.mp4 -i sub.srt -c:v copy -c:a copy -c:s mov_text -metadata:s:s:0 language=eng out.mp4
@jkereako
jkereako / ViewController.swift
Created September 28, 2017 02:15
Free `self` in Swift
final class TabBarController: UITabBarController {
override func viewDidLoad() {
super.viewDidLoad()
// Copy the reference `self` into a variable.
var selfCopy = self
// Implicitly cast `selfCopy` to a UnsafeMutableRawPointer.
let ptr = UnsafeMutableRawPointer(&selfCopy)
// Set it free!
US-AL
US-AK
US-AZ
US-AR
US-CA
US-CO
US-CT
US-DE
US-FL
US-GA
@jkereako
jkereako / TimeRemainingIndicatorView.swift
Created August 16, 2017 18:41
Draws a pie chart to show the percentage left.
import UIKit
@IBDesignable
final class TimeRemainingIndicatorView: UIView {
@IBInspectable var percentageRemainingFillColor: UIColor = .green
@IBInspectable var percentageElapsedFillColor: UIColor = .white
@IBInspectable var borderWidth: CGFloat = 1
@IBInspectable var borderColor: UIColor = .black
@IBInspectable var value: Double = 0 {