Skip to content

Instantly share code, notes, and snippets.

Avatar

Zander Hill zph

View GitHub Profile
View pull-request
#!/usr/bin/env bash
set -eou pipefail
main() {
local branch_name
branch_name="$(git rev-parse --abbrev-ref HEAD)"
local base_branch="${1:-master}"
\git push origin "$branch_name"
hub pull-request -b "$base_branch"
View flipper.rb
require 'json'
def get_links(file)
body = File.read(file)
json = JSON.parse(body)
kv = json.dig("store", "pluginStates").to_a
JSON.parse(kv.first[1])["requests"]
.map { |k,v| v["url"] }
.reject { |l| l[/clients3\.google\.com|doubleclick|localhost|googleapis\.com/] }
.sort
View git-smart
#!/usr/bin/env ruby
# Load no gems beyond stdlib due to native extensions breaking
# and rebuilding between different ruby versions and chruby/system.
# Also should speed up script timing. ZPH
$LOAD_PATH.delete_if { |l| l[/\/(gems|extensions)\//] }
#########################################################
## Generated Code: do not submit patches.
## Submit patches against non-generated version of code.
#########################################################
View .iex.exs
defmodule RnaTranscription do
@doc """
Transcribes a character list representing DNA nucleotides to RNA
## Examples
RnaTranscription.to_rna('ACTG')
'UGAC'
"""
@rna_map %{?A => 'U', ?T => 'A', ?G => 'C', ?C => 'G'}
def lookup(k) do
View network_connected
#!/usr/bin/env bash
set -CEeuo pipefail
IFS=$'\n\t'
shopt -s extdebug
main() {
networksetup -getairportnetwork en0 | sed 's/Current Wi-Fi Network: //g'
}
View archiver.rb
class Archiver < Formula
desc "Easily create & extract archives, and compress & decompress files of various formats"
homepage "https://godoc.org/github.com/mholt/archiver"
url "https://github.com/mholt/archiver/releases/download/v3.2.0/arc_mac_amd64"
sha256 "1932ecb8b8dc8492e62a608f436dc6d514c8357e224fd5fe7653bd3266cd67e3"
def install
bin.install "arc_mac_amd64" => "arc"
end
View mmake.rb
class Mmake < Formula
GIT = "github.com/zph/mmake"
desc "Go wrapper for forked version of TJ Holowaychuk's Mmake"
homepage "https://#{GIT}"
url "https://#{GIT}.git",
tag: "v1.4.2"
head "https://#{GIT}.git"
depends_on "go"
View builder.sh
#!/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
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"
You can’t perform that action at this time.