This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
How to use: | |
1. Place a "Python Script" node on your canvas | |
2. Hook your "Classification Tree" node out into the "Python Script" input | |
3. Paste this gist in the python script and hit "Execute" | |
The output should be similar to this: | |
# slope (<32.000, 34.000>) | |
if slope <=1.008: return False #(<7.000, 0.000>) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
This gist is a one-click pip setup for windows: | |
1. installs distribute if needed | |
2. installs pip | |
3. (On windows) sets the path environment variable so "pip" is always runnable from cmd. | |
Tested on Windows 7 with python2.7 | |
""" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Orange | |
bad_list = [ | |
'abc', | |
'bcd', | |
] | |
id_index = in_data.domain.index('the_col_id') | |
out_data = Orange.data.Table(in_data) | |
# reversed so that the indexing is consistent after deletion | |
for i, row in reversed(list(enumerate(in_data))): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python2.7 | |
""" | |
Outputs on my PC: | |
"python2.7 startup_times.py nop" min run 0.019732 seconds | |
"python3.3 startup_times.py nop" min run 0.026251 seconds | |
""" | |
import subprocess | |
import time |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Analyze USA h1b salaries | |
data from http://www.foreignlaborcert.doleta.gov/quarterlydata.cfm | |
specifically: | |
http://www.foreignlaborcert.doleta.gov/pdf/quarter_2_2012/PW_FY2012_Q2.csv | |
""" | |
import math |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html manifest="main.appcache"> | |
<meta charset="utf-8"> | |
<style> | |
.circle, .wave { | |
fill: none; | |
stroke: steelblue; | |
stroke-width: 1.5px; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pprint | |
import os | |
from collections import Counter | |
ascii_markers = "|\\/_\" ()n" | |
def ascii_prob(line): | |
line = line.strip() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
SimpleHTTPServerSSL.py - simple HTTP server supporting SSL/TLS. I.e. HTTPS. For python 3.3 | |
- replace CERT and KEY with the location of your .pem server file. | |
- the default port is 443. | |
usage: python SimpleHTTPServerSSL.py | |
based on http://code.activestate.com/recipes/442473-simple-http-server-supporting-ssl-secure-communica/ | |
''' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Convert LocationHistory.json from Google takeout of location history (latitude) | |
to a usable KML file for viewing in Google Earth. | |
Usage: | |
python json_history_to_kml.py LocationHistory.json | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Data from | |
http://en.wikipedia.org/wiki/CPU_socket#List_of_80x86_sockets_and_slots | |
copy pasted html to excel, copy pasted excel to python | |
ran python | |
pasted output to excel, drew a graph | |
There's probably a simpler way to do a pivot table but I don't know how. |
OlderNewer