Skip to content

Instantly share code, notes, and snippets.

@manoharp
manoharp / gist:f804f9f703dd8f2f5d04
Created January 6, 2015 14:19
Bayesian Methods
{
"metadata": {
"name": "Chapter1_Introduction"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
@manoharp
manoharp / gist:f1e8ac45788015ed3703
Last active August 29, 2015 14:14
sublime powershell commands
# Set shortcut for sublime command line
Set-Alias subl 'C:\Program Files (x86)\Sublime Text 3\subl.exe'
# Launch the sublime text
subl test.py
@manoharp
manoharp / gist:a9cad5a38c7040560634
Last active August 29, 2015 14:14
Installing Package Control for Sublime Text 3
# Sublime Text 3
import urllib.request,os,hashlib; h = '2deb499853c4371624f5a07e27c334aa' + 'bf8c4e67d14fb0525ba4f89698a6d7e1'; pf = 'Package Control.sublime-package'; ipp = sublime.installed_packages_path(); urllib.request.install_opener( urllib.request.build_opener( urllib.request.ProxyHandler()) ); by = urllib.request.urlopen( 'http://packagecontrol.io/' + pf.replace(' ', '%20')).read(); dh = hashlib.sha256(by).hexdigest(); print('Error validating download (got %s instead of %s), please try manual install' % (dh, h)) if dh != h else open(os.path.join( ipp, pf), 'wb' ).write(by)
# Sublime Text 2
import urllib2,os,hashlib; h = '2deb499853c4371624f5a07e27c334aa' + 'bf8c4e67d14fb0525ba4f89698a6d7e1'; pf = 'Package Control.sublime-package'; ipp = sublime.installed_packages_path(); os.makedirs( ipp ) if not os.path.exists(ipp) else None; urllib2.install_opener( urllib2.build_opener( urllib2.ProxyHandler()) ); by = urllib2.urlopen( 'http://packagecontrol.io/' + pf.replace(' ', '%20')).read(); dh = hashlib.sha256
@manoharp
manoharp / demo1.py
Last active August 29, 2015 14:14
Python Notes - Everything is an Object.
class C():
pass
def main():
print type(C)
print type(main)
print type(int)
# Everything is object
print dir(C)
@manoharp
manoharp / weasyprint_table
Created May 18, 2015 12:45
HTML file to test if weasyprint handles bgcolor
<html>
<head>
</head>
<table cellspacing="0" cellpadding="0" border="0" width="100%">
<caption> Testing WeasyPrint </caption>
<tbody>
<tr>
<td align="left" valign="top" width="1%" title bgcolor="#ffeaea">72</td>
@manoharp
manoharp / ty1_comp.py
Created December 15, 2016 15:12
Quandl TY comparison
import quandl
TY1 = quandl.get("CHRIS/CME_TY1", authtoken="hzW7pRAWuHdYT_zUk88F")
TY1_SCF = quandl.get("SCF/CME_TY1_FW", authtoken="hzW7pRAWuHdYT_zUk88F")
ax = TY1.Last.plot()
TY1_SCF.Settle.plot(ax=ax)
import matplotlib.pyplot as plt
plt.savefig('myfig')