Skip to content

Instantly share code, notes, and snippets.

View ginjo's full-sized avatar

William Richardson ginjo

View GitHub Profile
@ginjo
ginjo / scheduled_job.rb
Created September 10, 2012 05:06 — forked from kares/scheduled_job.rb
Recurring Job using Delayed::Job
# # # # # scheduled_job.rb - recurring schedules for delayed_job.rb # # # # #
#
# This file is version controlled at https://gist.github.com/ginjo/3688965
#
# Forked from https://gist.github.com/kares/1024726
#
# This is an enhanced version of the original scheduled_job.rb
# It was born out of the need to schedule a whole bunch of simple jobs.
# I started with the sample below and quickly found that I was repeating
# a lot of code. So I created the Delayed::Task pseudo-class that allows
@ginjo
ginjo / gist:60d087ee823dc73c15f4
Created September 24, 2014 06:48
Rvm repair wrappers failing
user@host:~/$ rvm repair wrappers
Regenerating all wrappers...
Regenerating wrappers for ruby-1.8.7-head.................................................................
Error running '__rvm_with ruby-1.8.7-head run_gem_wrappers_regenerate',
showing last 15 lines of /usr/local/rvm/log/1411540848/wrappers.regenerate.ruby-1.8.7-head.log
+ gem install gem-wrappers -v '>=1.2.4' --no-ri --no-rdoc
ERROR: Error installing gem-wrappers:
ERROR: Failed to build gem native extension.
/usr/local/rvm/rubies/ruby-1.8.7-head/bin/ruby extconf.rb
@ginjo
ginjo / rvm-output.txt
Last active August 29, 2015 14:06
Rvm attempted wrapper generation & repair fails
user@host01:~$ rvm get head
Downloading https://get.rvm.io
Downloading https://github.com/wayneeseguin/rvm/archive/master.tar.gz
Upgrading the RVM installation in /usr/local/rvm/
Can not update 'scripts/zsh/Completion/_rvm', it's a conflict between Zsh and multiuser installation, prefix the command with 'rvmsudo' to update this file.
Can not update 'scripts/extras/completion.zsh/_rvm', it's a conflict between Zsh and multiuser installation, prefix the command with 'rvmsudo' to update this file.
Found 5384 files not belonging to 'rvm',
use `--debug` to see the list, run `rvmsudo rvm get stable` to fix it., prefix the command with 'rvmsudo' to fix it, if the situation persist report a bug.
Found 1103 directories with mode different then '775',
@ginjo
ginjo / gist:aaa4a4395fcdbbad3d29
Last active December 1, 2019 08:32 — forked from bkimble/gist:1365005
Get structured array of hashes of memcached keys on multiple servers
#!/usr/bin/env ruby
# List all keys stored in memcache.
# Forked from bkimble's gist https://gist.github.com/bkimble/1365005
# Credit to Graham King at http://www.darkcoding.net/software/memcached-list-all-keys/ for the original article on how to get the data from memcache in the first place.
# Currently resides at https://gist.github.com/ginjo/aaa4a4395fcdbbad3d29
#
# This fork separates the server query code from results presentation.
# The primary function of this script is to return an array of hashes of
# key items from any number of provided memcached servers.
@ginjo
ginjo / rom_swap_datastore.rb
Created March 24, 2015 23:34
ROM swappable datastore example
# Swappable datastore example
ROM_ADAPTER = :sql # or :memory
# ...setup
class UsersSql < ROM::Relation[:sql]
dataset :users
def by_name(name)
@ginjo
ginjo / safe-enum-value-pr.md
Last active December 9, 2017 12:17
Documentation for Enum::Value

Enum::Value

What it does

Enum::Value lets you create immutable value object instances from your Enum::Base subclasses. These Value instances delegate to the Enum::Base subclass for all read and write operations. Additionally, these instances are comparable with each other AND with strings, symbols, and integers (the integers representing enum indexes).

Simple setup

class Side < Enum::Base

values :left, :right, :whole

@ginjo
ginjo / _ginjo_tools
Last active February 21, 2018 00:31
Generic tools and libraries for Ginjo projects
We couldn’t find that file to show.
@ginjo
ginjo / gist:e83dbefb51d179bcf3a9334609596196
Created March 22, 2018 00:48
Failed SSH connection with on-destroy remote-exec provisioner causes infinite loop
wbr$ terraform destroy
...
module.worker.aws_instance.node: Destroying... (ID: i-007df99effb41b99c)
module.worker.aws_instance.node: Provisioning with 'remote-exec'...
module.worker.aws_instance.node (remote-exec): Connecting to remote host via SSH...
module.worker.aws_instance.node (remote-exec): Host: 54.218.80.101
module.worker.aws_instance.node (remote-exec): User: admin
module.worker.aws_instance.node (remote-exec): Password: false
@ginjo
ginjo / auth_hash.yml
Created July 27, 2018 02:10
Slack workspace token OmniAuth::AuthHash object from ginjo fork of omniauth-slack gem, from non-admin user of "new" Slack app
--- !ruby/hash:OmniAuth::AuthHash
provider: slack
uid: U281GAVT5-T0BCJPFAM
info: !ruby/hash:OmniAuth::AuthHash::InfoHash
name: Bill Richards
email: myemail@gmail.com
user_id: U281GAVT5
team_name: WbrSandbox
team_id: T0BCJPFAM
image:
### This is an OmniAuth::AuthHash object from the ginjo fork of omniauth-slack.
### This AuthHash represents a workspace token with a number of identity and non-identity scopes.
--- !ruby/hash:OmniAuth::AuthHash
provider: slack
uid: U0BCC482X-T0BCJPFAM
info: !ruby/hash:OmniAuth::AuthHash::InfoHash
name: Bill
email: xxx@mac.com
user_id: U0BCC482X