This file contains 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
from robot.libraries.BuiltIn import BuiltIn | |
import cv2 | |
import shutil | |
import tempfile | |
class TemporaryDirectory(object): | |
def __enter__(self): | |
self.name = tempfile.mkdtemp() |
This file contains 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/sh | |
# Cleanup docker files: untagged containers and images. | |
# | |
# Use `docker-cleanup -n` for a dry run to see what would be deleted. | |
exited_containers() { | |
[ "$(docker ps -f status=exited -q)" ] && docker rm $(docker ps -f status=exited -q) | |
} | |
tangled_images() { |
This file contains 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/sh | |
# size of swapfile in megabytes | |
swapsize=512 | |
# does the swap file already exist? | |
grep -q "swapfile" /etc/fstab | |
# if not then create it | |
if [ $? -ne 0 ]; then |
This file contains 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/sh | |
# does the swap file exist? | |
grep -q "swapfile" /etc/fstab | |
# if it does then remove it | |
if [ $? -eq 0 ]; then | |
echo 'swapfile found. Removing swapfile.' | |
sed -i '/swapfile/d' /etc/fstab | |
echo "3" > /proc/sys/vm/drop_caches |
This file contains 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
//l.sauer 2011, public domain | |
//returns a hash table with the word as index and frequency as value; good for svg / canvas -plotting or other experiments | |
//[:punct:] Punctuation symbols . , " ' ? ! ; : # $ % & ( ) * + - / < > = @ [ ] \ ^ _ { } | ~ | |
var wordcnt = function(id){ | |
var hist = {}, words = document.getElementById(id).innerText.split(/[\s*\.*\,\;\+?\#\|:\-\/\\\[\]\(\)\{\}$%&0-9*]/) | |
for( i in words) | |
if(words[i].length >1 ) | |
hist[words[i]] ? hist[words[i]]+=1 : hist[words[i]]=1; | |
return hist; | |
}; |
This file contains 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 oAuthConfig() { | |
var oAuthConfig = UrlFetchApp.addOAuthService("twitter"); | |
oAuthConfig.setAccessTokenUrl("http://api.twitter.com/oauth/access_token"); | |
oAuthConfig.setRequestTokenUrl("http://api.twitter.com/oauth/request_token"); | |
oAuthConfig.setAuthorizationUrl("http://api.twitter.com/oauth/authorize"); | |
// Register an app at https://dev.twitter.com/apps/new to get the following key and secret | |
oAuthConfig.setConsumerKey("key"); | |
oAuthConfig.setConsumerSecret("secret"); | |
} |