Skip to content

Instantly share code, notes, and snippets.

import simplejson as json
import lxml
class objectJSONEncoder(json.JSONEncoder):
"""A specialized JSON encoder that can handle simple lxml objectify types
>>> from lxml import objectify
>>> obj = objectify.fromstring("<Book><price>1.50</price><author>W. Shakespeare</author></Book>")
>>> objectJSONEncoder().encode(obj)
'{"price": 1.5, "author": "W. Shakespeare"}'
"""
@arowser
arowser / gist:5597153
Created May 17, 2013 05:40
google comments
<script src="https://apis.google.com/js/plusone.js">
</script>
<div class="g-comments"
data-href="[URL]"
data-width="642"
data-first_party_property="BLOGGER"
data-view_type="FILTERED_POSTMOD">
</div>
@arowser
arowser / gist:5954256
Created July 9, 2013 02:36
Add History and Tab Completion to the Default Python Shell
# ~/.bashrc
export PYTHONSTARTUP=$HOME/.pythonstartup.py
# ~/.pythonstartup.py
try:
import readline
import rlcompleter
import atexit
import os
except ImportError:
import simplejson as json
import lxml
class objectJSONEncoder(json.JSONEncoder):
"""A specialized JSON encoder that can handle simple lxml objectify types
>>> from lxml import objectify
>>> obj = objectify.fromstring("<Book><price>1.50</price><author>W. Shakespeare</author></Book>")
>>> objectJSONEncoder().encode(obj)
'{"price": 1.5, "author": "W. Shakespeare"}'
"""
@arowser
arowser / chainsnort
Created January 2, 2014 03:01
chainsnort (cross-platform console transaction monitor)
import json, sys, time, urllib, websocket, operator
sys.tracebacklimit = 0
t0 = time.ctime() ; Z = 0
print 'chainsnort 0.410: ' ,
def main():
global Z
while (1):
bigtag = ' '
#chainsnort 0.43.3 by flatfly
#requires websocket-client!
import json, os, sys, datetime, time, urllib, websocket, operator, random, re
clr = os.system(['clear','cls'][os.name == 'nt'])
t0 = time.time() ; Z = 0
print 'chainsnort 0.43.3: ' ,
@arowser
arowser / A batchfile gets data from a pop box and uses that to send coins and emails
Created January 22, 2014 05:10
A batchfile gets data from a pop box and uses that to send coins and emails This is what bitcoin.conf looks like server=1 rpcuser=xxxxxxx rpcpassword=xxxxxxxxx keep bitcoin-qt client running in the background Got it from https://bitcointalk.org/index.php?topic=151093.0
@echo off
cls
set timeout=10
:_loop
REM call the external popclient program to get messages fro pop3 mailbox
c:\temp\popclient\popclient.exe -configfile c:\temp\popclient\democonfig.xml
REM process all the .txt files downloaded by popclient and call :_readfile for every file
for /f %%A in ('dir /B *.txt') do call :_readfile %%A
echo pause %timeout% sec ....
@arowser
arowser / merge tiny payment
Created January 22, 2014 09:20
merges all those payments, along with those for any addresses which are all tiny payments, to a single txout. Got from https://people.xiph.org/~greg/groomer.py
#!/usr/bin/python
# simple cleanup script, 2012-12-25 <[email protected]>
import sys
import operator
from decimal import *
from jsonrpc import ServiceProxy
if len(sys.argv)<3:
print 'Usage %s http://user:[email protected]:8332/ [fee]'%(sys.argv[0])
print 'This script generates a transaction to cleanup your wallet.'
print ' It looks for the single addresses which have the most small confirmed payments made to them and merges'

Multiple SSH Keys settings for different github account

create different public key

create different ssh key according the article Mac Set-Up Git

$ ssh-keygen -t rsa -C "[email protected]"
var map,heatmap;
var taxiData = new Array();
var gradient = [
'rgba(0, 255, 255, 0)','rgba(0, 255, 255, 1)',
'rgba(0, 191, 255, 1)','rgba(0, 127, 255, 1)',
'rgba(0, 63, 255, 1)','rgba(0, 0, 255, 1)',
'rgba(0, 0, 223, 1)','rgba(0, 0, 191, 1)',
'rgba(0, 0, 159, 1)','rgba(0, 0, 127, 1)',
'rgba(63, 0, 91, 1)','rgba(127, 0, 63, 1)',
'rgba(191, 0, 31, 1)','rgba(255, 0, 0, 1)'