View restore
# Assumes the database container is named 'db'
DOCKER_DB_NAME="$(docker-compose ps -q db)"
DB_HOSTNAME=db
DB_USER=postgres
LOCAL_DUMP_PATH="path/to/local.dump"
docker-compose up -d db
docker exec -i "${DOCKER_DB_NAME}" pg_restore -C --clean --no-acl --no-owner -U "${DB_USER}" -d "${DB_HOSTNAME}" < "${LOCAL_DUMP_PATH}"
docker-compose stop db
View git_daily.fish
function git_daily --description 'Daily stats for given git branch'
# git log --since=1.day --author='<YOUR_EMAIL>' --shortstat $argv | awk '/^ [0-9]/ { f += $1; i += $4; d += $6 } END { printf("%d files changed, %d insertions(+), %d deletions(-)", f, i, d) }'
git log --since=12.hours --author='<YOUR_EMAIL>' --shortstat $argv | awk '/^ [0-9]/ { f += $1; i += $4; d += $6 } END { printf("%d files changed, %d insertions(+), %d deletions(-)", f, i, d) }'
end
View .tmux.conf
bind r source-file ~/.tmux.conf
# remap prefix to Control-a
set -g prefix C-a
# bind 'C-a C-a' to type 'C-a'
bind C-a send-prefix
unbind C-b
set -g default-terminal "screen-256color"
View GetHeader.xml
<?xml version="1.0" encoding="utf-8"?>
<string xmlns="http://webservices.theshootingwarehouse.com/smart/Orders.asmx">&lt;NewDataSet&gt;
&lt;Table&gt;
&lt;ORDNO&gt;2378426&lt;/ORDNO&gt;
&lt;ORCUST&gt;99994&lt;/ORCUST&gt;
&lt;ORPO&gt;123&lt;/ORPO&gt;
&lt;ORCONO&gt;123&lt;/ORCONO&gt;
&lt;ORDATE&gt;151027&lt;/ORDATE&gt;
&lt;MSG&gt;This is a test order.&lt;/MSG&gt;
&lt;ORAIR /&gt;
View sweetAlert-rails.js
$.rails.allowAction = function(link) {
if ( ! link.attr('data-confirm') ) return true;
$.rails.showConfirmDialog(link);
return false;
};
$.rails.confirmed = function(link) {
link.removeAttr('data-confirm');
link.trigger('click.rails');
};
View wma_to_mp3.rb
#!/usr/bin/env ruby
class WmaToMp3
TEMP_WAV = 'audiodump.wav'
def self.convert!(path)
wma_files = Dir.glob(File.join(path, "**/*.wma"), File::FNM_CASEFOLD)
if wma_files.empty?
STDOUT.puts "No .wma files found at: #{path}"
View flac_to_mp3.fish
for f in (ls *.flac); ffmpeg -i "$f" -acodec libmp3lame -ab 320k (echo mp3/(basename $f .flac).mp3); end
View .gitconfig
[user]
name = YOUR NAME
email = YOUR EMAIL
[github]
user = GITHUB USERNAME
token = GITHUB TOKEN
[core]
pager = less -FMRX
View fetch_and_build.sh
#!/bin/sh
echo "\n== Stashing changes..."
git stash &&
echo "\n== Pulling latest code..."
git pull &&
echo "\n== Removing old build/ dir..."
rm -rf ./build/ &&
View AI_1.log
2013-12-29 21:53:24,532 DEBUG AI : AI_1 logger initialized.
2013-12-29 21:53:24,532 DEBUG AI : AIClientApp and logging initialized. Running app.
2013-12-29 21:53:24,532 DEBUG AI : PythonAI::PythonAI()
2013-12-29 21:53:24,546 DEBUG AI : Python initialized
2013-12-29 21:53:24,546 DEBUG AI : Python version: 2.7.5 (default, May 12 2013, 12:27:12)
[GCC 4.8.0 20130502 (prerelease)]
2013-12-29 21:53:24,546 DEBUG AI : Python prefix: /usr
2013-12-29 21:53:24,546 DEBUG AI : Python module search path: /usr/local/freeorion/lib/python2.7:/usr/local/freeorion/lib/python2.7/lib-dynload:/usr/lib/python27.zip:/usr/lib/python2.7/:/usr/lib/python2.7/plat-linux2:/usr/lib/python2.7/lib-tk:/usr/lib/python2.7/lib-old:/usr/lib/python2.7/lib-dynload
2013-12-29 21:53:24,546 DEBUG AI : Initializing C++ interfaces for Python
2013-12-29 21:53:24,645 DEBUG AI : Python stdout and stderr redirected