Skip to content

Instantly share code, notes, and snippets.


Derek Bender djbender

View GitHub Profile
djbender /
Last active Apr 25, 2020
install pigz on boot2docker tiny core linux environments (i.e. dinghy) for speedup on docker image layer extraction

connect to the boot2docker image via dinghy ssh

djbender /
Last active Jan 21, 2020
a minimal repro for mounting individual files like the id_rsa file into a container
#!/usr/bin/env bash
docker run -it -v $HOME/.ssh/id_rsa:/Users/docker/.ssh/id_rsa alpine sh -c "ls -lah /Users/docker/.ssh/"
# which should output something like:
# total 12K
# drwxr-xr-x 2 root root 4.0K Jan 21 19:19 .
# drwxr-xr-x 3 root root 4.0K Jan 21 19:19 ..
# -r-------- 1 10000000 10000000 1.7K Sep 27 2017 /Users/docker/.ssh/id_rsa
djbender / .bash_profile
Created Apr 10, 2019
docker-compose wrapper for dinghy's issue with taking down networks.
View .bash_profile
docker-compose() {
if [ "$1" == "down" ]; then
echo "Running \`docker-compose stop\` first"
/usr/bin/env docker-compose stop
/usr/bin/env docker-compose "$@"
djbender / docker-compose.yml
Created Apr 9, 2019
bitnami's jenkins config ready for use with dinghy
View docker-compose.yml
version: '2'
image: 'bitnami/jenkins:2'
- '8080:8080'
- '8443:8443'
- '50000:50000'
- 'jenkins_data:/bitnami'
djbender / attachment_upload_status.rb
Created Mar 14, 2019
example of wrapping an ActiveRecord class with a module that uses it so as to separate the behavior of AttachmentUploadStatus from the persistence concerns (and table name) of AttachmentUploadFailures since only failures are stored in the db.
View attachment_upload_status.rb
# app/models/attachment_upload_status.rb
module AttachmentUploadStatus # no parent needed!
def self.cache_key(attachment)
def self.pending!(attachment)
Rails.cache.write(cache_key(attachment), 'pending', expires_in:
djbender / Gemfile
Created Dec 12, 2018 — forked from palkan/Gemfile
RSpec profiling with RubyProf and StackProf
View Gemfile
gem 'stackprof', require: false
gem 'ruby-prof', require: false
djbender / thread.rb
Created Mar 25, 2018 — forked from alyssais/thread.rb
My really hacky livetweeting script. You pass in the ID of the tweet to continue the thread from.
View thread.rb
require "yaml"
require "twitter"
config = YAML.load_file(File.expand_path("~/.trc")).dig("profiles", "qyliss").each_value.first
last_status = ARGV.fetch(0)
twitter = do |t|
t.consumer_key = config.fetch("consumer_key")
t.consumer_secret = config.fetch("consumer_secret")
set -e
CONTENTS=$(tesseract -c language_model_penalty_non_dict_word=0.8 --tessdata-dir /usr/local/share/ "$1" stdout -l eng | xml esc)
hex=$((cat <<EOF
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "">
<plist version="1.0">
djbender / init.lua
Created Dec 27, 2016 — forked from RichardForrester/init.lua
Karabiner Elements and Hammerspoon on MacOS Sierra
View init.lua
-- ln -s ~/repos/config/init.lua ~/.hammerspoon/init.lua
-- Global variable for the Command Mode
cMode ={}, "F17")
-- Global variable for Delete Mode
dMode ={}, 'F20')
-- Global variable for Select Mode
sMode ={}, 'F19')
I assume that the bot user is already in some channel.
In my case I had the bot invited to #bot-test in a slack I have admin privileges for.
You can’t perform that action at this time.