Skip to content

Instantly share code, notes, and snippets.

@azizmb
azizmb / arch.md
Last active December 23, 2015 10:29

Prevent laptop from suspending when lid is shut

/etc/systemd/logind.conf:

HandleLidSwitch=ignore
sudo systemctl stop systemd-logind && sudo systemctl start systemd-logind
@azizmb
azizmb / rcloud_console.py
Last active January 4, 2016 22:09
Simple shell which initializes a connection to Rackspace CloudFiles
import argparse
import cloudfiles
from cloudfiles.connection import Connection
AUTH_URLS = ['uk_authurl', 'us_authurl']
if __name__ == '__main__':
@azizmb
azizmb / installing_pil.md
Last active August 29, 2015 14:00
PIL dependencies

Installing libs and fixing lib links

build=`uname --hardware-platform`
apt-get install python-dev libjpeg62 libjpeg-dev libpng12-0 libpng-dev libfreetype6-dev
ln -s /usr/lib/${build}-linux-gnu/libjpeg.so /usr/lib
ln -s /usr/lib/${build}-linux-gnu/libz.so /usr/lib
@azizmb
azizmb / mandrill-sync.py
Created November 22, 2015 10:50
Simple script to sync templates across two mandrill accounts.
import optparse
from mandrill import Mandrill
from mandrill import UnknownTemplateError
def sync_templates(source_key, destination_key, update_existing=True, dry_run=False):
def perform_action(action):
'''Simple wrapper to skip actaully doing anything if dry run is enabled.