Skip to content

Instantly share code, notes, and snippets.

@just3ws
just3ws / ugtastic_interviewees_list
Created January 31, 2013 17:47
A list of everyone who's been interviewed for UGtastic. Not all published yet though.
Aaron Bedra
Aaron Holbrook
Aaron Kalin
Adam Grandy
Adewale Oshinye
Amy Kinney
Andrea Magnorsky
Andy Lester
Angelique Martin
Anthony Zinni & Jon Buda & Shay Howe
#!/usr/bin/env bash -x
apt-get -y update
# -------------------------------
# Based on bootstrap-ubuntu-12-04
# https://raw.github.com/fesplugas/rbenv-bootstrap/master/bin/rbenv-bootstrap-ubuntu-12-04
# Update sources:
apt-get -y update
@just3ws
just3ws / ubuntu_bootstrap_locale.sh
Last active December 15, 2015 01:59
Set the encoding to UTF-8 and the timezone to UTC on Ubuntu hosts.
#!/bin/bash -x
echo "LANG=\"en_US.UTF-8\"" >> /etc/environment
echo "LANGUAGE=\"en_US.UTF-8\"" >> /etc/environment
echo "LC_ALL=\"en_US.UTF-8\"" >> /etc/environment
source /etc/environment
apt-get install -y --reinstall locales
locale-gen en_US.UTF-8
@just3ws
just3ws / ubuntu_prepare.sh
Last active December 15, 2015 07:49
Prepare Ubuntu hosts for installation
#!/bin/bash -ex
apt-get -y install curl
curl -L https://gist.github.com/just3ws/5184024/raw/90677d99b50ba7182ef6a371edcbc3d20c5c62ab/ubuntu_bootstrap_locale.sh | bash
curl -L https://gist.github.com/just3ws/5183471/raw/dbcfa7b2cb7889d4d289f1e5464ac5dbb4f39085/chef_solo_bootstrap.sh | bash
@just3ws
just3ws / first_step.sh
Last active December 15, 2015 08:08
Error when trying to cook the postgresql recipe with Chef.
✘ mhall@G14763 ⮀ ~/projects/chef ⮀ ⭠ master ⮀ knife solo cook three
Checking Chef version...
Starting Chef Client, version 11.4.0
Compiling Cookbooks...
================================================================================
Recipe Compile Error in /tmp/chef-solo/cookbooks/postgresql/recipes/server.rb
================================================================================
@just3ws
just3ws / blech.rb
Created June 13, 2013 16:12
Give a random time within a window on the next calendar day.
1.day.from_now(Time.parse("#{Random.rand(1..5)}:#{Random.rand(0..59)}"))
@just3ws
just3ws / gist:5781229
Created June 14, 2013 11:46
My Zencoder recipe for UGtastic
{
"input": "s3://bukkit/_upload/test.m4v",
"outputs": [
{
"url": "s3://bukkit/xtestx.mp4",
"h264_profile": "high",
"public": true,
"thumbnails": {
"number": 6,
"prefix": "xtestx-thumbnail",
@just3ws
just3ws / append-to-rc.sh
Created November 15, 2013 15:19
Append a file to and then re-source the current shell's RC file.
echo "source \$HOME/upcity/devenv/bin/host-functions.sh" >> "$HOME/.`basename "${SHELL}"`rc"
source $HOME/.`basename "${SHELL}"`rc
@just3ws
just3ws / conditionals.sh
Created March 7, 2014 04:02
Some checks for common env settings that are useful in ZSH scripts.
# checks (stolen from zshuery)
if [[ $(uname) = 'Linux' ]]; then
IS_LINUX=1
fi
if [[ $(uname) = 'Darwin' ]]; then
IS_MAC=1
fi
if [[ -x `which brew` ]]; then
@just3ws
just3ws / convert_string_hash_representation_to_ruby_hash.rb
Last active December 12, 2023 01:27
Converting a string representation of a Ruby Hash back into a Ruby Hash
require 'pp'
require 'json'
s = "{:exit_url=>\"null\", :exit_target_type=>\"left\", :furthest_scrolled=>\"locations\", :time_spent=>\"543210\", :user_id=>\"123456\", :visited_at=>789101112, :user=>nil}"
pp JSON.parse("{" + s.gsub(/^{|}$/, '').split(', ').map { |pair| pair.split('=>') }.map {|k, v| [k.gsub(/^:(\w*)/, '"\1"'), v == 'nil' ? "null" : v].join(": ") }.join(", ") + "}")
=> {"exit_url"=>"null", "exit_target_type"=>"left", "furthest_scrolled"=>"locations", "time_spent"=>"543210", "user_id"=>"123456", "visited_at"=>789101112, "user"=>nil}