Skip to content

Instantly share code, notes, and snippets.

View BlogBlocks's full-sized avatar

Jack Northrup BlogBlocks

View GitHub Profile
# -*- coding: utf-8 -*-
"""
Collage maker - tool to create picture collages
Author: Delimitry
"""
import time
import argparse
import os
import random
from PIL import Image
import sqlite3
import os.path
from os import listdir, getcwd
from IPython.core.display import Image
def getImage_list(rel_path):
abs_path = os.path.join(os.getcwd(),rel_path)
print 'abs_path =', abs_path
dir_files = os.listdir(abs_path)
return dir_files
def dbread():
import sqlite3
conn = sqlite3.connect('XPfts4.db')
c = conn.cursor()
count = 0
req = 100
view = raw_input("Search : ")
for row in c.execute('SELECT rowid, code FROM pages WHERE pages MATCH ?', (view,)):
count=count+1
print (row)[0],"-",(row)[1],"\n"
import sqlite3
import os.path
from os import listdir, getcwd
from IPython.core.display import Image
def get_picture_list(rel_path):
abs_path = os.path.join(os.getcwd(),rel_path)
print 'abs_path =', abs_path
dir_files = os.listdir(abs_path)
return dir_files
import os
from time import sleep
import sqlite3
import os, requests, sys, json
import GISTkey
username=GISTkey.gistkey()[0]
password=GISTkey.gistkey()[1]
database ="GISTstore/gist.db"
conn = sqlite3.connect(database)
c = conn.cursor()
# USE:
#import GISTkey
#username=GISTkey.gistkey()[0]
#password=GISTkey.gistkey()[1]
def gistkey():
username='username'
password="password"
GistAPI = (username, password)
return GistAPI
#!/usr/bin/python
#USE: python SimpleGistPost.py FileToPost.py
import os, requests, sys, json
import GISTkey
from time import sleep
username=GISTkey.gistkey()[0]
password=GISTkey.gistkey()[1]
filename = os.path.basename(sys.argv[1])
content=open(filename, 'r').read()
r = requests.post('https://api.github.com/gists',json.dumps({'files':{filename:{"content":content}}}),auth=requests.auth.HTTPBasicAuth(username, password))
@BlogBlocks
BlogBlocks / Pmp3.py
Last active July 18, 2018 03:51
play music while "Jupytering"
import pyglet
def exit_callback(dt):
pyglet.app.exit()
return
def pmp3(mp3File):
music = pyglet.media.load(mp3File)
music.play()
pyglet.clock.schedule_once(exit_callback , music.duration)
pyglet.app.run()
return
# USAGE example:
# import UnCamel
# x = "TimeToUncamelCaseTextUsingFunctions"
# UnCamel.uncamel(x)
def uncamel(x):
return reduce(lambda a,b: a + ((b.upper() == b and (len(a) and a[-1].upper() != a[-1]))
and (' ' + b) or b), x, '')
def uncam(x):
import re
return re.sub("([a-z])([A-Z])","\g<1> \g<2>",x)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.