Skip to content

Instantly share code, notes, and snippets.

Steve steverichey

Block or report user

Report or block steverichey

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
@steverichey
steverichey / pw
Created Oct 25, 2019
Simple password generator, version 2
View pw
#!/usr/bin/env sh
set -eur
generate()
{
allowed_characters="${1}"
number_of_characters="${2}"
cat /dev/random | env LC_CTYPE=C tr -cd "${allowed_characters}" | head -c "${number_of_characters}"
}
@steverichey
steverichey / imagenet_labels.txt
Created Mar 29, 2019
Just the ImageNet labels used by ResNet.
View imagenet_labels.txt
tench
goldfish
great_white_shark
tiger_shark
hammerhead
electric_ray
stingray
cock
hen
ostrich
@steverichey
steverichey / pw
Created Nov 21, 2018
Password generation script
View pw
#!/bin/sh
set -e
# generate allowed_characters number_of_characters
generate()
{
cat /dev/random | env LC_CTYPE=C tr -cd $1 | head -c $2
}
@steverichey
steverichey / xoshiroPRNG.swift
Created Nov 21, 2018
Not thoroughly tested, needs update for some Random changes in Swift
View xoshiroPRNG.swift
import Foundation
// http://xoshiro.di.unimi.it/xoshiro256starstar.c
protocol PseudoRandomNumberGenerator {
associatedtype ReturnValue
mutating func next() -> ReturnValue
}
struct Arc4Random: PseudoRandomNumberGenerator {
View genie.swift
//: Playground - noun: a place where people can play
import Cocoa
let caseLookup: [Character: Character] = [
"a": "A", "b": "B", "c": "C", "d": "D", "e": "E", "f": "F", "g": "G", "h": "H", "i": "I", "j": "J", "k": "K", "l": "L", "m": "M", "n": "N",
"o": "O", "p": "P", "q": "Q", "r": "R", "s": "S", "t": "T", "u": "U", "v": "V", "w": "W", "x": "X", "y": "Y", "z": "Z"
]
extension Dictionary where Value: Equatable {
@steverichey
steverichey / allow_ios_firewall.sh
Created Jul 30, 2018
In theory, allows the iOS simulator to bypass the firewall. May no longer be needed, or it works so well I no longer get the dialog prompt.
View allow_ios_firewall.sh
#!/bin/sh
# requires sudo
sudo /usr/libexec/ApplicationFirewall/socketfilterfw --setglobalstate off
/usr/libexec/ApplicationFirewall/socketfilterfw --add /Applications/Xcode.app/Contents/Developer/Applications/Simulator.app/Contents/MacOS/Simulator
sudo /usr/libexec/ApplicationFirewall/socketfilterfw --setglobalstate on
@steverichey
steverichey / gifopt.sh
Created Jul 13, 2018
GIF creation with some optimization options
View gifopt.sh
#!/bin/sh
# this was created for an admittedly specialized purpose but has some neat settings i want to remember
palette="/tmp/palette.png"
cropped="/tmp/cropped.mp4"
width="275"
filters="fps=15,scale=${width}:-1:flags=lanczos"
@steverichey
steverichey / Camera.playground
Created Jun 29, 2018
Camera edge detection demo for Realities 360
View Camera.playground
import Cocoa
import AVFoundation
import AVKit
import QuartzCore
import PlaygroundSupport
import AppKit
import CoreGraphics
import CoreImage
let playgroundView = NSView(frame: NSRect(x: 0.0, y: 0.0, width: 640.0, height: 480.0))
View start_adapt.sh
#!/bin/sh
# exit early on errors
set -eu
# from: brew.sh, install homebrew
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
# latest node via homebrew is borked, install 6.x instead
brew install node@6
@steverichey
steverichey / icons.sh
Created Jul 17, 2017
decent script to make android icons from PDF files, supports transparency
View icons.sh
#!/bin/sh
usage ()
{
echo "Usage:\nsh icons.sh standard_icon.pdf debug_icon.pdf"
exit 1
}
# usage: iconize input/file.pdf some/output/path/file.png 256
# where `256` is the size to generate
You can’t perform that action at this time.