This is a simple chat-like program using pub-sub pattern, backed by PostgreSQL's LISTEN/NOTIFY command.
publish message to foo
channel from user nickname
.
$ python pub.py foo nickname
PUBLISH to channel #foo
# Iterates over all the keys in a bucket and totals the bytes used | |
# NOTE: if you have a lot of keys, this could take a LONG time. | |
import boto | |
def bucket_du(bucket_name): | |
s3 = boto.connect_s3() | |
bucket = s3.lookup(bucket_name) | |
total_bytes = 0 | |
for key in bucket: |
###################################################################### | |
# CURRENT AWARE LOCAL DATETIME | |
###################################################################### | |
from datetime import datetime | |
from tzlocal import get_localzone | |
local_tz = get_localzone() | |
local_dt = datetime.now(local_tz) |
from fabric.api import task, local, sudo, run, prefix, env, cd | |
from fabric.contrib.files import exists, first | |
from contextlib import contextmanager, nested | |
def once(s): | |
"""Command_prefixes is a list of prefixes""" | |
if s not in env.command_prefixes: | |
return s | |
return 'true' |
import ( | |
"crypto/md5" | |
"encoding/hex" | |
) | |
func GetMD5Hash(text string) string { | |
hasher := md5.New() | |
hasher.Write([]byte(text)) | |
return hex.EncodeToString(hasher.Sum(nil)) | |
} |
Uploading Arduino Sketches to the Teensy 3.1 from the Terminal
First, install Arduino 1.6.1 from http://arduino.cc/en/Main/Software. I followed the Mac OS X for Java 6 link to download arduino-1.6.1-macosx.zip
. Install Arduino by unzipping the Arduino
file and moving it to /Applications/Arduino
. Open Arduino to make sure it works and so it can finish setting up the environment for use. Next, install Teensyduino 1.21 from https://www.pjrc.com/teensy/td_download.html. I followed Macintosh OS-X Installer to download teensyduino.dmg
. Open and proceed through the Teensyduino installer, and when prompted to locate Arduino, select /Applications/Arduino
, then continue to the next step in the installer.
At this point, you should be ready to upload a sketch. Follow the instructions below.
To upload from the terminal, enter the following command:
/Applications/Arduino.app/Contents/MacOS/JavaApplicationStub --board teensy:avr:teensy31 --port /dev/tty.usbmodem573061 --upload /Users/mokogobo/Checkout
raspivid -o - -t 0 -vf -hf -fps 30 -b 6000000 | ffmpeg -re -ar 44100 -ac 2 -acodec pcm_s16le -f s16le -ac 2 -i /dev/zero -f h264 -i - -vcodec copy -acodec aac -ab 128k -g 50 -strict experimental -f flv rtmp://a.rtmp.youtube.com/live2/<SESSION>
you can tweak -b
and -fps
to your liking. the settings above work well for 1080p. by not specifying width or height we get the full 1920x1080 resolution from the raspi camera
# temp files | |
*.bak | |
*.bck | |
*.kicad_pcb-bak | |
*-cache.lib | |
# *-rescue.lib | |
ftp-lib-table | |
# for external tools | |
*.dsn |