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 the Ubuntu cloud image of your choosing (this example uses the latest Xenial daily) | |
wget http://cloud-images.ubuntu.com/xenial/current/xenial-server-cloudimg-amd64-disk1.img | |
# Set the cloud-init datasource to use explicitly (this example uses the EC2 datasource) | |
sudo mount-image-callback xenial-server-cloudimg-amd64-disk1.img -- \ | |
sh -c 'echo "datasource: Ec2" > $MOUNTPOINT/etc/cloud/ds-identify.cfg' | |
# Confirm the current datasource configuration | |
sudo mount-image-callback xenial-server-cloudimg-amd64-disk1.img -- \ | |
chroot _MOUNTPOINT_ cat /etc/cloud/ds-identify.cfg |
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
#!/usr/bin/env python3 | |
""" | |
Shipit script will shipt all commits from a given feature branch | |
as a single non fast forward merge, while adding the proper agreed upon | |
commit message formatting. | |
You must sit on a local clone of the target branch. | |
If you are happy with how shipit merged, you just "git push" the result | |
to the remote branch. | |
""" |
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
sudo gpg --keyserver keyserver.ubuntu.com --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 http://ppa.launchpad.net/philroche/philroche-staging/ubuntu yakkety main' > squashfs-root/etc/apt/sources.list.d/philroche-staging.list | |
sudo chroot squashfs-root/ apt-get update |
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 the squashfs file system for the image we want to alter | |
wget http://cloud-images.ubuntu.com/yakkety/current/yakkety-server-cloudimg-amd64.squashfs | |
# 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 |
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
gcloud compute instances create yakkety-$(date +%y%m%d-%H%M) --image-family ubuntu-1610 --image-project ubuntu-os-cloud |
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
#!/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') |
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
select strftime("%d/%m",facts.start_time) as start_date,facts.start_time, facts.end_time, activities.name, cast((strftime('%s',facts.end_time)-strftime('%s',facts.start_time)) AS real)/60/60 AS elapsed FROM facts, activities where facts.activity_id = activities.id |
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
# 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" ] | |
then | |
if [ -d "$WORKON_HOME/$base_path" ] | |
then | |
echo "Activating $base_path virtualenv" |
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
#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 |
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
#josvaz-znc.conf Upstart script for (AWS) Ubuntu 14.04 | |
#znc - irc bouncer | |
description "IRC bouncer." | |
start on runlevel [2345] | |
stop on runlevel [!2345] | |
respawn | |
setuid ubuntu |