Skip to content

Instantly share code, notes, and snippets.

awf-macbookair1:t awf$ cat foo.c
#include <stdio.h>
int main() {
if(1)
goto foo;
goto foo;
printf("here\n");
making all in crypto...
( echo "#ifndef MK1MF_BUILD"; \
echo ' /* auto-generated by crypto/Makefile for crypto/cversion.c */'; \
echo ' #define CFLAGS "clang -DOPENSSL_THREADS -D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H -Wa,--noexecstack -arch i386 -O3 -fomit-frame-pointer -DL_ENDIAN -DOPENSSL_BN_ASM_PART_WORDS -DOPENSSL_IA32_SSE2 -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_GF2m -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DMD5_ASM -DRMD160_ASM -DAES_ASM -DVPAES_ASM -DWHIRLPOOL_ASM -DGHASH_ASM -Werror -Weverything"'; \
echo ' #define PLATFORM "darwin-i386-cc"'; \
echo " #define DATE \"`LC_ALL=C LC_TIME=C date`\""; \
echo '#endif' ) >buildinf.h
clang -I. -I.. -I../include -DOPENSSL_THREADS -D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H -Wa,--noexecstack -arch i386 -O3 -fomit-frame-pointer -DL_ENDIAN -DOPENSSL_BN_ASM_PART_WORDS -DOPENSSL_IA32_SSE2 -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_GF2m -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DMD5_ASM -DRMD160_ASM -DAES_ASM -DVPAES_ASM -DWHIRLPOOL_ASM -DGHASH_ASM -Werror -Weverything -c

Keybase proof

I hereby claim:

  • I am adamf on github.
  • I am adamf (https://keybase.io/adamf) on keybase.
  • I have a public key whose fingerprint is F41E F82F 6DE4 458B 7135 BA51 426E 459D 37AB 83FE

To claim this, I am signing this object:

@adamf
adamf / gist:e2af92217dd41df00b12
Created January 15, 2015 04:46
Display a chessboard with chess.js
<html>
<head>
<link rel="stylesheet" href="css/chessboard-0.3.0.css" />
<script src="js/jquery-1.10.2.min.js"> </script>
<script src="js/chessboard-0.3.0.js"> </script>
</head>
<body>
<div id="board1" style="width: 400px"></div>
<script>
var board1 = new ChessBoard('board1', 'start');
<html>
<body>
<script>
// use the HTML5 audio API to make a beep.
var context = new webkitAudioContext();
var volume = context.createGain();
volume.gain.value = 0.5;
volume.connect(context.destination);
var synth = context.createOscillator();
@adamf
adamf / gist:837273
Created February 21, 2011 16:08
Diff of vexflow for adding notation-only display, but note flags don't render
diff --git a/src/formatter.js b/src/formatter.js
index 71333b6..a21a7d2 100644
--- a/src/formatter.js
+++ b/src/formatter.js
@@ -31,12 +31,12 @@ Vex.Flow.Formatter.FormatAndDraw = function(ctx, stave, notes, width) {
// Helper function to format and draw a single voice
Vex.Flow.Formatter.FormatAndDrawTab = function(ctx,
tabstave, stave, tabnotes, notes, width) {
+
var tabvoice = new Vex.Flow.Voice(Vex.Flow.TIME4_4).setStrict(false);
@adamf
adamf / gist:1043012
Created June 23, 2011 17:10
Experiments in R
# generate the distribution data and melt appropriately
k = rbind(t(replicate(100, rnorm(100,10,2))), t(replicate(100, rchisq(100,5, 2))))
s = t(apply(k, 1, summary))
foo = melt(s)
bar = melt(k)
# a plot of the smoothed data
ggplot(bar, aes(y=value, x=X1)) + geom_smooth() + ylab("milliseconds") + xlab("time")
@adamf
adamf / gist:1131155
Created August 8, 2011 03:24
Smokeping config generation with awk
traceroute www.bbc.co.uk | awk '{ trg=$3; host=$2; gsub(/\./,"_",trg); gsub(/\./,"_",host); if (NR == 1) print "\n++",trg"\n\nmenu="$3"\ntitle="$3"\nhost="$3"\n"; else if ( !/\*/ ) print "+++",host, "\n\nhost=" $2"\n"}' >> /etc/smokeping/config.d/Targets
@adamf
adamf / parse_splunk.py
Created June 1, 2016 03:37
A script to parse exported Splunk channel archives as a text with ISO8601 timestamps
#!/usr/bin/env python3
import argparse
import json
import sys
import os
import datetime
import re
----------------------------------------------------------------------
Traceback (most recent call last):
File "/Users/afletcher/thread/tests/test_tt.py", line 30, in test_timer_thread
tt.timer_thread.assert_has_calls(master_calls)
File "/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/lib/python3.5/unittest/mock.py", line 824, in assert_has_calls
) from cause
AssertionError: Calls not found.
Expected: [call(1), call(2), call(3), call(4), call(5), call(6), call(7), call(8), call(9)]
Actual: [call.__bool__(),
call(1),