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
# usage: ssh <container-name>.doc | |
Host *.doc | |
ProxyCommand netcat $(docker inspect --format '{{ .NetworkSettings.IPAddress }}' `echo %h | sed -e 's/.doc//'`) 22 | |
StrictHostKeyChecking no | |
User root | |
IdentityFile /etc/ssh/keys/docker.key |
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/sh | |
echo -n '{' | |
# memory as "mem": { "current": 800, "total": 1024, "load", 82 } where amount is in MB and load in % | |
free -m | awk 'NR==2{printf "\"mem\": { \"current\":%d, \"total\":%d, \"load\": %.2f }", $3,$2,$3*100/$2 }' | |
echo -n ',' | |
# diska as "disk": { "current": 6, "total": 40, "used": 19 } where amount is in GB and used in % | |
df -h | awk '$NF=="/"{printf "\"disk\": { \"current\":%d, \"total\":%d, \"used\": %d }", $3,$2,$5}' |
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
class ProgressBar | |
def initialize(units=60) | |
@units = units.to_f | |
end | |
def print(completed, total) | |
norm = 1.0 / (total / @units) | |
progress = (completed * norm).ceil | |
pending = @units - progress | |
Kernel.print "[#{'=' * progress }#{' ' * ( pending )}] #{percentage(completed, total)}%\r" |
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
[supervisord] | |
nodaemon=true | |
[program:sshd] | |
command=/usr/sbin/sshd -D | |
stdout_logfile=/var/log/supervisor/%(program_name)s.log | |
stderr_logfile=/var/log/supervisor/%(program_name)s.log | |
autorestart=true |
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
SERVER=127.0.0.1 | |
USER=deployer | |
PASSWORD=superpass | |
ssh $SERVER | |
# add deployer user | |
groupadd admin | |
useradd $USER -m -s /bin/bash -G admin | |
echo $USER:$PASSWORD | chpasswd |
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
$.get('http://www.posten.se/soktjanst/postnummersok/resultat.jspv?pnr=11240', function(data){ | |
console.log("Ort", $(data).find('td.lastcol').first().text()); | |
}); |
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
on run argv | |
set input_file to POSIX file (item 1 of argv) | |
set output_path to item 2 of argv | |
-- TODO: add some error handling :) | |
-- make sure output folder exists | |
do shell script "mkdir -p " & output_path | |
-- drop input file on Slicy app |
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/sh | |
######CONFIG##### | |
# TestFlight API Token | |
# from https://testflightapp.com/dashboard/team/edit/ | |
# $ git config --global testflight.apitoken XXX | |
# form https://testflightapp.com/account/#api | |
# $ git config --global testflight.teamtoken XXX | |
# Testflight API token | |
API_TOKEN=$(git config testflight.apitoken) |
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
module CarrierWave | |
module MiniMagick | |
def toaster_filter | |
manipulate! do |img| | |
img.modulate '150,80,100' | |
img.gamma 1.1 | |
img.contrast | |
img.contrast | |
img.contrast | |
img.contrast |
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
// Put code in MainViewController.m if using PhoneGap, | |
// else but it in ViewController controlling UIWebView | |
// Register for keyboard show event | |
// Some where in a init ex initWithNibName | |
[[NSNotificationCenter defaultCenter] addObserver:self | |
selector:@selector(keyboardWillShow:) | |
name:UIKeyboardWillShowNotification | |
object:nil]; |