Skip to content

Instantly share code, notes, and snippets.

View fsvehla's full-sized avatar

Ferdinand Svehla fsvehla

View GitHub Profile
(defn run-process
"Runs the process"
[args]
(->>
(new ProcessBuilder args)
(.start)
))
(defn exec
"Returns the ouput of the command, which is assumed to smallish and non-binary."
(defn wait-a-bi []
(do (println "waiting a bit")
(. Thread (sleep 200))))
(first ((wait-a-bit) (wait-a-bit))
#!/bin/bash
# For the duration of this script, don’t run .rvmrcs
unset rvm_project_rvmrc
orig_pwd=$PWD
find . -name '*.git' -type d | while read repo; do
# Starts a subshell, and thereby resetting pwd every time
cd "$orig_pwd/$repo"
root@tel1:/etc/network# id
uid=0(root) gid=0(root) groups=0(root)
root@tel1:/etc/network# rm -f interfaces
rm: cannot remove `interfaces': Operation not permitted
root@tel1:/etc/network# ls -halps interfaces
4.0K -rw-r--r-- 1 root root 285 Jul 10 2011 interfaces
var parseResponseCookies = function (response) {
var Cookie = function (cookieString) {
var fields = cookieString.split(/; ?/).map(function (item) {
return item.split('=');
});
var metadata = fields.reduce(function (prev, curr) {
prev[curr[0]] = curr[1];
return prev;
}, {});
spinOptions =
lines: 12
length: 4
width: 2
radius: 4
color: '#333'
fadeInTime = 400
minTime = 400
fadeOutTime = 600
@fsvehla
fsvehla / faxonline-send.php
Created August 12, 2011 11:42
Faxonline API PHP Sample: Sending
<?php
$login = 'xxxxxxxx'; /* Username */
$password = 'xxxxxxxx'; /* Password */
$path = 'Test.pdf'; /* Path to file */
$recipient = '+43125330331115'; /* Recipient */
$handle = curl_init();
$url = 'https://' . $login . ':' . $password . '@faxonline.at/api-v1/faxes.json';
for(idx = 0; idx < 8; idx++) {
with({index: idx}) {
setTimeout(function() { console.log([idx, index]) }, 5);
}
}
for(idx = 0; idx < 8; idx++) {
var callback = function () {
var index = idx;
return function() {
console.log(index);
}
}();
setTimeout(callback, 5);
#!/bin/bash
# Cronic v2 - cron job report wrapper
# Copyright 2007 Chuck Houpt. No rights reserved, whatsoever.
# Public Domain CC0: http://creativecommons.org/publicdomain/zero/1.0/
set -eu
OUT=/tmp/cronic.out.$$
ERR=/tmp/cronic.err.$$