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
grunt.initConfig({ | |
'download-github-releases': { | |
user: 'GITHUB_USER', | |
repo: 'REPOSITORY', | |
tag: 'TAG_NAME', | |
token: process.env.GITHUB_RELEASE_ACCESS_TOKEN, | |
outputDir: 'DOWNLOAD_DIRECTORY' | |
}, | |
mkdir: { | |
githubmodules: { |
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
for file in *.php do | |
iconv -f cp1252 -t utf8 "$file" > "$file.new" && mv -f "$file.new" "$file" | |
done |
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
#!/usr/bin/env node | |
/* | |
HOW TO: | |
1) install required tools | |
- npm install coap --save | |
- npm install coap-cli -g | |
2) run the server: chmod +x coap-server.js && ./coap-server.js | |
3) observe a resource | |
- coap get -o coap://localhost/message |
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/bash | |
# requires http://stedolan.github.io/jq/ | |
AWS_ROLE_NAME=`wget -O - -q 'http://169.254.169.254/latest/meta-data/iam/security-credentials/'` | |
wget -O mycreds -q "http://169.254.169.254/latest/meta-data/iam/security-credentials/$AWS_ROLE_NAME" | |
SECRET_KEY=`jq -r '.SecretAccessKey' <mycreds` | |
ACCESS_KEY=`jq -r '.AccessKeyId' <mycreds` | |
TOKEN=`jq -r '.Token' <mycreds` | |
cat >temp_credentials <<EOM | |
AWSAccessKeyId=$ACCESS_KEY |
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 levenshtein (s1, s2) { | |
// From: http://phpjs.org/functions | |
// + original by: Carlos R. L. Rodrigues (http://www.jsfromhell.com) | |
// + bugfixed by: Onno Marsman | |
// + revised by: Andrea Giammarchi (http://webreflection.blogspot.com) | |
// + reimplemented by: Brett Zamir (http://brett-zamir.me) | |
// + reimplemented by: Alexander M Beedie | |
// * example 1: levenshtein('Kevin van Zonneveld', 'Kevin van Sommeveld'); | |
// * returns 1: 3 | |
if (s1 == s2) { |
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 | |
# COPY of http://pastebin.com/zC9HU2pU | |
# Do elasticsearch optimize on logstash previous day index | |
# if $1 = all then optimize all indicies | |
esindex="/opt/elasticsearch/data/elasticsearch/nodes/0/indices" | |
# Grab yesterday's values | |
D=`date +%d -d yesterday` | |
M=`date +%m -d yesterday` |
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
bunzip2 < serverdb.sql.bz2 | mysql -h example.com -P 3306 -u USERNAME -p DATABASE_NAME |
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 | |
awk '{ print strftime("%Y-%m-%dT%H:%M:%S"), $0; fflush(); }' |
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
/* | |
* http://dmitrysoshnikov.com/ecmascript/chapter-2-variable-object/ | |
*/ | |
alert(x); // function | |
var x = 10; | |
alert(x); // 10 | |
x = 20; |
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
defaults write com.apple.dock persistent-apps -array-add '{tile-data={}; tile-type="spacer-tile";}' | |
killall Dock |