Skip to content

Instantly share code, notes, and snippets.

View x0bandeira's full-sized avatar

Rafael Bandeira x0bandeira

View GitHub Profile
@danielrw7
danielrw7 / replify
Last active October 24, 2023 12:03
replify - Create a REPL for any command
#!/bin/sh
command="${*}"
printf "Initialized REPL for `%s`\n" "$command"
printf "%s> " "$command"
read -r input
while [ "$input" != "" ];
do
eval "$command $input"
printf "%s> " "$command"
@x0bandeira
x0bandeira / tags-fix-attempt
Last active March 18, 2016 21:29
`ctags` doesn't seem to play well with namespaced ruby class names out of the box. Even trying with `--extra=q`. `ripper-tags` seems to fix it.
#!/usr/bin/env ruby
`/usr/bin/env ctags -R #{ENV["PWD"]}/app`
tags_file = "#{ENV["PWD"]}/tags"
tags = File.read(tags_file)
fixed_tags = tags.split(/\n/).map do |line|
is_rb = line =~ /\.rb/
if is_rb
name = line.gsub(/^.+(?:class|module) ([a-zA-Z0-9:]+).+$/, '\1')
# http://redis.io/commands/rpoplpush
module Resque
def self.move_queue(source, destination)
r = Resque.redis
r.llen("queue:#{source}").times do
r.rpoplpush("queue:#{source}", "queue:#{destination}")
end
end
end