Skip to content

Instantly share code, notes, and snippets.

(*
Copyright 2018 Google LLC
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@jasonmc
jasonmc / Program.fs
Last active November 16, 2017 21:51
(*
Copyright 2017 Google LLC
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
curl -s "http://httpbin.org/get?a=echo%20'you%20moron'" | jq '.args.a' | tr -d '"' | bash
@jasonmc
jasonmc / keybase.md
Created February 14, 2015 04:28
keybase.md

Keybase proof

I hereby claim:

  • I am jasonmc on github.
  • I am jasonmc (https://keybase.io/jasonmc) on keybase.
  • I have a public key whose fingerprint is 83F3 83F5 616B D29E 3B4F 25D4 C6F3 D30A 81DF 7C70

To claim this, I am signing this object:

(require 'package)
;; (add-to-list 'package-archives
;; '("marmalade" . "http://marmalade-repo.org/packages/") t)
(setq package-archives '(("gnu" . "http://elpa.gnu.org/packages/")
("marmalade" . "http://marmalade-repo.org/packages/")
("melpa" . "http://melpa.milkbox.net/packages/")
("org" . "http://orgmode.org/elpa/")))
@jasonmc
jasonmc / gist:3344878
Created August 13, 2012 23:42
Test sanitizing names for Mercurial to Git conversion.
import subprocess
from mercurial import commands
from mercurial import ui
from mercurial import localrepo
def sha_string(hash):
import base64
return base64.b16encode(hash).lower()
@jasonmc
jasonmc / gist:3344867
Created August 13, 2012 23:39
Find unnamed heads in Mercurial
from mercurial import commands, ui, localrepo
import sys
# default git branch name
cfg_master='master'
origin_name=''
def get_branch(name):
# 'HEAD' is the result of a bug in mutt's cvs->hg conversion,
@jasonmc
jasonmc / gist:2523587
Created April 29, 2012 02:17
Go directory tree builder
package main
import (
"os"
"log"
"fmt"
"path/filepath"
"strconv"
"strings"
)
@jasonmc
jasonmc / gist:2474995
Created April 24, 2012 00:39
Clojure directory tree builder
(defn buildMap [fl]
(cond
(.isDirectory fl)
(let [subfiles (filter (complement nil?) (map buildMap (.listFiles fl)))]
(list (.getAbsolutePath fl) subfiles (reduce + (map last subfiles)))
)
(.isFile fl)
(list (.getAbsolutePath fl) (.length fl))
)
)
@jasonmc
jasonmc / hack.sh
Created March 31, 2012 20:31 — forked from erikh/hack.sh
OSX For Hackers
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#