Skip to content

Instantly share code, notes, and snippets.

View hSATAC's full-sized avatar
🐈
Cataholic

Ash Wu hSATAC

🐈
Cataholic
View GitHub Profile

Graphing Widget

The graphing widget shows graphs using the Rickshaw graphing library. The names of data fields should be (vaguely) familiar if you've used Rickshaw before.

It's recommended that you replace the /assets/javascripts/rickshaw.min.js from your dashboard with the latest from here.

Supported HTML data fields

module CarrierWave
module Storage
class Fog
class File
alias :store_without_safety_net :store
def store(new_file)
retries_remaining = 3
begin
store_without_safety_net(new_file)
rescue Excon::Errors::SocketError => e

Keybase proof

I hereby claim:

  • I am hsatac on github.
  • I am hsatac (https://keybase.io/hsatac) on keybase.
  • I have a public key whose fingerprint is ADD9 28DD E493 F920 2342 AE5E 04AC 2752 62A8 F4E9

To claim this, I am signing this object:

ruby -rsidekiq/api -e 'loop do;count = Sidekiq::Stats.new.enqueued;puts "Remaining jobs: #{count}";exit if count == 0;sleep 5;end'
@hSATAC
hSATAC / jenkins_build_docker.bash
Created May 27, 2014 10:52
Docker run does not pass exit code back to jenkins. This is a workaround for that.
docker build --rm -t $JOB_NAME/$BUILD_NUMBER .
docker run $JOB_NAME/$BUILD_NUMBER | perl -pe '/Failed examples:/ && `echo "fail" > docker-tests-failed`'
if [ ! -f docker-tests-failed ]; then
echo -e "No docker-tests-failed file. Apparently tests passed."
else
echo -e "docker-tests-failed file found, so build failed."
rm docker-tests-failed
exit 1
fi
@hSATAC
hSATAC / postgresql-template1-encodinf.pp
Last active January 3, 2019 22:09
Set postgresql template1 encoding to UTF8 in Puppet.
exec { "postgresql-template1-utf8":
command => "psql -c \"update pg_database set datistemplate=false where datname='template1';\" &&
psql -c 'drop database Template1;' &&
psql -c \"create database template1 with owner=postgres encoding='UTF-8' lc_collate='en_US.utf8' lc_ctype='en_US.utf8' template template0;\"
",
user => "postgres",
path => "/usr/bin",
unless => "/usr/bin/psql -Atc \"select pg_encoding_to_char(encoding) from pg_database where datname='template1'\" | /bin/grep -c UTF8"
}
echo "deb http://apt.postgresql.org/pub/repos/apt/ precise-pgdg main" | sudo tee /etc/apt/sources.list.d/pgdg.list
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
sudo apt-get update
sudo apt-get install postgresql-9.3 postgresql-server-dev-9.3 postgresql-contrib-9.3 -y
sudo su - postgres -c "psql template1 -p 5433 -c 'CREATE EXTENSION IF NOT EXISTS hstore;'"
sudo su - postgres -c "psql template1 -p 5433 -c 'CREATE EXTENSION IF NOT EXISTS \"uuid-ossp\";'"
sudo su - postgres -c "service postgresql stop"
sudo su - postgres -c '/usr/lib/postgresql/9.3/bin/pg_upgrade -b /usr/lib/postgresql/9.1/bin -B /usr/lib/postgresql/9.3/bin -d /var/lib/postgresql/9.1/main/ -D /var/lib/postgresql/9.3/main/ -O "-c config_file=/etc/postgresql/9.3/main/postgresql.conf" -o "-c config_file=/etc/postgresql/9.1/main/postgresql.conf"'
#!/bin/bash
apt-get install --yes lsb-release
DISTRIB_CODENAME=$(lsb_release --codename --short)
DEB="puppetlabs-release-${DISTRIB_CODENAME}.deb"
DEB_PROVIDES="/etc/apt/sources.list.d/puppetlabs.list" # Assume that this file's existence means we have the Puppet Labs repo added
if [ ! -e $DEB_PROVIDES ]
then
# Print statement useful for debugging, but automated runs of this will interpret any output as an error
require 'digest'
filename = "House.Of.Cards.2013.S02E01.720p.WEB-DL.x264-Sohu.mp4"
f = File.new(filename, "rb")
puts f.stat.inspect
file_size = File.size?(filename)
offset = []
@hSATAC
hSATAC / commit-msg
Created February 12, 2014 10:23 — forked from remi/commit-msg
#!/usr/bin/env ruby
# 1. Install hunspell
# $ brew install hunspell
# 2. Download a dictionary and install it in a path listed by `hunspell -D`
# $ open http://wiki.services.openoffice.org/wiki/Dictionaries
# 3. Move this file into your repository
# $ mv commit-msg /path/to/repo/.git/hooks