Skip to content

Instantly share code, notes, and snippets.

View apg's full-sized avatar
🐢
Turtle

Andrew Gwozdziewycz apg

🐢
Turtle
View GitHub Profile
@apg
apg / pre-commit
Created December 6, 2013 17:03
Never commit invalid json again! chmod +x, and add to .git/hooks/
#!/bin/sh
for n in `git status --porcelain | grep -E '^(M|A)' | grep -E '\.json$' | awk '{print $2}'`; do
if ! python -m json.tool $n > /dev/null; then
echo "$n failed to pass json sanity checks"
exit 1;
fi
done
@apg
apg / gist:6788400
Created October 2, 2013 02:42
dwmstatus with power.
#define _BSD_SOURCE
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <string.h>
#include <strings.h>
#include <ctype.h>
#include <sys/time.h>
#include <time.h>
@apg
apg / wrapup-23.markdown
Last active December 16, 2015 11:58
Hack and Tell, Round 23 Wrapup.

Subject: Round 23: Tax man came and took my $$$, now all my other bills are gonna be late

(Have a complaint about this email? Want to make it better, fix a typo, or add more info? Fork the gist on GitHub! Or, click through to read a rendered version.)

Hello Hackers-

Subject: Round 20: Happy Hacking!

Hello Hackers-

(This wrap up is a little late--you can blame life.)

Thanks to Lot18 for hosting us! BTW, if it wasn't obvious from all the wine, they sell wine online.

Last month's wrap up "fun way to spend some time"

@apg
apg / round22-wrapup.md
Created March 8, 2013 05:16
Hack and Tell Wrapup, Round 22: Be there, or be a Icosadigon

Hello Hackers-

Thanks to Harvest for being wonderful hosts! Plenty of beer, soda, vegan pizza and even some candy! It was a party like no other, especially thanks to you all.

Sorry for the late wrap up email! We've been too busy obsessing over /usr/sbin/powertop output late at night...

Public Service Announcement

@apg
apg / round-21-wrapup.md
Created January 25, 2013 04:37
Hack and Tell Round 21 Wrapup.

Subject: Round 21: We had a hunch

Hello Hackers-

Thanks to ebay/hunch/svpply for hosting us! The beer was a plenty, and the pizza too. Be sure to bid on tickets to the next Hack and Tell!

A sad note...

I think that people really use software licenses to express intentions, and don’t really read the details of the licenses. So I think that licenses should be made as simple as possible, so that they don’t disagree with intentions… thus, haiku licensing:
PD: do what you feel like / since the work is abandoned / the law doesn’t care
MIT: take my code with you / and do whatever you want / but please don’t blame me
LGPL: you can copy this / but make modified versions / free in source code form
MPL: like LGPL / except netscape is allowed / to change the license
GPL: if you use this code / you and your children’s children / must make your source free
RIAA: if you touch this file / my lawyers will come kill you / so kindly refrain
@apg
apg / agent-start
Created January 17, 2013 21:41
Best way to start an ssh-agent that I know of. Stick it in your .bash_profile for ultimateness.
export SSH_AUTH_SOCK=$HOME/.ssh/agent.sock
if ! ([ -S "$SSH_AUTH_SOCK" ] && { ssh-add -l >& /dev/null || [ $? -ne 2 ]; }) ; then
echo "Starting agent..."
eval "$(ssh-agent -s -a $SSH_AUTH_SOCK)" > /dev/null
fi
@apg
apg / foo.c
Created December 26, 2012 18:39 — forked from anonymous/foo.c
/*
Yeah, so obviously I need to use a better salt for the key derivation, and of course I need to do a better job all together with other things (IV, etc).
This is just a test run for using libgcrypt to do symmetric encryption, however.
GCRY_KDF_PBKDF2
gcry_kdf_derive ( const void *passphrase, size_t passphraselen, int algo, int subalgo, const void *salt, size_t saltlen, unsigned long iterations, size_t keysize, void *keybuffer )
@apg
apg / gist:4119225
Created November 20, 2012 16:54
throbber art - generated by a stuck seige throbber and CTRL-C
^|^/^-^\^/^-^\^|^-^\^|^/^\^|^/^-^|^/^-^\^/^/^\^|^/^-^\^/^-^\^|^-^\^|^/^\^|^
/^-^|^/^-^\^/^-^\^|^-^\^|^/^\^|^/^-^|^/^-^\^/^-^\^|^-^\^|^/^\^|^/^-^|^/^-^\
^/^-^\^|^-^\^|^/^\^|^/^-^|^/^-^\^/^-^\^|^-^\^|^/^\^|^/^-^|^/^-^\^/^-^\^|^-^
\^|^/^\^|^/^-^|^/^-^|^/^-^\^/^-^\^|^-^\^|^/^-^|^/^-^\^/^-^\^|^-^\^|^/^\^|^/
^-^|^/^-^\^/^-^\^|^-^\^|^/^\^-^\^|^/^-^\^/^-^\^|^-^\^|^/^\^|^/^-^|^/^-^\^/^
-^\^|^-^\^|^/^\^|^/^-^|^/^-^\^/^-^\^|^-^\^|^/^\^|^/^-^|^/^-^\^/^-^\^|^-^\^|
^/^\^|^/^-^|^/^-^\^/^-^\^|^-^\^|^/^\^|^/^-^|^/^-^\^/^-^\^|^-^\^|^/^\^|^/^-^
|^/^-^\^/^-^\^|^-^\^|^/^\^|^/^-^|^/^-^\^/^-^\^|^-^\^|^/^\^|^/^-^|^/^-^\^/^-
^\^|^-^\^|^/^\^|^/^-^|^/^-^\^/^-^\^|^-^\^|^/^\^|^/^-^|^/^-^\^/^-^\^|^-^\^|^
/^\^|^/^-^|^/^-^\^/^-^\^|^-^\^|^/^\^|^/^-^|^/^-^\^/^-^\^|^-^\^|^/^\^|^/^-^|