Skip to content

Instantly share code, notes, and snippets.

View halkeye's full-sized avatar

Gavin Mogan halkeye

View GitHub Profile
@halkeye
halkeye / build_uchiwa_tarball.sh
Created March 19, 2015 18:52
Quick script to build a complete uchiwa tarball
#!/bin/bash
export GOPATH=`pwd`
set -e
# grab and compile soruce code
go get github.com/sensu/uchiwa
cd $GOPATH/src/github.com/sensu/uchiwa
export VERSION=$(head -n 1 CHANGELOG.md | sed 's/#\+ \([0-9.]\+\).*/\1/g')
@halkeye
halkeye / nginx.conf
Created March 31, 2015 17:40
nginx+cloudflare redirect
location / {
if ($http_cf_visitor !~ https) {
rewrite ^(.*) https://$http_host$1 permanent;
}
}
(function() {
if (document.getElementsByClassName('show_more_backings')[0].offsetParent !== null) {
alert("You must click 'Show More Pledges' and load all your pledges before running this bookmarklet");
return false;
};
var collectData = function collectData() {
var nodes = $$('#collected .money');
var ksData = [["Project", "Amount", "Currency", "Got It!"]];
for (var i = 0; i < nodes.length; i++) {
var ksRow = [];
@halkeye
halkeye / top-level-jars.sh
Created October 23, 2015 05:20
hacked solution to track down jar files with top level class files
for jar in $(find ~/.m2/repository -name '*.jar'); do unzip -qql $jar | awk '{ if ($4 ~ /^\w+\.class$/) exit 1 }' || echo $jar ; done
@halkeye
halkeye / saucelabs-swagger.yml
Last active April 8, 2016 17:37
Attempting to start making a swagger file for saucelabs api
# for i in java ruby; do java -jar ./modules/swagger-codegen-cli/target/swagger-codegen-cli.jar generate -i ../saucerest-java/swagger.yml -l ${i} -o samples/client/saucelabs/${i}/default -DgroupId=com.saucelabs -DartifactId=saucerest -DartifactVersion=2.0.0 -DserializableModel=true; done
swagger: '2.0'
info:
title: Sauce Labs REST API
description: Do the thing!
version: 1.0.0
termsOfService: 'https://saucelabs.com/tos/'
contact:
name: Sauce Labs
url: 'http://saucelabs.com'
@halkeye
halkeye / selenium.py
Last active February 17, 2017 21:32
Simple simple selenium script
#!/usr/bin/env python
import requests
import json
import os
from requests.auth import HTTPBasicAuth
browsers = json.loads(os.environ['SAUCE_ONDEMAND_BROWSERS'] or '[{ "browser": "firefox", "platform":"MAC", "browser-version": "latest" }]' )
auth=HTTPBasicAuth(os.environ['SAUCE_USER_NAME'], os.environ['SAUCE_ACCESS_KEY']);
for browser in browsers:
@halkeye
halkeye / terraria.service
Created February 12, 2017 18:07
My systemd file for running terraria
[Unit]
Description=terraria
After=docker.service
Requires=docker.service
[Service]
TimeoutStartSec=0
Restart=always
# needed because tshock crashes when no stdin
StandardInput=tty

Keybase proof

I hereby claim:

  • I am halkeye on github.
  • I am gavinmogan (https://keybase.io/gavinmogan) on keybase.
  • I have a public key ASB_j6WSukAVQi_kZTmTMcpFgu3CziPcH0p9pV80cSZn2Ao

To claim this, I am signing this object:

#!/bin/bash
set -e
cd /storage/games/minecraft
./bin/mcmap -from -50 -50 -to 50 50 -info servers/new_craft/map_info.json -file servers/new_craft/map.png servers/new_craft/world >/dev/null
rm servers/new_craft/map.zip
zip --quiet -9 -r servers/new_craft/map.zip servers/new_craft/world
s3cmd --acl-public -c .s3cfg put servers/new_craft/map.png s3://minecraft-gavinmogan/
s3cmd --acl-public -c .s3cfg put servers/new_craft/map.zip s3://minecraft-gavinmogan/
import sys
import time
try:
import RPi.GPIO as GPIO
except RuntimeError:
print(
"Error importing RPi.GPIO! " +
"This is probably because you need superuser privileges. " +
"You can achieve this by using 'sudo' to run your script")