Skip to content

Instantly share code, notes, and snippets.

View jfrost's full-sized avatar

Jeff Frost jfrost

  • PostgreSQL Experts, Inc.
View GitHub Profile
@jfrost
jfrost / postgresql.conf.erb
Last active May 2, 2017 20:30
erb template for calculating a few memory based settings for postgresql.conf. Put postgresql.conf.erb in ~/erb-templates then you can run postgresqlconf-erb.sh <memorysize> <max_connections> <filesystem>
#########################################################
#
# Memory size: <%= memorysize %>
# max_connections: <%= max_connections %>
# Lun Fileystems: <%= lun_filesystem %>
#
#########################################################
listen_addresses = '*'
port = 5432
max_connections = <%= max_connections %>
@jfrost
jfrost / package_pdf2htmlex.sh
Last active July 22, 2016 17:28
Script to package pdf2htmlex with fontforge and poppler
#!/bin/bash
#
# Based on: https://gist.github.com/rajeevkannav/d07f822e209a22d07176
POPPLER_VERSION=$1
# second argument is the pdf2htmlEX version
# default to 0.14.6
PDF2HTMLEX_VERSION=${2:-"0.14.6"}
@jfrost
jfrost / fix-broken-pip.sh
Last active February 19, 2019 09:51
Fix broken python pip in Ubuntu
#!/bin/bash
sudo apt-get purge -y python-pip
cd /tmp
wget https://bootstrap.pypa.io/get-pip.py
sudo python get-pip.py
@jfrost
jfrost / gist:da3a062a53a9e4399efb
Created February 12, 2016 22:45
How to truncate a file with sudo
sudo tee file_i_want_to_truncate < /dev/null
# Installation
# ============
# Based off Chad Thompson's:
# https://raw.githubusercontent.com/chad-thompson/packer-example/master/ubuntu-simple-preseed.cfg
# Clock and Timezone
# ------------------
# ### Hardware Clock
#!/usr/bin/python
import crypt
import random
import string
def getsalt(mysalt = "", chars = string.letters + string.digits):
# generate a random 16-character 'salt'
@jfrost
jfrost / postgresql.conf.erb
Created September 4, 2015 20:52
PostgreSQL Configuration ERB Template
#########################################################
#
# puppet generated postgresql.conf
# Memory size: <%= memorysize %>
# max_connections: <%= max_connections %>
# Lun Fileystems: <%= lun_filesystem %>
#
#########################################################
listen_addresses = '*'
port = 5432
# only supply or default logfile path when none is given explicitly in
# postgresql.conf
my @options = ($pg_ctl, 'start', '-D', $info{'pgdata'});
my $logsize = 0;
if ($info{'logfile'}) {
push @options, ('-l', $info{'logfile'});
# remember current size of the log
$logsize = (stat $info{'logfile'})[7] || 0; # ignore stat errors
}
@jfrost
jfrost / gist:ee8ccc32159069f7c563
Created July 10, 2015 20:47
Grab the first available floating IP using neutron and awk
neutron floatingip-list --format csv --quote none | awk -F ',' '{ if ($2 == "" ) print $3 }'|head -1
@jfrost
jfrost / gist:74c47696da45c5e86f2f
Created March 24, 2015 15:10
output the job info from failed resque jobs
Resque::Failure.each { |idx, f| puts f }