This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
USERNAME="markuman" | |
URL="https://api.github.com/users/${USERNAME}/repos"; | |
# ♥ pipes ♥ | |
curl -s "$URL" | grep '"url":' | grep -v '"https://api.github.com/users/markuman",'| sed s/,//g| sed s/\"//g| awk '{ print $2 }' | sed s/api.//g | sed s,/repos,,g > /tmp/list | |
while read p; do | |
git clone $p | |
NAME=$(basename "$p") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function ret = influxquery(QUERY, URL = "http://localhost:8086/query") | |
% ugly part | |
command=['curl --silent -G ' URL ' --data-urlencode "db=mydb" --data-urlencode "q=' QUERY '"']; | |
[output, ret] = system(command); | |
% requires jsonlab http://iso2mesh.sf.net/cgi-bin/index.cgi?jsonlab | |
ret = loadjson(ret); | |
endfunction |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env python | |
import redis | |
import random | |
import pylibmc | |
import sys | |
r = redis.Redis(host = 'localhost', port = 6389) | |
mc = pylibmc.Client(['localhost:11222']) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local function YearInSec(y) | |
-- returns seconds of a year | |
if ((y % 400) == 0) or (((y % 4) == 0) and ((y % 100) ~= 0)) then | |
return 31622400 -- 366 * 24 * 60 * 60 | |
else | |
return 31536000 -- 365 * 24 * 60 * 60 | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
function convert(){ | |
ENCODING=$(file "$1" |awk '{print$2}') | |
if [[ "$ENCODING" = "ISO-8859" ]]; then | |
iconv -f iso-8859-15 -t utf-8 "$1" > tmp.file | |
mv tmp.file "$1" | |
rm tmp.file | |
fi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
127.0.0.1:6379> eval 'return string.format("%f", math.random())' 0 | |
"0.170828" | |
127.0.0.1:6379> eval 'return string.format("%f", math.random())' 0 | |
"0.170828" | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
127.0.0.1:6379> eval 'local seed = redis.call("TIME") return seed[1] .. "." .. seed[2]' 0 | |
"1443727915.340182" | |
127.0.0.1:6379> eval 'local seed = redis.call("TIME") math.randomseed(tonumber(seed[1] .. "." .. seed[2])) return string.format("%f", math.random())' 0 | |
"0.743658" | |
127.0.0.1:6379> eval 'local seed = redis.call("TIME") math.randomseed(tonumber(seed[1] .. "." .. seed[2])) return string.format("%f", math.random())' 0 | |
"0.580878" | |
127.0.0.1:6379> eval 'local seed = redis.call("TIME") math.randomseed(tonumber(seed[1] .. "." .. seed[2])) return string.format("%f", math.random())' 0 | |
"0.451681" | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
127.0.0.1:6379> eval 'local seed = redis.call("TIME") math.randomseet(tonumber(seed[1] .. "." .. seed[2])) return redis.call("SET", "mykey", string.format("%f", math.random()))' 0 | |
(error) ERR Error running script (call to f_a26eed7f7bc45da4442c1a93ab5d56b42e72aff3): @user_script:1: @user_script: 1: Write commands not allowed after non deterministic commands |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
127.0.0.1:6379> eval 'local seed = redis.call("INFO") math.randomseed(tonumber(string.match(seed, "uptime_in_seconds:(%d+)")) + tonumber(string.match(seed, "total_commands_processed:(%d+)"))) return string.format("%f", math.random())' 0 | |
"0.219070" | |
127.0.0.1:6379> eval 'local seed = redis.call("INFO") math.randomseed(tonumber(string.match(seed, "uptime_in_seconds:(%d+)")) + tonumber(string.match(seed, "total_commands_processed:(%d+)"))) return string.format("%f", math.random())' 0 | |
"0.074487" | |
127.0.0.1:6379> eval 'local seed = redis.call("INFO") math.randomseed(tonumber(string.match(seed, "uptime_in_seconds:(%d+)")) + tonumber(string.match(seed, "total_commands_processed:(%d+)"))) return redis.call("SET", "mykey", string.format("%f", math.random()))' 0 | |
OK | |
-- local seed = redis.call("INFO") | |
-- math.randomseed(tonumber( | |
-- string.match(seed, "uptime_in_seconds:(%d+)")) + |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% multiple silent/invisible plots | |
a = figure; | |
set(a,'visible','off'); | |
x=0:0.1:2*pi; | |
for i = 2:4; | |
plot(x,sin(i*x)); | |
print("-djpeg", strcat(sprintf("%03d", i-1), ".jpg")); | |
set(a,'visible','off'); |