Skip to content

Instantly share code, notes, and snippets.

View zph's full-sized avatar

Zander Hill zph

View GitHub Profile
#!/usr/bin/env bash
# bash_strict_mode disable=true
source "$stdenv/setup"
goModDownload() {
export GO111MODULE=on
cd go/src/$goPackagePath || exit 1
go mod download
go mod vendor
#!/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
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"
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 February 15, 2019 20:30 — forked from jecxjo/saltpack.vim
Vimscript to Read/Write Keybase's Saltpack encrypted files
" 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
# 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"
@zph
zph / init.vim
Last active April 12, 2018 22:41
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 November 17, 2016 03:26 — forked from drpancake/gist:9605830
Manually long-polling the Atlas ATS API (Bayeux protocol)
# 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 September 8, 2016 21:25 — forked from mmasashi/update_column_type.sql
How to change the column type for Redshift.
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 August 13, 2016 03:03 — forked from oelmekki/doc.md
Rails + Browserify + React + es7

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.