Python SDK for PhoneFactor
A first (and very alpha) attempt at creating a Python SDK for PhoneFactor.
Link: http://github.com/silas/graveyard/tree/master/python-phonefactor/
A first (and very alpha) attempt at creating a Python SDK for PhoneFactor.
Link: http://github.com/silas/graveyard/tree/master/python-phonefactor/
My attempt at wrangling a Universal Feed Parser object into JSON.
import feedparser
def json_make_normal(obj):
if type(obj) in [str, unicode, int, float, bool, dict, set, list, tuple]:
return obj
try: return dict(obj)
except: pass
try: return list(obj)
except: pass
return None
def json_handle(obj):
obj = json_make_normal(obj)
if type(obj) in [str, unicode]:
obj = obj.replace('\\', '\\\\')
obj = obj.replace('"', '\\"')
obj = obj.replace('\b', '\\\b')
obj = obj.replace('\f', '\\\f')
obj = obj.replace('\n', '\\\n')
obj = obj.replace('\r', '\\\r')
obj = obj.replace('\t', '\\\t')
return '"%s"' % obj
elif type(obj) in [int, float]:
return obj
elif type(obj) is bool:
if obj: return 'true'
else: return 'false'
elif type(obj) is type(None):
return 'null'
elif type(obj) is dict:
temp = ''
for key in obj.keys():
temp += '%s:%s, ' % (json_handle(key), json_handle(obj[key]))
return '{%s}' % temp[:-2]
elif type(obj) in [set, list, tuple]:
temp = ''
for value in obj:
temp += '%s, ' % json_handle(value)
return '[%s]' % temp[:-2]
return 'null'
data = feedparser.parse('http://digg.com/rss/index.xml')
print json_handle(data)
Link: feed_parser_to_json.py
Update: According to John Paulett jsonpickle now supports Universal Feed Parser objects. Thanks for letting me know!
How to get GNU Screen working properly in Mac OS X.
~/.bashrc
alias screen='export SCREENPWD=$(pwd); /usr/bin/screen'
export SHELL='/bin/bash -rcfile ~/.bash_profile';
case "$TERM" in
'screen')
cd $SCREENPWD
;;
esac
~/.screenrc
startup_message off
shell -$SHELL
I've created a PHP script called Post a Get which can be copied to any PHP capable server and used to created a POST request using GET syntax.
Let's say you use GoDaddy as your domain registrar and you would like to see if a domain is available using Firefox keywords, but they don't offer a GET search.
For a traditional keyword, you could construct a GET request like:
https://www.godaddy.com/gdshop/registrar/search.asp&checkAvail=1&fblur=1&tld=.com&domainToCheck=%s
But as of right now Firefox doesn't offer a way to create POST keywords. What Post a Fix does is allow you to construct a POST request using GET syntax and pass it to the Post a Get code.
So if you wanted to submit the above GET as a POST, you would construct the URL and append the special __action parameter with target URL. So the final URL would look something like:
How to get GNU Screen working properly in Mac OS X.
~/.bashrc
alias screen='export SCREENPWD=$(pwd); /usr/bin/screen'
export SHELL='/bin/bash -rcfile ~/.bash_profile';
case "$TERM" in
'screen')
cd $SCREENPWD
;;
esac
~/.screenrc
startup_message off
shell -$SHELL
alias graceful="sudo /usr/sbin/apache2 -t && sudo /etc/init.d/apache2 stop && sleep 2 && sudo /etc/init.d/apache2 start"
Manage SSH Tunnel is a simple shell script to start and stop ssh tunnels from the terminal.
Note: the setup assumes bash as the default shell
Add to ~/.bash_profile or ~/.bashrc
alias tunnel_home='/bin/sh ~/bin/tunnel.sh example.net sam 22 8888'
Replace example.net with the hostname of the server, sam with the username on the server, and 8888 with the local tunnel port
source ~/.bash_profile or source ~/.bashrcTo open the tunnel
tunnel_home start
To close the tunnel
tunnel_home close
With the release of Leopard (OS X 10.5) came a sufficiently usable Terminal (aka tabs). The only real complaint I had was the font.

I ended up tracking down the default font used in the GNOME terminal and installed it using the steps below:
VeraMono.ttfInstall FontTerminal click Terminal->PreferencesFont click Change...Bitstream Vera Sans for the Family12 for the SizeAntialias text under TextNOTE: This gadget will no longer work, Google has deprecated the inline property which this gadget required.
Hide Google Search (source) is a gadget which hides the search area of iGoogle.
I've tested the gadget with the latest versions of Firefox, IE and Safari.

The above image is how the iGoogle page will load by default. You can toggle the hidden area by clicking the line right below the navigation bar.
