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
| # pin_shuffler.py - quick 4 digit pin generator written out of boredom. | |
| # slightly revised | |
| from itertools import permutations | |
| from random import seed, shuffle | |
| from time import time | |
| from operator import concat | |
| from functools import reduce | |
| all_pins = [x for x in permutations(range(10), 4)] | |
| seed(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
| def create_step(width, base_level, step_height, num_sides): | |
| axis = [0,0,-1] | |
| PI2 = pi * 2 | |
| rad = width / 2 | |
| init_vector = Vector([rad, 0, base_level]) | |
| quat_angles = [(cur_side/num_sides) * PI2 | |
| for cur_side in range(num_sides)] |
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 bpy | |
| import urllib.request as request | |
| import json | |
| import time | |
| user_name = "" | |
| my_url = "https://api.github.com/users/%s/gists" % user_name | |
| json_ob = json.loads(request.urlopen(my_url).read().decode("utf-8")) | |
| gist_set = [x['files'] for x in json_ob] |
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 bpy | |
| from pdb import set_trace | |
| # quick handy little lambdas | |
| first = lambda l : l[0] | |
| last = lambda l : l[-1] | |
| def chunks(lst, n): | |
| for i in range(0, len(lst), n): | |
| yield lst[i:i+n] |
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
| # reddit27_samp.py | |
| # http://docs.python.org/release/2.5.2/lib/httplib-examples.html | |
| import httplib | |
| url_string = "www.reddit.com" | |
| header_stuff = {"User-Agent":"blah blah blah"} | |
| reddit_feed = "/r/skydiving.json" | |
| conn = httplib.HTTPConnection(url_string) | |
| conn.request(method="GET", url=reddit_feed, headers=header_stuff) | |
| res = conn.getresponse() |
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
| #stupid_metaclass_tricks.py | |
| def howard(self): | |
| print("fizz") | |
| that_method = lambda : print("buzz") | |
| def foo(self): | |
| print("foo") |
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
| """ | |
| image_collector.py | |
| A script to screen scrape an image archive and then download those images | |
| one by one to a local folder. Interesting example usage of BeautifulSoup. | |
| Modify as needed for the site you intend to scrape. | |
| Use only with permission of site owner!!! | |
| Geeky Note: |
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
| """ | |
| post_test.py | |
| An example script that shows how to send data by post-method from | |
| command-line to a web application. | |
| """ | |
| import urllib.request as request | |
| import urllib.response as response | |
| import urllib.parse as parse | |
| url_string = "http://localhost:8085/A_WebApp/targetservlet" |
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
| # hn_screen_scraper.py | |
| # A screen scraper for the front page of hacker news done out of a fit of boredom. | |
| from urllib import request | |
| import re | |
| # read in the data and split it into a raw list of entries | |
| url_path = "http://news.ycombinator.com" | |
| sock = request.urlopen(url_path) | |
| raw_data = str(sock.read()) | |
| data_set = re.split("arrow\.gif", raw_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
| """ | |
| matrix_op.py | |
| A simple experimental operator for messing with matrix basics. | |
| """ | |
| import bpy | |
| from bpy.props import FloatProperty | |
| from math import pi | |
| class MatrixOp(bpy.types.Operator): |