Skip to content

Instantly share code, notes, and snippets.

View Oshuma's full-sized avatar

Dale Campbell Oshuma

View GitHub Profile
@Oshuma
Oshuma / plex.sh
Last active February 27, 2020 14:58
Spin up a Plex docker container
#!/usr/bin/env bash
if [ $# -ne 1 ]; then
echo "$(basename $0) <claim-token>"
echo -e "\nGet claim token here: https://www.plex.tv/claim/"
exit 1
fi
claim_token=$1
@Oshuma
Oshuma / restore
Created October 27, 2017 00:41 — forked from jgillman/restore.sh
pg_restore a local db dump into Docker
# 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
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
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"
<?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;
@Oshuma
Oshuma / sweetAlert-rails.js
Created October 21, 2014 16:04
Use sweetAlert with Rails UJS.
$.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');
};
@Oshuma
Oshuma / wma_to_mp3.rb
Created August 17, 2014 05:27
Convert .wma to .mp3
#!/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}"
for f in (ls *.flac); ffmpeg -i "$f" -acodec libmp3lame -ab 320k (echo mp3/(basename $f .flac).mp3); end
[user]
name = YOUR NAME
email = YOUR EMAIL
[github]
user = GITHUB USERNAME
token = GITHUB TOKEN
[core]
pager = less -FMRX
@Oshuma
Oshuma / fetch_and_build.sh
Created February 8, 2014 23:48
Shell script to pull and compile latest OpenXcom code.
#!/bin/sh
echo "\n== Stashing changes..."
git stash &&
echo "\n== Pulling latest code..."
git pull &&
echo "\n== Removing old build/ dir..."
rm -rf ./build/ &&