Skip to content

Instantly share code, notes, and snippets.

View hamiltont's full-sized avatar
🕵️‍♂️
huntin' wabbits

Hamilton Turner hamiltont

🕵️‍♂️
huntin' wabbits
View GitHub Profile
// More information: https://danielupshaw.com/openscad-rounded-corners/
module roundedcube_simple(size = [1, 1, 1], center = false, radius = 0.5) {
// If single value, convert to [x, y, z] vector
size = (size[0] == undef) ? [size, size, size] : size;
translate = (center == false) ?
[radius, radius, radius] :
[
radius - (size[0] / 2),
@lubosz
lubosz / weather.sh
Created April 14, 2015 19:11
display a weather gif in terminal
#!/bin/sh
DOWNLOAD_DIR=~/Downloads/weather
REGION=txgulf
# make download dir if not available
if [ ! -d "$DOWNLOAD_DIR" ]; then
mkdir -p $DOWNLOAD_DIR
fi
@gubatron
gubatron / dht-walkthrough.md
Last active April 24, 2024 11:14
DHT walkthrough notes

DHT Walkthrough Notes

I've put together these notes as I read about DHT's in depth and then learned how the libtorrent implementation based on the Kademlia paper actually works.

What problem does this solve?

400,000,000,000 (400 billion stars), that's a 4 followed by 11 zeros. The number of atoms in the universe is estimated to be around 10^82. A DHT with keys of 160 bits, can have 2^160 possible numbers, which is around 10^48

@msmith-techempower
msmith-techempower / gist:0b105594d038afb7cd93
Last active May 28, 2017 16:28
Manually run a framework test
# We should definitely get this automated somehow.
# ASSUMPTIONS: 1) db/client/app are all localhost, 2) your user is "vagrant", 3) your testrunner user is "testrunner", 4) you don't care about performance, 5) you are using port 8080, 6) your json test URI is "/json".
# This is what you will need to do in order to manually test a given framework:
# 1 - Become the testrunner
sudo su testrunner
# 2 - Set some required environment variables
export FWROOT=$(pwd)
export IROOT=$FWROOT/installs
@nk9
nk9 / largestFiles.py
Last active November 14, 2023 09:47
Python script to find the largest files in a git repository.
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Python script to find the largest files in a git repository.
# The general method is based on the script in this blog post:
# http://stubbisms.wordpress.com/2009/07/10/git-script-to-show-largest-pack-objects-and-trim-your-waist-line/
#
# The above script worked for me, but was very slow on my 11GB repository. This version has a bunch
# of changes to speed things up to a more reasonable time. It takes less than a minute on repos with 250K objects.
#
@gdoteof
gdoteof / gist:36c8ddf4650bb7c92a24
Last active August 29, 2015 14:02
get bash shell for latest built docker
LASTDOCKER=`docker ps -l | tail -n1 | awk {'print $1'}` && \
docker commit $LASTDOCKER recent && \
docker run -i -t recent /bin/bash
@daniellawrence
daniellawrence / tasks.py
Created October 17, 2013 10:54
Queuing fabric tasks and stream reading output using celery & redis - A little bit of evil with tempfiles and stdout redirection.
# RUN ME, I am the worker!
# $ pip install fabric celery-with-redis
# $ celery -A tasks worker -E --loglevel=debug
from celery import Celery
from time import sleep
from fabric.api import env, run, execute
import sys
celery = Celery('tasks', broker='redis://', backend='redis://')
@hamiltont
hamiltont / bex2csv.py
Last active December 15, 2021 14:37 — forked from shanewholloway/gist:3536969
Converts Billings 3 Slips into CSV readable. Export entire Slip Log by right-clicking on slips, choosing to export, saving as bex. Run this script in any folders containing the bex files. They will be found, parsed, and the output will be written to a CSV file in the same folder
import csv
import glob
import plistlib
clientProject = 'My Project'
for filename in glob.glob("*.bex"):
root = plistlib.readPlist(filename)
with open(filename+'.csv', 'wb') as out:
out = csv.writer(out, delimiter='|')
out.writerow(['Slip', 'Start', 'End', 'Duration (minutes)'])
@spikegrobstein
spikegrobstein / nginx.conf
Last active September 22, 2023 04:19
nginx config for proxying requests for plex over a hostname-based virtualhost.
upstream plex-upstream {
# change plex-server.example.com:32400 to the hostname:port of your plex server.
# this can be "localhost:32400", for instance, if Plex is running on the same server as nginx.
server plex-server.example.com:32400;
}
server {
listen 80;
# server names for this server.
@sebfisch
sebfisch / replace-classes-in-apk.sh
Created May 22, 2012 08:58
Replaces classes in Android Package Files
#!/bin/bash
# Replaces classes in Android Package Files
# (c) Sebastian Fischer, CC-BY
# Can be used to rebuild an App with a modified version of a used library,
# as required for closed works that link to an LGPL library.
# Depends on: https://code.google.com/p/dex2jar/