Skip to content

Instantly share code, notes, and snippets.

🕵

Derek Bender djbender

🕵
Block or report user

Report or block djbender

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@djbender
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
fi
/usr/bin/env docker-compose "$@"
}
@djbender
djbender / docker-compose.yml
Created Apr 9, 2019
bitnami's jenkins config ready for use with dinghy
View docker-compose.yml
version: '2'
services:
jenkins:
image: 'bitnami/jenkins:2'
ports:
- '8080:8080'
- '8443:8443'
- '50000:50000'
volumes:
- 'jenkins_data:/bitnami'
@djbender
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)
"attachment_upload:#{attachment.global_id}:status"
end
def self.pending!(attachment)
Rails.cache.write(cache_key(attachment), 'pending', expires_in: 1.day.from_now)
end
@djbender
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
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 = Twitter::REST::Client.new do |t|
t.consumer_key = config.fetch("consumer_key")
t.consumer_secret = config.fetch("consumer_secret")
View ocr-shot.sh
#!/bin/bash
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" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
@djbender
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 = hs.hotkey.modal.new({}, "F17")
-- Global variable for Delete Mode
dMode = hs.hotkey.modal.new({}, 'F20')
-- Global variable for Select Mode
sMode = hs.hotkey.modal.new({}, 'F19')
View README
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.
$ SLACK_API_KEY=xoxb-XXXXXXXXXXXX-XXXXXXXXXXXXXXXXXXXX ruby test-slack.rb
@djbender
djbender / notes.txt
Last active Oct 5, 2015
How do we even node?
View notes.txt
# How do we even node?
A story of us trying to node:
1. Use node's debugger to interact with a test spec running under jasmine-node
$ node debug /Users/username/.nvm/versions/node/v4.1.1/lib/node_modules/jasmine-node/lib/jasmine-node/cli.js hamming_test.spec.js
Note: debugger is in hamming.js but debugger could also be in cli.js,
hamming_test.spec.js, or any other file that is loaded.
View gist:d39efeba47761460c653
accomplished
aggravated
amused
angry
annoyed
anxious
apathetic
artistic
awake
bitchy
You can’t perform that action at this time.