Skip to content

Instantly share code, notes, and snippets.

View benizi's full-sized avatar

Benjamin R. Haskell benizi

View GitHub Profile
@benizi
benizi / abbrev.sh
Last active September 23, 2017 18:55
history of one liner
perl -Mstrict -wE 'my(@I,%h,@q,%S);sub J{join":",@_}sub P{my$s=$_;map substr($s,0,$_),1..length$s}while(<STDIN>){chomp;my@f=split/:/;push@I,\@f;my$h=\%h;$h=($$h{$_}//={})for@f}@q=[\%h];while($_=shift@q){my($h,@p)=@$_;if(my@k=keys%$h){my%u;$u{$_}++for map P,@k;my%s=map{($_,grep$u{$_}==1,P)[0,1]}@k;$S{J@p}={%s};push@q,map[$$h{$_},@p,$_],keys%$h}}for(@I){my(@p,@s);for my$i(@$_){push@s,$S{J@p}{$i};push@p,$i}print J(@p),"\t",J(@s),$/}' < ~/colindean.categories.problem
@benizi
benizi / sendRawEth.c
Last active June 3, 2017 17:30 — forked from twaldecker/sendRawEth.c
Send a raw Ethernet frame in Linux
/*
* Added the command line arguments for interface and MAC Address
*
* Based on raw Ethernet from austinmarton: https://gist.github.com/1922600
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*/
@benizi
benizi / error.txt
Last active March 19, 2016 05:24
Weird error trying to clone github/hub
$ git clone -o github https://github.com/github/hub
Cloning into 'hub'...
remote: Counting objects: 12280, done.
error: object 9ef2af57366f63deb751b92a8ca630fe598b10f0: zeroPaddedFilemode: contains zero-padded file modes
fatal: Error in object
fatal: index-pack failed
@benizi
benizi / web-servers.md
Created February 15, 2016 05:50 — forked from willurd/web-servers.md
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000

This document aims to help aggregate issues and solutions around the defaultContainer deprecation.

The Error Message:

Using the defaultContainer is no longer supported. [defaultContainer#lookup]

Where's my defaultContainer?

Well it is still there, and will continue to work for some time. Likely it will be gone by 1.0.0 final

@benizi
benizi / promises.md
Last active August 29, 2015 14:06 — forked from domenic/promises.md

This article has been given a more permanent home on my blog. Also, since it was first written, the development of the Promises/A+ specification has made the original emphasis on Promises/A seem somewhat outdated.

You're Missing the Point of Promises

Promises are a software abstraction that makes working with asynchronous operations much more pleasant. In the most basic definition, your code will move from continuation-passing style:

getTweetsFor("domenic", function (err, results) {
 // the rest of your code goes here.
@benizi
benizi / keybase.md
Created July 17, 2014 12:39
Keybase proof

Keybase proof

I hereby claim:

  • I am benizi on github.
  • I am benizi (https://keybase.io/benizi) on keybase.
  • I have a public key whose fingerprint is 5FF6 7185 C9AA DAE6 666A 4564 DB01 B3D1 4A6B 6036

To claim this, I am signing this object:

@benizi
benizi / a-test
Last active August 29, 2015 14:03
just-a-test svg=>png
- created SVG in Inkscape with text flowed along spiral
- ran `convert svg.svg just-a-test.png`
(ns ga-exp.core
(:import
(com.google.api.client.googleapis.auth.oauth2 GoogleCredential$Builder)
(com.google.api.client.googleapis.javanet GoogleNetHttpTransport)
(com.google.api.client.json.jackson2 JacksonFactory)
(com.google.api.services.analytics Analytics$Builder AnalyticsScopes)))
(def HTTP_TRANSPORT (GoogleNetHttpTransport/newTrustedTransport))
(def JSON_FACTORY (JacksonFactory.))
#!/bin/bash
if ! [ $# -eq 1 ]; then
echo "Usage: $0 <node-name>"
exit 1
fi
# Directory where everything happens
DIR=~/work/virt-install
# The image downloaded from the http://fedoraproject.org/en/get-fedora#clouds site