Skip to content

Instantly share code, notes, and snippets.

View technomancy's full-sized avatar

Phil Hagelberg technomancy

View GitHub Profile
<bob> I am surround by air, but I seem to be drowning
<alice> Oh, maybe you are dry drowning?
<bob> well, no, I am actually very wet
<alice> oh, are you face down in a small amount of liquid
<bob> of course not, I am not an idiot
<alice> ok but why are you wet?
<bob> I am at the bottom of a pool, but air and water are both fluids so it shouldn't matter
@obra
obra / prep-for-seeed
Created August 20, 2014 23:38
A small script to prep kicad output to send to @seeedstudio
#!/bin/sh
pushd $1
for i in *.drl;
do mv $i `basename $i drl`txt;
done
for i in *Edge_Cuts.gbr;
do mv $i `basename $i Edge_Cuts.gbr`Edge_Cuts.gko;
done
popd
zip -r `date +%Y-%m-%d-`$1.zip $1
@rgbkrk
rgbkrk / hubdecrypt.sh
Last active April 6, 2022 02:55
Encrypt a (short) file using someone's public key from github
#!/usr/bin/env bash
# HubCrypt
# ========
#
# Decrypt a file encrypted using hubencrypt (ok, it's just openssl + rsautl +
# your SSH keys). It needs the private key that matches your last public key
# listed at github.com/<user>.keys
#
# Parse Erlang Crash Dumps and correlate mailbox size to the currently running
# function.
#
# Once in the procs section of the dump, all processes are displayed with
# =proc:<0.M.N> followed by a list of their attributes, which include the
# message queue length and the program counter (what code is currently
# executing).
BEGIN {
threshold = 10000 # mailbox size
procs = 0 # are we in the =procs entries?
@markandgo
markandgo / utf8.lua
Last active January 19, 2024 08:34
Kyle Smith's utf8.lua with some extra functions
-- $Id: utf8.lua 179 2009-04-03 18:10:03Z pasta $
--
-- Provides UTF-8 aware string functions implemented in pure lua:
-- * string.utf8len(s)
-- * string.utf8sub(s, i, j)
-- * string.utf8reverse(s)
-- * string.utf8char(unicode)
-- * string.utf8unicode(s, i, j)
-- * string.utf8gensub(s, sub_len)
--
@timmc
timmc / fact.swear.clj
Last active July 5, 2022 13:34
Factorial in Clojure without using alphanumeric characters
;; It all started here: http://clojure-log.n01se.net/date/2011-04-06.html#19:04
(#((% (+(*))) %) ;; call arg 1 with all args
[;; data
(+ (*)(*)(*)(*)(*)(*)(*))
;; main fn -- simulate 'if' with map lookup and closures
#(({(+) (% (+(*)(*)))} ;; if zero return 'then' clause
(% (+)) ;; dispatch on first arg
(% (+(*)(*)(*)))) ;; call 'else' clause (n not found in map)
%)
@nuclearsandwich
nuclearsandwich / gist:2040992
Created March 15, 2012 01:19
Good Eats and Drinks for Clojure/west Attendees

Good Eats and Drinks for Clojure/west Attendees

NONDISCLAIMER: I am not being paid by any of the establishments below. I am acquainted with the proprietors of Good Karma and Single Barrel but that doesn't make them bad people nor does it decrease the phenomenality of their wares.

Clojure/west is only feeding us lunch on Friday. That leaves us to our own devices for Friday's dinner, after-after-party drinks, Saturday's lunch, dinner, and drinks.

Furthermore, Clojure/west's website lists the official guide from the city of San Jose, which includes a lot of duds and places far away from the conference

@thickey
thickey / pom2proj.clj
Created March 7, 2012 01:36
Convert Maven pom.xml file to Lein project.clj
(ns pom2proj
(:require [clojure.xml :as xml]
[clojure.zip :as zip]
[clojure.java.io :as io]
[clojure.data.zip.xml :as zx])
(:use [clojure.pprint :only [pprint]]))
(defn- text-attrs
[loc ks]
(map (fn [k]
@geemus
geemus / heroku.md
Created October 12, 2011 22:17
heroku style guide

TODO empty arrays and/or nil values (see apps:info)

General Guidelines

  • Use full sentences, including punctuation.
  • Labels should be provided where needed in the form of 'Labels labels:'.
  • Commands should have one newline between the header and body and another after the body.
  • Alpha-sort arrays before display and display labeled data in alpha-sorted key order.
@hugoduncan
hugoduncan / gist:1033762
Created June 19, 2011 04:36
Use aether for artifact resolving
(ns pallet.aether
"Wrapper for aether resolution
See:
https://docs.sonatype.org/display/AETHER/Home"
(:require
[clojure.java.io :as io]
[clojure.contrib.logging :as logging])
(import
org.apache.maven.repository.internal.MavenRepositorySystemSession