Skip to content

Instantly share code, notes, and snippets.

View umrysh's full-sized avatar
🏠
Working from home

Dave Umrysh umrysh

🏠
Working from home
View GitHub Profile
#
# httpd configuration settings for use with mailman.
#
ScriptAlias /mailman/ /usr/lib/mailman/cgi-bin/
ScriptAlias /admin /usr/lib/mailman/cgi-bin/admin
ScriptAlias /admindb /usr/lib/mailman/cgi-bin/admindb
ScriptAlias /confirm /usr/lib/mailman/cgi-bin/confirm
ScriptAlias /create /usr/lib/mailman/cgi-bin/create
ScriptAlias /edithtml /usr/lib/mailman/cgi-bin/edithtml
ScriptAlias /listinfo /usr/lib/mailman/cgi-bin/listinfo
@umrysh
umrysh / uniqueAllocations.py
Last active February 14, 2017 14:37
Using the output file generated by partition.py find all combinations that contain N integers. Then find all the unique permutations of those values.
import csv
import os
import sys
numberOfDigits = 2
# From: http://stackoverflow.com/a/3682332
def int_wrapper(reader):
for v in reader:
yield map(int, v)
@umrysh
umrysh / partition.py
Created December 25, 2013 04:15
Generate all combinations of integers that sum to 100
# Makes use of the "Most Efficient Algorithm" posted here:
# http://homepages.ed.ac.uk/jkellehe/partitions.php
import csv
def partitions(n):
a = [0 for i in range(n + 1)]
k = 1
y = n - 1
while k != 0:
"""
The portfolio rebalancing bot will buy and sell to maintain a
constant asset allocation ratio of exactly 20/80 = fiat/BTC
"""
import strategy
import os
import threading
import weakref
import inspect
@umrysh
umrysh / _balancer.py
Last active December 29, 2015 00:39 — forked from prof7bit/.gitignore
"""
The portfolio rebalancing bot will buy and sell to maintain a
constant asset allocation ratio of exactly 50/50 = fiat/BTC
"""
import strategy
import os
import threading
import weakref
import inspect
@umrysh
umrysh / unknownBTConnections.sh
Created July 18, 2013 16:31
To alleviate paranoia run this script every minute through your crontab and you will get an alert if unknown IPs are connecting to your Bittorent Sync folders.
#!/bin/sh
######################################################################################
# The location of your Bittorent Sync log
LOG_LOCATION="/home/user/.btsync/btsync/sync.log"
# The list of known IPs you do not require an alert about
KNOWN_IPS="192.168.1|69.147.76.15|216.239.51.9"
# The icon for your alert
# I found a great little image here:
# http://i1-win.softpedia-static.com/screenshots/icon-60/BitTorrent-Sync.png
ALERT_IMAGE="/home/user/bin/BitTorrent-Sync.png"
#!/bin/sh
if test $# -lt 2
then
echo "Usage: start_on_desktop <desktop> <command> [<command args>...]" 1>&2
exit 2
fi
desktop=$(($1-1)) # Dave: Let the user specify the Desktop starting at 1, not 0
if [ "$2" == "subl" ] # Dave: Helpful tip for running Sublime-Text
@umrysh
umrysh / mdb2sqlite.sh
Created December 15, 2012 04:14
A modified version of the "Converting MS Access mdb files to sqlite" script posted at: http://pnenp.wordpress.com/2011/02/10/converting-ms-access-mdb-files-to-sqlite-mdb2sqlite/
#!/bin/bash
# Inspired by:
# http://nialldonegan.me/2007/03/10/converting-microsoft-access-mdb-into-csv-or-mysql-in-linux/
# http://cltb.ojuba.org/en/articles/mdb2sqlite.html
# Dave's Modifications:
# Line 25: Added code to remove COMMENT and SET statements.
# Lines 28 to 37: Added code to handle primary keys.
# Line 51: Added "postgres" to mdb-export command.