This file contains 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/python | |
## get_instagram_tag | |
## by Chris Foresman | |
## @foresmac | |
## | |
## Instagram API: http://instagram.com/developer/ | |
## Requires the requests Python library | |
## (sudo) pip install requests |
This file contains 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 theme attempts to map Solarized Dark colors to bpython similar to | |
# SublimeText 2. Requires Solarized Dark.ML.settings for Terminal.app. | |
# Copy to ~/.bpython/solarized.theme and | |
# set "color_scheme = solarized" in ~/bpython/config | |
[syntax] | |
keyword = g | |
name = d | |
comment = G |
This file contains 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
# just some sample code I made for demonstrating the turtle lib in Python | |
import turtle | |
import math | |
import random | |
turtle.colormode(255) | |
RGBCMY = [ |
This file contains 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
# I found this on stack overflow but I forget where. | |
def is_prime(n): | |
""""pre-condition: n is a nonnegative integer | |
post-condition: return True if n is prime and False otherwise.""" | |
if n < 2: | |
return False; | |
if n % 2 == 0: | |
return n == 2 # return False | |
k = 3 |
This file contains 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
from sense_hat import SenseHat | |
import time | |
p = (128, 0, 255) | |
b = (0, 0, 0) | |
frame1 = [ | |
b, b, b, b, b, b, b, b, | |
b, b, b, b, b, b, b, b, | |
b, b, b, b, b, b, b, b, |
This file contains 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
from sense_hat import SenseHat | |
import random | |
import time | |
hat = SenseHat() | |
o = (200, 128, 0) | |
r = (255, 0, 0) | |
y = (255, 255, 0) |
This file contains 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
function parse_git_branch { | |
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1) /' | |
} | |
PS1="\[\e[32m\]\$(parse_git_branch)\[\e[34m\]\h:\W \$ \[\e[m\]" | |
export PS1 |
This file contains 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 json | |
import urllib.request | |
hashtag = '' # Choose any hashtag | |
ACCESS_TOKEN = '' # Get a token from https://instagram.com/developer | |
start_url_string = 'https://api.instagram.com/v1/tags/{0}/media/recent?access_token={1}' | |
start_url = start_url_string.format(hashtag, ACCESS_TOKEN) | |
response = urllib.request.urlopen(start_url) | |
raw_data = response.read() |
This file contains 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 random | |
number_list = [i + 1 for i in range(100)] | |
pick = random.choice(number_list) | |
print 'I am thinking of a number from 1 to 100' | |
turn = 1 | |
while turn < 6: | |
guess = raw_input('Type your guess: ') |
This file contains 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
""" | |
Pseudo-random django secret key generator. | |
- Does print SECRET key to terminal which can be seen as unsafe. | |
""" | |
import string | |
import random | |
# Just use letters and digits to simplfy setting values from user_data.txt | |
chars = ''.join([string.ascii_letters, string.digits]) |
NewerOlder