Skip to content

Instantly share code, notes, and snippets.

View throughnothing's full-sized avatar

William Wolf throughnothing

View GitHub Profile
@throughnothing
throughnothing / dbic_stringify.pl
Created December 13, 2013 01:29
String overload DBIC objects?
package DBIx::Class::Core;
use overload '""' => sub { to_dumper( +{ shift->get_columns } ); };
@throughnothing
throughnothing / coinbase-price.pl
Created December 2, 2013 18:39
Get Coinbase BTC Price
#!/usr/bin/env perl
use v5.10; use ojo;
say g('https://coinbase.com/api/v1/prices/buy')->json->{subtotal}{amount};
/*
author: jbenet
os x, compile with: gcc -o testo test.c
linux, compile with: gcc -o testo test.c -lrt
*/
#include <time.h>
#include <sys/time.h>
#include <stdio.h>
@throughnothing
throughnothing / README.md
Last active December 29, 2015 05:39
libbitcoin OS X Mavericks

To build on Mac OSX, you will need to download and compile your own boost, leveldb using gcc 4.7 before building libbitcoin. Then set the following environment variables before running the build process.

CC=/usr/local/bin/gcc-4.7
CXX=/usr/local/bin/g++-4.7

For Mac OSX Mountain Lion, you need to follow these brew commands:

$ brew install boost openssl leveldb curl

Install and configure brew
$ ruby -e "$(curl -fsSkL raw.github.com/mxcl/homebrew/go)"
$ touch ~/.bashrc
$ echo "export CFLAGS=\"-arch x86_64\"" >> ~/.bashrc
$ echo "export ARCHFLAGS=\"-arch x86_64\"" >> ~/.bashrc
$ source ~/.bashrc
$ brew update
$ brew doctor
Do what the doctor says! This will more than likely include installing XCode from the App Store and then installing the "Command line tools" from "Xcode > Preferences > Downloads"
# STDIN 2013-08-19T00:00:00,164
gnuplot -p -e "set datafile separator ','; set xdata time; set timefmt '%Y-%m-%dT%H:%M:%S'; plot '< cat -' using 1:2;"
use v5.14;
my $s = 'api.log';
my @files = qw(
api.log api.log.1 api.log.2.gz api.log.3.gz api.log.4.gz api.log.5.gz
api.log.6.gz api.log.7.gz
);
say $_ =~ /$s(\.[0-9]+(\.gz)?)?/ ? "Yes: $_" : "No: $_" for @files;
@throughnothing
throughnothing / MojoEventSource.md
Last active December 16, 2015 06:39
Sample Mojolicious EventSource App that gets messages from a Stomp Message Queue

Mojolicious EventSource Example App

Dependencies

cpanm -n AnyEvent::STOMP Mojolicious List::MoreUtils

Test Message Queue

tmux cheatsheet

As configured in my dotfiles.

start new:

tmux

start new with session name:

perl_set $uid '
use Digest::MD5 qw(md5_hex);
sub {
return md5_hex(`od -vAn -N4 -tu4 < /dev/urandom`);
}';
#pass to fcgi
location ... {
fastcgi_param UNIQUE_ID $uid