Skip to content

Instantly share code, notes, and snippets.

View whiteley's full-sized avatar

Matt Whiteley whiteley

View GitHub Profile
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.example.my-fancy-task</string>
<key>OnDemand</key>
<true/>
<key>ProgramArguments</key>
<array>

Keybase proof

I hereby claim:

  • I am whiteley on github.
  • I am mwhiteley (https://keybase.io/mwhiteley) on keybase.
  • I have a public key whose fingerprint is 903E BC2E 89C7 D18D FB7F 94D6 2C19 9989 A22A D544

To claim this, I am signing this object:

import os
import pprint
import fnmatch
import time
import subprocess
def find_services_needing_restart():
services = {}
pids = [ f for f in os.listdir('/proc') if f.isdigit() and os.path.isdir(os.path.join('/proc', f)) ]
#!/bin/bash
set -o errexit
set -o nounset
for v in "$@"; do
k=$(dig -t CNAME +short "${v}.blob.core.windows.net")
k=${k##blob.}
k=${k%%.store.core.windows.net.}
echo "\"${k}\":\"${v}\""
%module mdb
%{
#include "db_cxx.h"
%}
%include "std_string.i"
%include "db_cxx.h"

As part of the cron command

Using flock from the util-linux package.

37 * * * * /usr/bin/flock -n /some/file -c do-something-important-with /some/file

Inside a shell script

ubuntu@ip-10-36-16-7:~$ sudo aptitude install varnish=4.0.0-1~trusty
The following NEW packages will be installed:
binutils{a} cpp{a} cpp-4.8{a} gcc{a} gcc-4.8{a} libasan0{a} libatomic1{a} libc-dev-bin{a} libc6-dev{a} libcloog-isl4{a} libgcc-4.8-dev{a} libgmp10{a} libgomp1{a} libisl10{a} libitm1{a} libmpc3{a} libmpfr4{a} libquadmath0{a} libtsan0{a} linux-libc-dev{a}
manpages-dev{a} varnish{b}
The following packages will be upgraded:
libc6
1 packages upgraded, 22 newly installed, 0 to remove and 20 not upgraded.
Need to get 24.3 MB of archives. After unpacking 71.9 MB will be used.
The following packages have unmet dependencies:
varnish : Depends: libvarnishapi1 (= 4.0.0-1~trusty) but it is not going to be installed.
#!/bin/sh -ex
# License: CC0
parted -s /dev/xvdb mklabel msdos mkpart primary 0% 100%
mke2fs -L ubuntu-installer /dev/xvdb1 -F
mount LABEL=ubuntu-installer /mnt
cd /mnt
ARCH=amd64
# -*- mode: ruby -*-
# vi: set ft=ruby :
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.provider "docker" do |d|
d.image = "ubuntu/trusty"
end
end
{
"Statement": [
{
"Effect": "Allow",
"Action": [
"ec2:CreateTags",
"ec2:Describe*"
],
"Resource": "*"
},