Skip to content

Instantly share code, notes, and snippets.

Zander Hill zph

Block or report user

Report or block zph

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
View password_gen
#!/usr/bin/env bash
# Creates alnum passwords of roughly the length requested.
# Alt form xxd -g 2 -l 64 -p /dev/urandom | tr -d '\n'
# (But then has a smaller random space b/c it's [a-f0-9].
# We ask openssl for COUNT * 4 to be overly safe that we'll have that amount
# available after stripping it down to only alphanumeric characters.
set -CEeuo pipefail
IFS=$'\n\t'
shopt -s extdebug
View gitless_with_untracked.rb
class GitlessWithUntracked < Formula
include Language::Python::Virtualenv
desc "Simplified version control system on top of git"
homepage "https://gitless.com/"
url "https://github.com/sdg-mit/gitless/archive/v0.8.8.tar.gz"
sha256 "470aab13d51baec2ab54d7ceb6d12b9a2937f72d840516affa0cb34a6360523c"
depends_on "libgit2"
depends_on "python"
View gitless_mod.rb
class GitlessMod < Formula
include Language::Python::Virtualenv
desc "Simplified version control system on top of git"
homepage "https://gitless.com/"
url "https://github.com/sdg-mit/gitless/archive/v0.8.8.tar.gz"
sha256 "470aab13d51baec2ab54d7ceb6d12b9a2937f72d840516affa0cb34a6360523c"
bottle do
cellar :any
@zph
zph / saltpack.vim
Created Feb 15, 2019 — forked from jecxjo/saltpack.vim
Vimscript to Read/Write Keybase's Saltpack encrypted files
View saltpack.vim
" Keybase - saltpack
augroup SALTPACK
au!
" Make sure nothing is written to ~/.viminfo
au BufReadPre,FileReadPre *.saltpack set viminfo=
" No other files with unencrypted info
au BufReadPre,FileReadPre *.saltpack set noswapfile noundofile nobackup
" Reading Files, assumes you can decrypt
au BufReadPost,FileReadPost *.saltpack :%!keybase decrypt
View perceptualdiff.rb
# Documentation: https://docs.brew.sh/Formula-Cookbook
# http://www.rubydoc.info/github/Homebrew/brew/master/Formula
# PLEASE REMOVE ALL GENERATED COMMENTS BEFORE SUBMITTING YOUR PULL REQUEST!
class Perceptualdiff < Formula
desc "A program that compares two images using a perceptually based image metric"
homepage ""
head "https://github.com/myint/perceptualdiff.git", revision: "7ae45fbbe2364c02b9dd54cc83c8f530ba96641b"
depends_on "cmake" => :build
depends_on "freeimage"
View init.vim
Plug 'ludovicchabant/vim-gutentags'
let g:gutentags_ctags_tagfile = ".tags"
let g:gutentags_cache_dir = "~/tmp"
if executable('ptags')
let g:gutentags_ctags_executable = 'ptags'
endif
@zph
zph / gist:3e0fa3e0a4644def5a65df066668fa9f
Created Nov 17, 2016 — forked from drpancake/gist:9605830
Manually long-polling the Atlas ATS API (Bayeux protocol)
View gist:3e0fa3e0a4644def5a65df066668fa9f
# Requires the 'requests' module: http://docs.python-requests.org/en/latest/
import json
import requests
URL = 'https://data.atlasats.com:4000/api'
def bayeux_call(data):
headers = {'content-type': 'application/json'}
res = requests.post(URL, data=json.dumps(data), headers=headers, verify=False) # no SSL cert check
@zph
zph / update_column_type.sql
Created Sep 8, 2016 — forked from mmasashi/update_column_type.sql
How to change the column type for Redshift.
View update_column_type.sql
BEGIN;
LOCK table_name;
ALTER TABLE table_name ADD COLUMN column_new column_type;
UPDATE table_name SET column_new = column_name;
ALTER TABLE table_name DROP column_name;
ALTER TABLE table_name RENAME column_new TO column_name;
END;
-- varchar -> integer
-- UPDATE cpvbeacon_dev SET column_new = CAST (nullif(column_name, '') AS INTEGER);
@zph
zph / doc.md
Created Aug 13, 2016 — forked from oelmekki/doc.md
Rails + Browserify + React + es7
View doc.md

1. Gemfile

gem 'browserify-rails', '1.5.0' # until fix: https://github.com/browserify-rails/browserify-rails/issues/101
gem 'react-rails'

Browserify-rails allows to use browserify within assets pipeline. React-rails is here only to allow to use #react_component (and thus, prerendering).

Note that jquery-rails can be removed from Gemfile, the npm version of jquery and jquery-ujs will be used instead.

View re-run
#!/usr/bin/env bash
if [[ ! -x $(which fswatch) ]];then
echo "Must install fswatch"
exit 1
fi
main(){
DIR_OR_FILE=$1
shift
You can’t perform that action at this time.