Skip to content

Instantly share code, notes, and snippets.

Avatar

Anthony Bishopric anthonybishopric

View GitHub Profile
View gist:84b12d1e1832acdf15d2
#!/usr/bin/env ruby
require 'optparse'
options = {source: File.expand_path("~/.profile-remote"), target: "~/.profile"}
OptionParser.new do |opts|
opts.banner = "Copy a .profile script to a machine for sshing to it.\nUsage: shush [options] host"
opts.on("-s", "--source SOURCE", "The source profile file. Default is ~/.profile-remote") do |s|
options[:source] = File.expand_path(s)
@anthonybishopric
anthonybishopric / markdown2html
Created Apr 23, 2014
Needs misaka, argparse, pygments
View markdown2html
#!/usr/bin/env python
#
# USAGE:
# markdown2html foo.md > foo.html
#
#
import misaka
import argparse
View gist:9648546
2014/03/19 18:45:24 Will register yahoo at :9999
^\SIGQUIT: quit
PC=0x426da1
runtime.notetsleepg(0x9e2d00, 0xffffffffffffffff)
/usr/local/go/src/pkg/runtime/lock_futex.c:190 +0x46 fp=0x7f2c3e9ebf48
runtime.signal_recv(0x0)
/usr/local/go/src/pkg/runtime/sigqueue.goc:110 +0xe2 fp=0x7f2c3e9ebf70
os/signal.loop()
/usr/local/go/src/pkg/os/signal/signal_unix.go:21 +0x1e fp=0x7f2c3e9ebfa0
@anthonybishopric
anthonybishopric / gat
Created Mar 19, 2014
gat: execute the given command every time the working dir changes
View gat
#! /usr/bin/env ruby
#
# Example usage:
#
# 1> $ cd github.com/anthonybishopric/gotcha
# 1> $ gat go test # begin listening to this directory
#
# 2> $ cd github.com/anthonybishopric/gotcha
# 2> $ touch README.md
View classbuilder.php
<?php
interface Eater
{
public function eat(Food $food);
}
class Robot
{
public function getDiagram() {
@anthonybishopric
anthonybishopric / parse-junit
Created Oct 18, 2013
Simple script to print errors in a junit-formatted xml file.
View parse-junit
#! /usr/bin/env ruby
require "xmlsimple"
require "colored"
def parse_test_cases(test_cases)
test_cases.each do |test_case|
errs = test_case["failure"] || test_case["error"]
if errs
puts ("-->" + test_case["name"]).red
@anthonybishopric
anthonybishopric / Destructy.php
Last active Dec 19, 2015
Guess what $counter is!
View Destructy.php
<?php
function timer(callable $fn, $name, $freq=50000)
{
$start = microtime(true);
$start_mem = memory_get_usage(true);
$things = [];
for ($i = 0; $i < $freq; $i++)
{
$things[] = $fn();
@anthonybishopric
anthonybishopric / extensions.md
Last active Apr 12, 2016
Interesting PHP Extensions. These aren't necessarily good to use right off the shelf, but serve as inspiration for things that could be built.
View extensions.md
@anthonybishopric
anthonybishopric / gist:5674518
Created May 29, 2013
Steven Cipolla's branch switching script
View gist:5674518
#!/bin/bash
OIFS=$IFS
IFS=$'\n'
count=10
if [ -n "$1" ]; then
count=$1
fi
@anthonybishopric
anthonybishopric / pat
Created Dec 20, 2012
cat with syntax highlighting
View pat
#! /usr/bin/env bash
# pip install -r Pygments
pygmentize -f terminal256 $1 2>/dev/null
if [ $? -ne 0 ]
then
cat $1
fi
You can’t perform that action at this time.