Skip to content

Instantly share code, notes, and snippets.

View keybase.md

Keybase proof

I hereby claim:

  • I am hawx on github.
  • I am hawx (https://keybase.io/hawx) on keybase.
  • I have a public key ASD8XrovFOPizoGwLG8dtAm7RyqQAHPjqyAYnqYaHy61Bgo

To claim this, I am signing this object:

@hawx
hawx / helpscout.d.ts
Created Nov 10, 2017
Typings for the helpscout beacon <https://www.helpscout.net>
View helpscout.d.ts
interface HelpScout {
beacon: HelpScoutBeacon;
}
interface HelpScoutBeacon {
config(configObject: HelpScoutConfig): void;
ready(handler: () => void): void;
open(): void;
close(): void;
toggle(): void;
@hawx
hawx / checkbox.test.js
Created Apr 24, 2017
Testing checkbox in Angular...
View checkbox.test.js
it('test', () => {
const element = `
<section>
<label>
<input type="checkbox" name="test" ng-model="$ctrl.value" />
ok
</label>
<div ng-if="$ctrl.value">what</div>
</section>
@hawx
hawx / radio.test.js
Created Apr 24, 2017
Testing radio buttons in Angular...
View radio.test.js
it('test', () => {
const element = `
<section>
<label>
<input type="radio"
ng-value="true"
name="test"
ng-model="$ctrl.value"
hidden
required />
View index.js
'use strict';
var GitHub = require('github-api');
var fetch = require('node-fetch');
var exec = require('child_process').exec;
const gh = new GitHub({ token: 'MY_TOKEN' });
const org = gh.getOrganization('MY_ORG');
fetch('https://api.bitbucket.org/2.0/teams/MY_ORG/repositories')
@hawx
hawx / listener.go
Last active Feb 5, 2016
HTTP Listener
View listener.go
package main
import (
"io/ioutil"
"log"
"net/http"
"os"
"strings"
)
@hawx
hawx / quit.go
Created Jan 2, 2016
Example showing how to provide a blocking-close for long running processes in golang. The process will run until Close() is called, this call blocks until the process has actually stopped.
View quit.go
package main
import (
"log"
"time"
)
type Process struct {
quit chan struct{}
}
@hawx
hawx / poker_test.py
Last active Dec 2, 2015
Suit-blind poker hands kata solution in simple (fors and ifs as much as possible) Python
View poker_test.py
import unittest
def winner(hand1, hand2):
hand1 = sorted(hand1, reverse=True)
hand2 = sorted(hand2, reverse=True)
result = try_winner([four_of_a_kind, full_house, straight, three_of_a_kind,
two_pairs, pair], hand1, hand2)
if result != 0:
@hawx
hawx / reboot.sh
Last active Nov 16, 2015
Reboot sonoses in ip range
View reboot.sh
#/usr/bin/env bash
#
# eg. ./reboot.sh 192.168.1
for ip in $1.{1..254}; do
curl "http://$ip:1400/reboot" -m 2 2>/dev/null &
done
@hawx
hawx / build.sh
Last active Oct 13, 2015
Building evmpd on raspbian
View build.sh
git clone https://github.com/hawx/evmpd
cd evmpd
sudo apt-get install libmpdclient-dev
wget http://mirror.ox.ac.uk/sites/archive.raspbian.org/archive/raspbian/pool/main/libe/libevdev/libevdev-dev_1.3+dfsg-1_armhf.deb
sudo apt-get install libjs-jquery # WHAT?
sudo dpkg -i libevdev-dev_1.3+dfsg-1_armhf.deb
make
You can’t perform that action at this time.