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
# Credit: http://jezenthomas.com/using-git-to-manage-todos/
set -e
main() {
while IFS= read -r todo; do
printf "%s\n" "$(file_path):$(line_number) $(line_author) $(message)"
done < <(todo_list)

Installing a Gem on Heroku from a Private GitHub Repo

Sometimes you want to use a gem on Heroku that is in a private repository on GitHub.

Using git over http you can authenticate to GitHub using basic authentication. However, we don't want to embed usernames and passwords in Gemfiles. Instead, we can use authentication tokens.

  1. Get an OAuth Token from GitHub

First you will need to get an OAuth Token from GitHub using your own username and "note"

@zph
zph / direnv.el
Last active March 30, 2017 16:29
(require 'cl-lib)
;; Depends on s.el
(defun direnv-data (dir)
;; TODO: use dir for folder or smart current-project-dir variable
(let ((cmd (concat "$SHELL -i -c '" "cd " dir " && direnv export bash'")))
(shell-command-to-string cmd)))
;;(direnv-data "~/src/direnv")
(defun commands-from-direnv (text)
@zph
zph / Gala.scala
Last active August 29, 2015 14:15
// package gala
import scala.sys
import scala.concurrent.Future
import scala.concurrent.duration._
import akka.actor.ActorSystem
import akka.util.Timeout
import akka.pattern.ask
# https://en.wikipedia.org/wiki/ISO_3166-1_alpha-3
# CODE COUNTRY_NAME
---
ABW: Aruba
AFG: Afghanistan
AGO: Angola
AIA: Anguilla
ALA: "Åland Islands"
ALB: Albania
AND: Andorra
@zph
zph / org-expiry.el
Last active August 29, 2015 14:13
Auto timestamping in emacs org-mode. Stamps when new heading is created via Cmd-Ret and when marked DONE. It’s very “alpha” but here: part of zph-org-agenda.el (L100-L126), all org-expiry.el, + most of zph-org-expiry.el
;;; org-expiry.el --- expiry mechanism for Org entries
;;
;; Copyright 2007 2008 Bastien Guerry
;;
;; Author: bzg AT altern DOT org
;; Version: 0.2
;; Keywords: org expiry
;; URL: http://www.cognition.ens.fr/~guerry/u/org-expiry.el
;;
;; This program is free software; you can redistribute it and/or modify
  • Shortbread supplies
  • Marlboro Lites for <3
  • Snacks/drinks?

Add other requests as comments below

client = Buffer::Client.new(THEIR_OAUTH_TOKEN)
profiles = client.profiles
profile_ids = profiles.map(&:id)
schedules = profiles.schedules
# Will add post to their queue of updates
client.create_update({text: "Some string", profile_ids: profile_ids})
# There are options for posting to top of queue or specific times. See https://bufferapp.com/developers/api/updates#updatescreate
# and look in lib/buffer/update.rb :).
@zph
zph / git-vulnerability-check.sh
Last active August 29, 2015 14:11
Verify successful update to non-vulnerable git on OSX
brew update && brew upgrade git && git --version | grep 2.2.1
if [[ $? == "0" ]];then
echo "Safe\!"
else
echo "Vunerable\!"
fi
#!/usr/bin/env bash
tmate show-messages | egrep -o 'Remote session: (.*)' | awk '{print $4}'