Skip to content

Instantly share code, notes, and snippets.

golang: go run go-producer.go
redis: redis-server
ruby: sidekiq -r './ruby-consumer.rb'
$Rewards = "Donuts","Cookies","Steak","Bacon","Cupcakes","Truffles","Chocolates","Snacks","Breakfast","Lunch","Back rubs","Burgers","Pancakes","High fives","Coconuts","Cheesecake","Stamps"
$sendDateTime = (Get-Date)
$sendDateTime.AddSeconds(-1)
while($true)
{
Write-Output ($sendDateTime -lt (Get-Date))
if($sendDateTime -lt (Get-Date))
{
$ChosenReward = $Rewards | Get-Random
@joshjordan
joshjordan / socks-proxy.sh
Created August 18, 2016 04:35
Simple script to connect to a dynamic proxy via SSH and connect your local OS X wifi to it via SOCKS. Disconnects on CTRL+C
#!/bin/bash
# Set PROXY_HOST to the SSH proxy hostname (optionally, include a username)
# Override PROXY_PORT if necessary
sudo -s <<EOF
trap clear_proxy INT
function clear_proxy() {
echo "Disconnecting proxy..."
@joshjordan
joshjordan / to_csv.rb
Last active August 4, 2016 02:50
Snippet that saves an array of hashes to a CSV file easily
require 'csv'
class Array
def to_csv(csv_filename, homogeneous_headers = false)
return unless self.any?
headers = if homogeneous_headers
self.first.keys
else
self.inject([]) { |memo, row| memo |= row.keys; memo }
end

Keybase proof

I hereby claim:

  • I am joshjordan on github.
  • I am joshjordan (https://keybase.io/joshjordan) on keybase.
  • I have a public key whose fingerprint is 017B 4FEC 0D82 7646 A7BA F2B3 AD81 8BB5 E132 FB8A

To claim this, I am signing this object:

@joshjordan
joshjordan / _zsh-config.sh
Last active February 8, 2024 03:23
Initialize a new machine with my preferred applications and configurations
#!/bin/zsh
git clone --recursive https://github.com/sorin-ionescu/prezto.git "${ZDOTDIR:-$HOME}/.zprezto"
setopt EXTENDED_GLOB
for rcfile in "${ZDOTDIR:-$HOME}"/.zprezto/runcoms/^README.md(.N); do
ln -s "$rcfile" "${ZDOTDIR:-$HOME}/.${rcfile:t}"
done
git clone https://gist.github.com/033fd9f674a670da0460.git ~/zprezto_custom
ln -s ~/zprezto_custom/prompt_joshjordan_setup ~/.zprezto/modules/prompt/functions/prompt_joshjordan_setup
@joshjordan
joshjordan / prompt_joshjordan_setup
Last active January 16, 2016 22:47
Simple prezto prompt with working directory and git info on the left prompt, and current time on right prompt.
#
# My prezto prompt. Simplified version of (read: almost completely lifted from) steeef theme
#
function prompt_joshjordan_precmd {
# Check for untracked files or updated submodules since vcs_info does not.
if [[ -n $(git ls-files --other --exclude-standard 2> /dev/null) ]]; then
branch_format="(${_prompt_joshjordan_colors[1]}%b%f%u%c${_prompt_joshjordan_colors[4]}●%f)"
else
branch_format="(${_prompt_joshjordan_colors[1]}%b%f%u%c)"
require 'benchmark'
module A
end
class DefinedMethodStyle
def dont_bust_cache(*)
Object.new
nil
end