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
# Terminal output control (http://www.termsys.demon.co.uk/vtansi.htm) | |
TC='\e[' | |
CLR_LINE_START="${TC}1K" | |
CLR_LINE_END="${TC}K" | |
CLR_LINE="${TC}2K" | |
# Hope no terminal is greater than 1k columns | |
RESET_LINE="${CLR_LINE}${TC}1000D" |
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 | |
### BEGIN INIT INFO | |
# Provides: <service name> | |
# Required-Start: $remote_fs $syslog | |
# Required-Stop: $remote_fs $syslog | |
# Default-Start: 2 3 4 5 | |
# Default-Stop: 0 1 6 | |
# Short-Description: <service description> | |
### END INIT INFO |
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 | |
FLAMEGRAPH_PATH="${FLAMEGRAPH_PATH:-$HOME/code/github.com/brendangregg/FlameGraph/}" | |
SECONDS=10 | |
GEN_PROFILE=true | |
GEN_GOROUTINE=false | |
GEN_BLOCK=false | |
GEN_MUTEX=false | |
GEN_ALLOC=false | |
GEN_HEAP=false |
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
/** | |
* Retrieves all the rows in the active spreadsheet that contain data and logs the | |
* values for each row. | |
* For more information on using the Spreadsheet API, see | |
* https://developers.google.com/apps-script/service_spreadsheet | |
*/ | |
function readRows() { | |
var sheet = SpreadsheetApp.getActiveSheet(); | |
var rows = sheet.getDataRange(); | |
var numRows = rows.getNumRows(); |
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 | |
stream="$1" | |
start_fragment="$2" | |
seconds_between_requests="$3" | |
calc_segment() { | |
echo $(($fragment / 100 + 1)) | |
} |
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 | |
# | |
# Use ipfw to throttle bandwidth. | |
# usage: | |
# ./throttle.sh # Throttle at default (60KB/s) | |
# ./throttle.sh 5 # Throttle at custom speed (5KB/s) | |
# ./throttle.sh off # Turn throttling off | |
# flush rules | |
ipfw del pipe 1 |
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
{ | |
"device_name": "sync test 1", | |
"listening_port" : 7788, | |
"storage_path" : "/var/lib/btsync/.sync", | |
"check_for_updates" : false, | |
"use_upnp" : false, | |
// limits in kB/s. 0 = no limit | |
"download_limit" : 0, | |
"upload_limit" : 0, |
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
# apache2 virtual host configuration | |
<VirtualHost *:80> | |
ServerName graphite | |
DocumentRoot "/opt/graphite/webapp" | |
ErrorLog "/var/log/graphite/error.log" | |
CustomLog "/var/log/graphite/access.log" common | |
<Location "/carbon-web-proxy/v1.0/"> | |
SetHandler python-program |
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
class apt::update { | |
# execute apt-get update if any of the following conditions met: | |
# - there is no apt-get update cache data (eg. first run) | |
# - any file in the /etc/apt/** was changed after the last execution | |
# - it was executed more than 24h ago | |
$apt_update_min_age_in_seconds = "24 * 60 * 60" # you can edit this | |
$apt_update_condition_1 = "[[ ! -f /var/cache/apt/pkgcache.bin ]]" | |
$apt_update_condition_2 = "find /etc/apt -cnewer /var/cache/apt/pkgcache.bin | grep ." | |
$apt_update_condition_3 = "[[ $(( $(date +%s) - $(stat -c %Z /var/cache/apt/pkgcache.bin) )) -gt $(( ${apt_update_min_age_in_seconds} )) ]]" |
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 | |
# xrandr --nograb --output <primary display name> --auto --pos 0x0 --primary --preferred | |
# xrandr --nograb --output <secondary display name> --auto --pos <position X in relation to the primary monitor>x<position Y in relation of the primary monitor> | |
xrandr --nograb --output VGA1 --auto --pos 0x0 --primary --preferred | |
xrandr --nograb --output DP1 --auto --pos 1920x200 |
NewerOlder