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
@app.route("/", methods=['GET', 'POST'])
def upload_file():
if request.method == 'POST':
file = request.files['file']
if file and allowed_file(file.filename):
app.logger.debug("A valid file {}".format( file.filename))
filename = secure_filename(file.filename)
file.save(os.path.join(UPLOAD_FOLDER, filename))
command_line = " montage +frame +shadow +label -tile 10x2 -geometry 50x50+0+0 {0}/*.jpg {0}/mosaic.png".format(UPLOAD_FOLDER)
app.logger.debug(command_line)
Traceback (most recent call last):
File "/Users/director/dev/virtual/prueba27/lib/python2.7/site-packages/eventlet/hubs/hub.py", line 285, in fire_timers
timer()
File "/Users/director/dev/virtual/prueba27/lib/python2.7/site-packages/eventlet/hubs/timer.py", line 56, in __call__
cb(*args, **kw)
File "/Users/director/dev/virtual/prueba27/lib/python2.7/site-packages/eventlet/greenthread.py", line 202, in main
result = function(*args, **kwargs)
File "../eventlet/prueba.py", line 9, in upload
bucket = c.get_bucket(BUCKET_NAME)
File "/Users/director/dev/virtual/prueba27/src/svn/boto/s3/connection.py", line 282, in get_bucket
@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()
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:
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("~")
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())
=======================================================================================
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 ....
=======================================================================================
@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
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,
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)