Skip to content

Instantly share code, notes, and snippets.

1) Make everything in a bucket public (e.g. everyone has read access)
s3cmd setacl s3://myexamplebucket.calvium.com/ --acl-public --recursive
2) Make everything in a bucket private (e.g. accessible only to the creator)
s3cmd setacl s3://myexamplebucket.calvium.com/ --acl-private --recursive
@colby
colby / trial.md
Last active September 7, 2015 05:53
A time trial to be taken on bike.

#Bike Time Trial

Skip the weather, use a training device. Doesn't matter if it's old or new, roller or fluid, so long as it works. Any trainer will work.

You'll need a speed meter and a timer. Cadence meters are very useful and can also make this task more interesting.

If you don't have a cadence meter, or you don't want to buy one, use an online calculator tuned with your bike measurements against the speed graph. This will give you a rough speed/cadence table to work with.

The trial is to match cadence with duration for repetitions. You will allow you to get some good milage in while keeping yourself preoccupied from thinking about distance.

sudo rm -rf /
@colby
colby / wrap
Last active September 25, 2015 00:25
Cron wrapper for logging job duration.
#!/bin/bash
LOG='/tmp/joblog'
JOB="$*"
NOW=$SECONDS
eval $JOB
END=$SECONDS
@colby
colby / imgur.sh
Created October 15, 2015 23:09
UPLOADS TO IMGUR, GOT IT?
#!/usr/bin/env bash
# variables
img="$1"
tmp=/tmp/imgur
id='3e7a4deb7ac67da'
link='https://api.imgur.com/3/upload'
# functions
errcho() {
@colby
colby / aliases.sh
Last active September 19, 2016 23:15
Useful IP related aliases and tools.
alias speed="wget --output-document=/dev/null http://speedtest.wdc01.softlayer.com/downloads/test500.zip"
alias wanip="curl http://ifconfig.co"
function ipinfo() { curl "http://ipinfo.io/$1"; }
@colby
colby / sandman.sh
Last active January 14, 2016 07:09
A tool to put all known Vagrant VMs to sleep.
#!/usr/bin/env sh
# functions
errcho() {
>&2 echo "$*"
exit 1
}
check() {
which "$1" || errcho "Missing dependency: $1"
@colby
colby / git.sh
Created April 5, 2016 17:33
Display git information in PS1.
export PS1="\n\w\$(stopped_jobs)\$(git_prefix)\$(git_prompt_info)\n\$(last_status)\$ "
# only show status when non zero
function last_status() {
last_status="${STATUS}"
if [ ${last_status} -gt 0 ]; then
echo "${last_status}"
fi
}
@colby
colby / opera-vpn.md
Created April 24, 2016 06:25 — forked from spaze/opera-vpn.md
Opera VPN behind the curtains is just a proxy, here's how it works

When setting up (that's immediately when user enables it in settings) Opera VPN sends few API requests to https://api.surfeasy.com to obtain credentials and proxy IPs, see below.

The browser then talks to a proxy de0.opera-proxy.net (when VPN location is set to Germany), it's IP address can only be resolved from within Opera when VPN is on, it's 185.108.219.42 (or similar, see below). It's an HTTP/S proxy which requires auth.

When loading a page with Opera VPN enabled, the browser sends a lot of requests to de0.opera-proxy.net with Proxy-Authorization request header.

The Proxy-Authorization header decoded: CC68FE24C34B5B2414FB1DC116342EADA7D5C46B:9B9BE3FAE674A33D1820315F4CC94372926C8210B6AEC0B662EC7CAD611D86A3 (that's sha1(device_id):device_password, where device_id and device_password come from the POST /v2/register_device API call, please note that this decoded header is from another Opera installation and thus contains different device_id and device_password than what is shown be

@colby
colby / package_check.sh
Created April 28, 2016 19:17
A package upgrade checking script.
#!/bin/bash
file=/tmp/packages
/usr/lib/update-notifier/apt-check --human-readable
[ -f /var/run/reboot-required ] && echo -e "\nA reboot is required!"
apt list --upgradable > $file 2>/dev/null