Skip to content

Instantly share code, notes, and snippets.

View shawnburke's full-sized avatar

Shawn Burke shawnburke

View GitHub Profile
@shawnburke
shawnburke / backup-image
Created November 30, 2022 16:59
Backup your raspberry pi SD card nightly via a cron job
#! /bin/bash
set -e
# usage
# backup-image -s source-device -n max-to-save [TARGET-DIR]
#
# Example cron to run every night at 3am, saving 5 images
#
#
@shawnburke
shawnburke / IsolatedStorageSettings.cs
Created September 3, 2014 18:03
IsoStorageSettings file that falls back to local storage if IsoStore fails
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.IO.IsolatedStorage;
using System.Reflection;
using System.Text;
using System.Text.RegularExpressions;
namespace BuddySDK
@shawnburke
shawnburke / gist:3843385
Created October 6, 2012 01:32
Setting up MongoDB on an EC2 Instance
MONGO_BASE=~/mongodb/
MONGO_DB=~/mongodb/db
MONGO_DUMP=~/mongodb/dump
MONGO_INSTALL=~/mongodb/bin
MONGO_VERSION=2.2.0
mkdir -p $MONGO_BASE
mkdir -p $MONGO_DB
mkdir -p $MONGO_DUMP
cd $MONGO_BASE
@shawnburke
shawnburke / gist:3750709
Created September 19, 2012 16:46
Partial bash script for setting prompt to EC2 instance name. Add this to .bashrc
# these make the ec2 commands just work
export AWS_ACCESS_KEY=[AWS access key]
export AWS_SECRET_KEY=[AWS secret]
# fetch the instance id
export INSTANCE_ID=$(wget -q -O - http://169.254.169.254/latest/meta-data/instance-id)
#grep out the tag you're looking for, in this case "Name"
export APP_TAG=$(ec2-describe-tags | grep $INSTANCE_ID | grep -oE "Name\\W+(.+)$" | grep -oE "\\W.+$")