Skip to content

Instantly share code, notes, and snippets.

View dukejones's full-sized avatar
🥽

Duke Jones dukejones

🥽
  • Berkeley
View GitHub Profile
@dukejones
dukejones / _js_assets.haml
Created October 17, 2013 19:00
Pass cache-busting asset paths to your javascript templates.
- js = "window.App = window.App || {}; App.assetPath={}; "
- ['login_logo.png', 'login_bg.png'].each do |asset_file|
- js << "App.assetPath['#{asset_file}']='#{asset_path(asset_file)}';"
:javascript
#{js}

Keybase proof

I hereby claim:

  • I am dukedorje on github.
  • I am dorje (https://keybase.io/dorje) on keybase.
  • I have a public key whose fingerprint is E596 2404 5535 1F46 606B 304E D8DE C0EF 369A FFB4

To claim this, I am signing this object:

@dukejones
dukejones / zcash-user-data-1.sh
Created October 17, 2016 16:01
user data for dockerized zcash
#!/bin/bash
IMG_LABEL=zcash
APP_INIT_URL=https://s3.amazonaws.com/your-bucket-app/myapp-init.tar.gz
function prepare_instance {
apt-get -y update
apt-get -y install nginx
curl -sSL https://get.docker.com/ | sh
mkdir /opt
@dukejones
dukejones / Dockerfile
Created October 26, 2016 04:35
Dockerfile for zcash standalone miner from str4d
FROM ubuntu:xenial
RUN apt-get -y update
RUN apt-get install -y build-essential pkg-config libc6-dev m4 g++-multilib autoconf libtool \
ncurses-dev unzip git python zlib1g-dev wget bsdmainutils automake
RUN git clone https://github.com/str4d/zcash.git \
&& cd zcash \
&& git checkout standalone-miner
RUN /zcash/zcutil/build.sh -j$(nproc)
@dukejones
dukejones / user_data.sh
Created October 28, 2016 06:29
user data for installing original zcash client
#!/bin/bash
apt-get update
apt-get upgrade -y
# SSH Key Auth
USERNAME=dorje
SSHKEY="ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDHcfdQt2xu0iaa4/rzmyBsCiYqo/T2MHMBp5eJLJrrlwqSz/PqfxsxwRxYKn/wq21waaki7PRUgvxUFiphgo1rRUCNCDl4/X9VgMJeyrGwReqJXYexY7KERLaBhjCPnKwO3278cGibwyNmI7+sUN5fuiiesOrVijqIqarPEY5K3JOs7bcJ1ljRbk7rJ6uCF8GxpEcga/lM5Gb3x6HhvwlWK9/vY83EvFS2/ce1fzE6Noo35vSWj8PCw9Ihg8B/dGN3eTBeP3plpxMFokxVKJMdXw3yS7bsQlTmaPgF1KR43FeqXVbFNoeX/gYFaFqzfQUn6EThC4Cm0EQjtxEebJu5 dorje@Dukes-MBP"
useradd -m -s /bin/bash $USERNAME
#!/usr/bin/env ruby
require 'aws-sdk'
require 'pry-byebug'
regions = [
'us-west-2', # Oregon
'us-east-1', # N Virginia
'eu-west-1', # Ireland
'eu-central-1', # Frankfurt
@dukejones
dukejones / aws_assume_role
Last active November 3, 2017 16:33 — forked from gene1wood/aws_assume_role
Workaround AWS CLI lack of support for IAM assume-role
#!/bin/bash
set -e
usage () {
cat <<DOCUMENTATIONXX
Usage : $0 PROFILE_NAME COMMAND
This tool will take a named profile from your ~/.aws/credentials with only
a "role_arn = " line and no source profile, get temporary credentials for
the profile, and execute the rest of the parameters as a command with the

Keybase proof

I hereby claim:

  • I am dukejones on github.
  • I am dorje (https://keybase.io/dorje) on keybase.
  • I have a public key ASAcnROFFb1FDb2kKJbP1BO0MQ74BRqTV0KwLmObOy7gFwo

To claim this, I am signing this object:

@dukejones
dukejones / logging.rake
Last active January 9, 2018 23:41
Use different rails log for rake tasks
# Use like: `task mytask: :setup_logger do`
# Rather than: `task mytask: :environment do`
task setup_logger: :environment do
set_logger(file: Rails.root.join('log', 'rake.log'))
end
# Or just call set_logger(file: 'custom_file.log') from your rake task. Be sure to use an absolute path.
def set_logger(file: STDOUT, level: Logger::INFO)
logger = ActiveSupport::TaggedLogging.new(Logger.new(file))
logger.level = level
@dukejones
dukejones / install-asdf-mac.sh
Created October 2, 2019 02:29
Install binary language interpreter version manager asdf on mac with no assumption. Script tries to be as idempotent as possible.
echo "Be sure to uninstall rvm, rbenv, nvm, and any other version managers ... they will probably interfere with asdf's magic."
echo -e "\033[1;32mBeginning major install process... 🐋🚀 \033[0m"
command -v brew >/dev/null 2>&1 || /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
echo "Installing GPG Encryption"
brew list gpg >/dev/null || brew install gpg
echo "Installing asdf tool!"
brew list asdf >/dev/null || brew install asdf