The following gist is an extract of the article Flask-SQLAlchemy Caching. It allows automated simple cache query and invalidation of cache relations through event among other features.
# pulling one User object
user = User.query.get(1)
The following gist is an extract of the article Flask-SQLAlchemy Caching. It allows automated simple cache query and invalidation of cache relations through event among other features.
# pulling one User object
user = User.query.get(1)
package main | |
import ( | |
"bytes" | |
"code.google.com/p/go.crypto/ssh" | |
"fmt" | |
"log" | |
"net" | |
"os" | |
) |
--- | |
- | |
hosts: remote_host | |
gather_facts: no | |
name: "Testing synchronize" | |
vars: | |
start_time: "{{ lookup('pipe','date') }}" | |
test_files: | |
- test1 | |
- test2 |
-- gets all fields from a hash as a dictionary | |
local hgetall = function (key) | |
local bulk = redis.call('HGETALL', key) | |
local result = {} | |
local nextkey | |
for i, v in ipairs(bulk) do | |
if i % 2 == 1 then | |
nextkey = v | |
else | |
result[nextkey] = v |
- certain endpoints are always blocked | |
if nginx_uri == "/_access_token" or nginx_uri == "/_me" then | |
ngx.exit(403) | |
end | |
-- import requirements | |
local cjson = require "cjson" | |
-- setup some app-level vars | |
local app_id = "APP_ID" |
L1 cache reference ......................... 0.5 ns
Branch mispredict ............................ 5 ns
L2 cache reference ........................... 7 ns
Mutex lock/unlock ........................... 25 ns
Main memory reference ...................... 100 ns
Compress 1K bytes with Zippy ............. 3,000 ns = 3 µs
Send 2K bytes over 1 Gbps network ....... 20,000 ns = 20 µs
SSD random read ........................ 150,000 ns = 150 µs
Read 1 MB sequentially from memory ..... 250,000 ns = 250 µs
As configured in my dotfiles.
start new:
tmux
start new with session name:
<!DOCTYPE html> | |
<html lang="de"> | |
<head> | |
<meta charset="utf-8" /> | |
<title>Pushing with Rx and websock.js</title> | |
<script src="script/jquery-1.7.1.js" type="text/javascript"></script> | |
<script src="script/rx.min.js" type="text/javascript"></script> | |
<script src="script/rx.jquery.js" type="text/javascript"></script> | |
<script src="script/rx.time.min.js" type="text/javascript"></script> | |
<script src="script/base64.js"></script> |
''' | |
A hack based on this http://mikepultz.com/2011/03/accessing-google-speech-api-chrome-11/. While with smaller voice samples google speech to text works really good, as length increases quality decreases. So here using audiolab and numPy we are breaking audio sample, in smaller chunks, and removing blank/empty spaces from audio signal and then pushing them to google for processing. | |
It takes wav file format as input but can be changed to other formats too. | |
''' | |
from scikits.audiolab import wavread, play, flacwrite | |
from numpy import average, array, hstack | |
import os | |
import sys |