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 is a script to fix c500 footage that got mixed up. | |
If the SDI cables are switched leaving the camera entering the recorder | |
then file names will be incorrect. Files that should be numbed even are odd, | |
and files that are odd should be even. | |
Luckily those files are also separated into two different folders. | |
**Run this script in each folder separately before merging the footage ** |
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
for i in range(1,100): | |
response = '' | |
if i%3==0: | |
response += 'Crackle' | |
if i%5==0: | |
response += 'Pop' | |
if i%5 != 0 and i%3 != 0: | |
response += str(i) | |
print response |
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 re | |
import sys | |
# Email regex taken from django/django | |
# https://github.com/django/django/blob/master/django/core/validators.py#L137 | |
email_re = re.compile( | |
r"(^[-!#$%&'*+/=?^_`{}|~0-9A-Z]+(\.[-!#$%&'*+/=?^_`{}|~0-9A-Z]+)*" # dot-atom | |
r'|^"([\001-\010\013\014\016-\037!#-\[\]-\177]|\\[\001-011\013\014\016-\177])*"' # quoted-string | |
r')@(?:[A-Z0-9](?:[A-Z0-9-]{0,61}[A-Z0-9])?\.)+[A-Z]{2,6}\.?$', re.IGNORECASE) |
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 re | |
with open('ids.txt', 'r') as f: | |
data = f.read() | |
sort = [ anid for and in re.findall(r'[0-9]{9}', data)] | |
with open('newids.txt', 'w') as nl: | |
for anid in sort: | |
nl.write(anid) | |
nl.write('\n') |
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 flask import Flask, render_template | |
from flask.ext.socketio import SocketIO, emit | |
app = Flask(__name__) | |
app.config['SECRET_KEY'] = 'secret!' | |
socketio = SocketIO(app) | |
@app.route('/') | |
def index(): | |
return render_template('index.html') |
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 csv | |
import sets | |
import json | |
import string | |
import urllib | |
import operator | |
from datetime import datetime | |
with open('master.csv', 'rb') as f: #csv from client with celeb name and description |
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
##**FOR PIXEL**## | |
#With precise because LTS means LTS, XFCE works well with the high dpi and is simple to config | |
sh -e ~/Downloads/crouton -t xfce,xorg,audio,touch,keyboard,gtk-extra,extension,core,cli-extra,chrome -r precise -n REPLACE_WITH_NAME | |
#Once Trusty is supported, unity to try out | |
sh -e ~/Downloads/crouton -t unity,xorg,audio,touch,keyboard,gtk-extra,extension,core,cli-extra,chrome -r trusty -n REPLACE_WITH_NAME | |
##**FOR SAMSUNG ARM CHROMEBOOK**## |
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 os | |
from subprocess import call | |
root = "." | |
def crawl_folder(root): | |
'''crawl filesystem and apply encoding function''' | |
root = os.walk(root) #walk filesystem, return tuples | |
for root, dirs, files in root: #for each tuple, check for streamers dict, create dict and encode | |
for filename in files: |
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 string import uppercase | |
#Build fonts from txt file | |
with open('font.txt', 'rb') as fonts: | |
letters = fonts.readlines() | |
font = {} | |
for line in letters: | |
if line[0] in uppercase: | |
line = line.translate(None, '\n') | |
font[line] = [] |
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 is a demonstration of an anti-pattern I have come across in other people's | |
code that frustrates me. This is only meant as a silly learning exercise and | |
nothing more. | |
""" | |
def bad_config(some_object): | |
try: | |
data = some_object.data_field.get_data() | |
except NoDataError: | |
some_object.has_data = False |
OlderNewer