Skip to content

Instantly share code, notes, and snippets.

View lbstokg.js
javascript:(function(e,s){e.src=s;e.onload=function(){jQuery.noConflict();console.log('jQuery injected')};document.head.appendChild(e);})(document.createElement('script'),'//');
jQuery('.workoutTable tbody tr td').text(function(){ if(jQuery.isNumeric(jQuery(this).text())) { return Math.round(parseFloat(jQuery(this).text()) * 0.453592) + 'kg'; } else {return jQuery(this).text()}});
#Install ZNC
sudo apt-get update
sudo apt-get install znc
#Configure Timezone on server
echo "Europe/Dublin" | sudo tee /etc/timezone
sudo dpkg-reconfigure --frontend noninteractive tzdata
#Mount EBS storage
sudo mkfs -t ext4 /dev/xvdb
View josvaz-znc.conf
#josvaz-znc.conf Upstart script for (AWS) Ubuntu 14.04
#znc - irc bouncer
description "IRC bouncer."
start on runlevel [2345]
stop on runlevel [!2345]
setuid ubuntu
#Install ZNC
sudo apt-get update
sudo apt-get install znc
#Configure Timezone on server
echo "Europe/Madrid" | sudo tee /etc/timezone
sudo dpkg-reconfigure --frontend noninteractive tzdata
#This is for running on a EBS Only t2.micro instance (covered under the free tier)
#No need to mount EBS volume separately, root fs is already RW and EBS backed
View bash auto virtualenv
# Add the following to your ~/.bashrc making sure to set $WORKON_HOME variable
function cd() {
builtin cd "$1"
absolute_path=$(readlink -m "$1")
base_path=$(basename "$absolute_path")
if [ -z "$VIRTUAL_ENV" ]
if [ -d "$WORKON_HOME/$base_path" ]
echo "Activating $base_path virtualenv"
View Time Tracker-Hamster applet report
select strftime("%d/%m",facts.start_time) as start_date,facts.start_time, facts.end_time,, cast((strftime('%s',facts.end_time)-strftime('%s',facts.start_time)) AS real)/60/60 AS elapsed FROM facts, activities where facts.activity_id =
View bzrcherrypick
#!/usr/bin/env python
import argparse
import tempfile
import subprocess
import traceback
def u(somebytes):
return None if somebytes is None else somebytes.decode('utf-8')
philroche / Start 16.10 instance on GCE
Created Nov 15, 2016
Start 16.10 instance on GCE
View Start 16.10 instance on GCE
gcloud compute instances create yakkety-$(date +%y%m%d-%H%M) --image-family ubuntu-1610 --image-project ubuntu-os-cloud
philroche /
Last active Nov 15, 2016
Reproduce unmounting of /dev after running apt-key in chroot
# Get the squashfs file system for the image we want to alter
# Extract the squashfs filesystem to a local directory
unsquashfs yakkety-server-cloudimg-amd64.squashfs
# Mount and bind local /dev/ to local directory squashfs-root/dev
sudo mount --bind /dev/ squashfs-root/dev
# Update the resolv.conf so that we can make network calls within a chroot
sudo rm squashfs-root/etc/resolv.conf
sudo cp /etc/resolv.conf squashfs-root/etc/
# Add the Google Cloud Packages signing key
View gist:ce90979ee244a0b166e3e81b2f2a8604
sudo gpg --keyserver --recv-keys 2E0CC76D
sudo gpg -a --export 2E0CC76D > 2E0CC76D.key
sudo gpg --no-default-keyring --keyring ./2E0CC76D.gpg --import 2E0CC76D.key
cp 2E0CC76D.gpg squashfs-root/etc/apt/trusted.gpg.d/
echo 'deb yakkety main' > squashfs-root/etc/apt/sources.list.d/philroche-staging.list
sudo chroot squashfs-root/ apt-get update