Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am wraithan on github.
  • I am wraithan (https://keybase.io/wraithan) on keybase.
  • I have a public key whose fingerprint is 3AA3 F784 1CB1 6711 FB69 1172 8E2F B742 BBB3 7689

To claim this, I am signing this object:

null < 1
// true
null < 0
// false
null == 0
// false
null > 0
// false
null > -1
// true
@wraithan
wraithan / main.c
Created June 6, 2014 23:59
push data from c
#include <sys/socket.h>
#include <strings.h>
#include <netdb.h>
#include <arpa/inet.h>
#include <stdio.h>
#include <unistd.h>
int my_send(int socket, char* message) {
if (send(socket, message, strlen(message), 0) < 0) {
puts("failure");
ok 1166 NR URL utilities determining whether an HTTP status code is an error should mark a request asserting teapotness as an error
ok 1167 NR URL utilities determining whether an HTTP status code is an error should mark a request with timed-out auth as an error
ok 1168 NR URL utilities determining whether an HTTP status code is an error should mark a request for enhanced calm (brah) as an error
ok 1169 NR URL utilities copying parameters from a query hash shouldn't throw on missing configuration
ok 1170 NR URL utilities copying parameters from a query hash shouldn't throw on missing source
ok 1171 NR URL utilities copying parameters from a query hash shouldn't throw on missing destination
ok 1172 NR URL utilities copying parameters from a query hash should copy parameters from source to destination
ok 1173 NR URL utilities copying parameters from a query hash shouldn't copy ignored parameters
ok 1174 NR URL utilities copying parameters from a query hash shouldn't overwrite existing parameters in destination
@wraithan
wraithan / test.js
Created July 27, 2014 03:45
Test every second looking for a sample every 6 minutes on average
var hard_min = 60
var target = 360
var hard_max = target*2
var samples = 1e7
function test(multiplier) {
var data = []
var period = target * multiplier
var min = hard_max
var max = hard_min
@wraithan
wraithan / watch.sh
Created August 5, 2014 22:02
I like how easy it is to build simple bash scripts. I take this and then use `nodemon --exec "./watch.sh"` and basically have CI locally on my system.
#!/bin/bash
if make unit; then
osx-notifier --type 'pass' --title "nodejs-agent" --message 'unit tests';
else
osx-notifier --type 'fail' --title "nodejs-agent" --message 'unit tests';
fi
if make integration; then
osx-notifier --type 'pass' --title "nodejs-agent" --message 'integration tests';
else
set-option -g default-terminal "screen-256color"
set-option -g prefix C-z
unbind-key C-b
bind-key z send-prefix
bind-key C-z last-window
bind r source-file ~/.tmux.conf
bind c new-window -c "#{pane_current_path}"
set -g base-index 1
var dialog = require('osx-dialog')
dialog({
title: 'something',
msg: 'message',
checkboxes: [
'first',
'second',
'third'
],
@wraithan
wraithan / server.rs
Last active August 29, 2015 14:06
Read data in per line, then print it
use std::io::{TcpListener, TcpStream};
use std::io::{Acceptor, Listener};
use std::io::BufferedReader;
fn main() {
let listener = TcpListener::bind("127.0.0.1", 8080);
// bind the listener to the specified address
let mut acceptor = listener.listen();
0 info it worked if it ends with ok
1 verbose cli [ '/Users/wraithan/.nvm/versions/io.js/v2.0.0/bin/iojs',
1 verbose cli '/Users/wraithan/.nvm/versions/io.js/v2.0.0/bin/npm',
1 verbose cli 'install',
1 verbose cli 'hashring' ]
2 info using npm@2.9.0
3 info using node@v2.0.0
4 verbose install initial load of /Users/wraithan/devel/newrelic/nodejs_agent/package.json
5 verbose installManyTop reading scoped package data from /Users/wraithan/devel/newrelic/nodejs_agent/node_modules/JSV/package.json
6 verbose installManyTop reading scoped package data from /Users/wraithan/devel/newrelic/nodejs_agent/node_modules/architect/package.json