Skip to content

Instantly share code, notes, and snippets.

@petedoyle
petedoyle / backup_postgres.sh
Created May 23, 2012 06:52
Postgres backup script
# Copyright 2012 Peter Doyle (petedoyle at gmail.com)
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
@petedoyle
petedoyle / backup_postgres.sh
Created April 20, 2012 22:42
Backup postgres, upload to s3 using s3cmd
#!/bin/bash
if [ -z "$1" ]
then
FILENAME=pg_dumpall_$(date +"%Y%m%d-%H:%M:%S").sql.gz
else
FILENAME=$1
fi
FQ_FILENAME=/var/lib/pgsql/backups/$FILENAME
su -c "pg_dumpall | gzip -c > $FQ_FILENAME" postgres
@petedoyle
petedoyle / gist:2069845
Created March 18, 2012 08:08
Storm 3GB SSD - bonnie++ performance
Storm 3GB SSD instance
Filesystem: Ext3
----------------------
root@ssddb1:~# bonnie++ -d tmp -u root
...
Version 1.96 ------Sequential Output------ --Sequential Input- --Random-
Concurrency 1 -Per Chr- --Block-- -Rewrite- -Per Chr- --Block-- --Seeks--
Machine Size K/sec %CP K/sec %CP K/sec %CP K/sec %CP K/sec %CP /sec %CP
ssddb1.local 5464M 1480 99 888791 77 281107 23 5919 98 608776 26 12463 111
Latency 5591us 55315us 72806us 4821us 89998us 2431us
<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:android="http://schemas.android.com/apk/res/android">
<style
name="Theme.MyTheme"
parent="android:style/Theme.Holo">
<!-- Setting windowNoTitle to true would turn off the ActionBar -->
<item name="android:windowNoTitle">false</item>
<item name="android:windowActionBar">true</item>
</style>
</resources>
@petedoyle
petedoyle / reader_tweaks.css
Created November 2, 2011 08:24
CSS Tweaks for new Google Reader
#top-bar {
height: auto;
}
#search {
padding: 8px 0;
}
#lhn-add-subscription-section {
height: 48px;
@petedoyle
petedoyle / backup.sh
Created September 26, 2011 05:40
Early bash script to snapshot an entire ZFS pool (storage) and send|receive it to another pool (backups)
#!/bin/bash
# Capture current date as a variable
DATE=`date +"%Y%m%d-%H:%M:%S"` # example output format: 20110925-21:10:36
echo -e "\nRecursively snapshotting storage pool with tag @BACKUP_$DATE"
echo "Running 'zfs snapshot -r storage@BACKUP_$DATE'"
time zfs snapshot -r storage@BACKUP_$DATE
echo -e "\n\nDeleting backups pool to make way for new backup (usually takes a few minutes)."
@petedoyle
petedoyle / MainActivity.java
Created May 17, 2011 19:46
Sample android-support-v4-googlemaps MapFragment setup
public class MainActivity extends android.support.v4.app.FragmentActivity {
// Only one MapView instance is allowed per MapActivity,
// so we inflate it in the MainActivity and tie its
// lifetime here to the MainActivity. Package scope
// so we can grab them from different instances of map
// fragments.
//
// The other option was to make them static, but that causes
// memory leaks on screen rotation.
View mMapViewContainer;
@petedoyle
petedoyle / Make easier to read
Created December 30, 2010 23:57
BBB url creation
// CONFIG:
def apiBaseUrl = "http://conf.cotni.org/bigbluebutton/api" // no trailing '/' please
def salt = "26f31c52-6d4f-4562-b3c7-fd7857d191ac"
def phoneNumber = "360-536-4392" // the number to join the conference via phone
def meetingParams = [
name: 71000,
meetingID: 71000,
attendeePW: 7777,
moderatorPW: 8888,