Skip to content

Instantly share code, notes, and snippets.

Justin Ouellette jstn

Block or report user

Report or block jstn

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@jstn
jstn / min.tumblr.html
Last active Nov 18, 2018
min theme for tumblr
View min.tumblr.html
<!--
(c) {CopyrightYears} {Title}
{BlogURL}
min theme by jstn
https://gist.github.com/jstn/5a67fd6c035bb86d1c504c98fa9cac07
-->
<html>
View prompt.zsh
function git_prompt() {
local dirty=""
if [[ -n $(git ls-files --other --exclude-standard 2> /dev/null) ]]; then
dirty="*"
fi
if ! git diff --quiet 2> /dev/null; then
dirty="*"
fi
@jstn
jstn / keybase.md
Created Jan 13, 2017
Keybase proof
View keybase.md

Keybase proof

I hereby claim:

  • I am jstn on github.
  • I am ouellette (https://keybase.io/ouellette) on keybase.
  • I have a public key ASCnfu-Ia5yAtEsb4pUhLwOpUbODSRFNuSJDG6LcbLPwxwo

To claim this, I am signing this object:

View Preferences.sublime-settings
{
"caret_extra_bottom": 2,
"caret_extra_top": 2,
"caret_extra_width": 1,
"caret_style": "phase",
"color_scheme": "Packages/Base16 Color Schemes/Themes/base16-oceanicnext.tmTheme",
"create_window_at_startup": false,
"ensure_newline_at_eof_on_save": true,
"fold_buttons": false,
"folder_exclude_patterns":
@jstn
jstn / netdata.service
Created Mar 30, 2016
systemd service for netdata
View netdata.service
[Unit]
Description=netdata
After=network.service
Requires=network.service
[Service]
Type=oneshot
RemainAfterExit=true
ExecStart=/usr/sbin/netdata
ExecStop=/usr/bin/killall netdata
View mutexes.swift
/*
No-Starve and Read/Write mutexes, based on GCD in Swift 3.0
Inspired by the Little Book of Semaphores: http://greenteapress.com/wp/semaphores/
*/
import Foundation
final class NoStarveMutex {
private final let _semaphoreA = DispatchSemaphore(value: 1)
private final let _semaphoreB = DispatchSemaphore(value: 0)
@jstn
jstn / keyboardWillChangeFrame.swift
Last active Aug 29, 2015
keyboardWillChangeFrame template
View keyboardWillChangeFrame.swift
import UIKit
extension UIViewController {
func animateKeyboardWillChangeFrame(n: NSNotification?, animations: (keyboardFrameEnd: CGRect) -> Void) {
if let info = n?.userInfo as? Dictionary<String,AnyObject> {
let frameBeginValue = info[UIKeyboardFrameBeginUserInfoKey] as NSValue
let frameEndValue = info[UIKeyboardFrameEndUserInfoKey] as NSValue
let durationNumber = info[UIKeyboardAnimationDurationUserInfoKey] as NSNumber
let curveNumber = info[UIKeyboardAnimationCurveUserInfoKey] as NSNumber
@jstn
jstn / Timer.swift
Last active May 15, 2019
simple nanosecond timer using mach_absolute_time
View Timer.swift
/*
var t = Timer()
t.start()
// do something
t.stop()
print("took \(t.seconds)")
*/
@jstn
jstn / MD5.swift
Last active Jun 12, 2019
MD5 with CommonCrypto in Swift 3.0
View MD5.swift
// requires a bridging header with this:
// #import <CommonCrypto/CommonCrypto.h>
func MD5(_ string: String) -> String? {
let length = Int(CC_MD5_DIGEST_LENGTH)
var digest = [UInt8](repeating: 0, count: length)
if let d = string.data(using: String.Encoding.utf8) {
d.withUnsafeBytes { (body: UnsafePointer<UInt8>) in
CC_MD5(body, CC_LONG(d.count), &digest)
}
View gettytab
### JSTN
jstn.vt220.19200:\
:cb:ce:ck:lc:fd#1000:hw:ht:np:sp#19200:tt=vt220:im=\r\n . .o8 oooo\r\n .o8 "888 `888\r\n.o888oo oooo oooo ooo. .oo. .oo. 888oooo. 888 oooo d8b\r\n 888 `888 `888 `888P"Y88bP"Y88b d88' `88b 888 `888""8P\r\n 888 888 888 888 888 888 888 888 888 888\r\n 888 . 888 888 888 888 888 888 888 888 888 .o.\r\n "888" `V88V"V8P' o888o o888o o888o `Y8bod8P' o888o d888b Y8P\r\n\r\n\r\n%s %r %m (%t)\r\n%h\r\n\r\n:
###
You can’t perform that action at this time.