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 random | |
def rstr(length=5, special_chars=True, numbers=True, upper_case=True): | |
chars = string.ascii_lowercase | |
chars += string.ascii_uppercase if upper_case else '' | |
chars += string.digits if numbers else '' | |
chars += string.punctuation if special_chars else '' | |
return ''.join(random.choice(chars) for i in range(length)) |
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
from itertools import chain, product | |
from re import match, findall | |
import pprint | |
pp = pprint.PrettyPrinter(indent=4) | |
GRAMMAR = ''' | |
<sentence> ::= <noun phrase=""> <verb phrase=""> | |
<noun> ::= "boy " | "troll " | "moon " | "telescope " | |
<transitive verb=""> ::= "hits " | "sees " |
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
#--# | |
#--# Database structure for Pretio | |
#--# | |
DROP TABLE IF EXISTS Folders; | |
DROP TABLE IF EXISTS Files; | |
DROP TABLE IF EXISTS Users; | |
DROP TABLE IF EXISTS Contents; | |
CREATE TABLE Users ( | |
userid Integer AUTO_INCREMENT, |
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
from bisect import bisect | |
from random import random | |
def weighted_choice(choices): | |
values, weights = zip(*choices) | |
total = 0 | |
cum_weights = [] | |
for w in weights: | |
total += w | |
cum_weights.append(total) | |
guess = random () * total |
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
function AddSystemPaths([array] $PathsToAdd) { | |
$VerifiedPathsToAdd = "" | |
foreach ($Path in $PathsToAdd) { | |
if ($Env:Path -like "*$Path*") { | |
echo " Path to $Path already added" | |
} | |
else { | |
$VerifiedPathsToAdd += ";$Path";echo " Path to $Path needs to be added" |
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
################################################################## | |
# Asset Generator (assetGenerator.py) | |
# Kyle Pulver | |
# @kylepulver | |
# http://kpulv.com | |
# 2013 / 2 / 3 | |
# Version 1.0.0 | |
# | |
# Put this file in your AS3 Project root. | |
# |
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 string | |
#It irks me greatly how my dir is just as useless as dir right now. sasuke it all away. | |
def _dirt_recurse(module, verbose=False, file=False, tab_width=0): | |
list = dir(module) | |
if file: | |
# TODO: put that shit in a file | |
pass | |
else: |
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
#[Embed(source = 'res/treble/a2.mp3')] public static const T_A2:Class; | |
#public static var bassArray:Array = [B_A, B_C, B_D, B_E, B_G, B_A1 ]; | |
import sys, string | |
def main(): | |
relative_path = sys.argv[1] | |
identifier = sys.argv[2] | |
underscore = "_" | |
if (identifier == "!"): |
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 sys | |
import os | |
import string | |
import random | |
import shutil | |
# Usage: "python Randomizer.py root_dir out_dir number_to_get [file_extensions]" | |
# file_extensions e.g. -> ".mp3 .wav .ogg .flac" | |
if __name__ == '__main__': |
NewerOlder