Skip to content

Instantly share code, notes, and snippets.

View batok's full-sized avatar

Domingo Aguilera batok

  • Consultant
  • Guadalajara, Mexico
  • X @batok
View GitHub Profile
from cmd2 import Cmd
import s3accounts
from boto.s3.connection import S3Connection
class Shell(Cmd):
prompt = "sc2s3>"
def __init__(self, connection):
Cmd.__init__(self)
self.conn = connection
self.bucket = s3accounts.preferred_bucket
self.prompt = "sc2s3_{0}> ".format( self.bucket)
gunicorn_paster development.ini
2010-05-13 18:20:24 [21304] [ERROR] Retrying in 1 second.
2010-05-13 18:20:25 [21304] [ERROR] Retrying in 1 second.
2010-05-13 18:20:26 [21304] [ERROR] Retrying in 1 second.
2010-05-13 18:20:27 [21304] [ERROR] Retrying in 1 second.
2010-05-13 18:20:28 [21304] [ERROR] Retrying in 1 second.
2010-05-13 18:20:29 [21304] [ERROR] Can't connect to ('127.0.0.1', 8000)
2010-05-13 18:26:19 [21324] [ERROR] Retrying in 1 second.
2010-05-13 18:26:20 [21324] [ERROR] Retrying in 1 second.
2010-05-13 18:26:21 [21324] [ERROR] Retrying in 1 second.
2010-05-13 18:26:22 [21324] [ERROR] Retrying in 1 second.
2010-05-13 18:26:23 [21324] [ERROR] Retrying in 1 second.
2010-05-13 18:26:24 [21324] [ERROR] Can't connect to ('10.0.1.106', 8029)
def RecordAudio(self, seconds):
chunk = 1024
FORMAT = pyaudio.paInt16
CHANNELS = 1
RATE = 44100
RECORD_SECONDS = seconds
WAVE_FILENAME = "output.wav"
p = pyaudio.PyAudio()
stream = p.open(format = FORMAT,
@batok
batok / gist:412063
Created May 24, 2010 16:08
An attempt to produce an flv file from to pictures and a wav file
ffmpeg -loop_input -shortest -r 5 -i /Users/director/dev/sc2s3/screenshot20100520181947485154.png -i /Users/director/dev/sc2s3/screenshot20100521200412106883.png -i /Users/director/dev/sc2s3/output.wav -qscale 3 -g 100 -acodec libfaac -ab 128k /Users/director/dev/sc2s3/narrated-screenshot20100520181947485154.flv
=======================================================================================
previously recorded wav file( i.e. output.wav )
=======================================================================================
======= ======== ========== ============ ========== ============ ============ =========
sc1.png sc2.png sc3.png sc4.png sc5.png sc6.png sc7.png sc8.png
======= ======== ========== ============ ========== ============ ============ =========
=======================================================================================
time ....
=======================================================================================
p = subprocess.Popen("rm -f {0}/tmp/*png".format(os.getcwd()),shell = True)
pid, sts = os.waitpid(p.pid,0)
for i,fname in enumerate([x for x in self.filelist if ".png" in x]):
cuantos = i +1
if True:
p = subprocess.Popen("ln -s {0}/{1} {0}/tmp/sc{2:d}.png".format( os.getcwd(), fname, cuantos), shell = True)
pid, sts = os.waitpid(p.pid,0)
the_file = "{0}/{1}".format(os.getcwd(), flv_name)
command_line = "ffmpeg -r 0.5 -f image2 -i {0}/tmp/sc%d.png -i output.wav -r 25 -qscale 3 -g 100 -acodec libfaac -ab 128k -y {0}/narrated_screenshot_series.flv".format(os.getcwd())
import configobj
from boto.gs.connection import GSConnection
import os
def main(upload = False):
try:
from win32com.shell import shellcon, shell
homedir = shell.SHGetFolderPath(0, shellcon.CSIDL_APPDATA, 0, 0)
except ImportError:
homedir = os.path.expanduser("~")
from boto.gs.connection import GSConnection
def main(upload = False):
c = GSConnection()
for bucket in c.get_all_buckets():
print "Bucket ... ", bucket.name
for key in bucket.get_all_keys():
print key.name
if upload:
key = bucket.new_key("testboto.py")
with open("testboto2.py","rb") as f:
@batok
batok / eventlet_gs_uploader.py
Created June 11, 2010 04:38
A python script to do asynchronous upload to google storage using boto and eventlet libraries
# this program uploads to google storage using boto and eventlet all the jpg files of a selected folder
import eventlet
bcon = eventlet.import_patched("boto.gs.connection")
import glob
FOLDER = "/Users/myself/Documents/" # replace this with your chosen folder
BUCKET_NAME = "whateveryourbucketname" # replace this with your bucket name
def upload(myfile):
c = bcon.GSConnection()