Skip to content

Instantly share code, notes, and snippets.

@barneyjackson
barneyjackson / gist:8837170
Last active August 29, 2015 13:56
PostgreSQL 9.1 to 9.3 upgrade notes

Today I upgraded our databases from PostgreSQL 9.1 to 9.3. I am not a database expert or sysadmin, but I thought I'd share the notes I put together from other sources and my own fumbles in the hope that others might have an easier time.

These instructions are loosely based on those found on the postgresql wiki, amended with my own experiences and other sources.

Important notes

  • Our postgres data directory is stored on a separate EBS volume so this guide also covers moving these around.
  • I am upgrading postgresql 9.1 to 9.3, I have no idea how well these instructions will work for other versions.
  • I am not using "Link Mode" in order to preserve the old database, which makes the upgrade a little slower

Install packages

@barneyjackson
barneyjackson / gist:8873818
Last active August 29, 2015 13:56
Feeding the ginger beer

Feeding the Ginger Beer Plant

It's very simple...

###You will need:

  • A plastic stirrer
  • The 1 teaspoon measure
  • The bag of sugar
  • The jar of ginger

Keybase proof

I hereby claim:

  • I am barneyjackson on github.
  • I am barney (https://keybase.io/barney) on keybase.
  • I have a public key whose fingerprint is FC4C 0426 DB7A B51C 74D1 994C A7EC 24B5 DA44 5C8F

To claim this, I am signing this object:

# /etc/rsyslog.conf Configuration file for rsyslog.
$MaxMessageSize 64k
#
# For more information see
# /usr/share/doc/rsyslog-doc/html/rsyslog_conf.html
#################
#### MODULES ####
#################
@barneyjackson
barneyjackson / simple_text_editor.py
Created March 25, 2021 16:23
Python 3 implementation of Hacker Rank's "Simple Text Editor" task - https://www.hackerrank.com/challenges/simple-text-editor/problem
import sys
state = None
def op_append(*args):
W = args[0]
S = state[-1]
S += W
@barneyjackson
barneyjackson / pytorch_test.py
Created June 15, 2022 19:06
A simple Python script to check Python, torch, and CUDA are available and working
import torch
if not torch.cuda.is_available():
print("CUDA is not available")
else:
print(f"Found {torch.cuda.device_count()} devices")
curr_device = torch.cuda.current_device()
print(f"Current device is '{torch.cuda.get_device_name(curr_device)}'")
mem_free, mem_total = [f"{round(x/1024**3, 1)}GB" for x in torch.cuda.mem_get_info()]
print(mem_free, "free /", mem_total, "total")
#!/bin/bash
set -e
DATA_URI="s3://a_bucket/a_file.zip"
echo "Fetching export data from ${DATA_EXPORT_URI}:"
mkdir -p testing/
declare -a results
max_concurrent_requests_vals=(10 20 50 100)