Skip to content

Instantly share code, notes, and snippets.

View benlovell's full-sized avatar
🕺
Dancing

Ben Lovell benlovell

🕺
Dancing
  • Ben Lovell Ltd
  • London, United Kingdom
View GitHub Profile
@benlovell
benlovell / nginx.conf
Created January 21, 2013 08:52
Nginx rewriting
server {
listen 80;
server_name www.bleh.com;
return 301 $scheme://bleh.com$request_uri;
}
server {
listen 80;
server_name www.bleh.com;
## ...
@benlovell
benlovell / fap.rb
Created January 24, 2013 12:45
super lol
[1,2,3,2].cycle.each {|i| print "3==D\r".insert(i, "m"); sleep 0.1}
@benlovell
benlovell / statsd.rb
Created April 16, 2013 10:53
Simple statsd fake
require "socket"
sock = UDPSocket.new
sock.bind("127.0.0.1", 8125)
loop do
p sock.recvfrom(128)[0]
end
@benlovell
benlovell / derp.txt
Created April 19, 2013 10:45
SIGINT a running process (celluloid)
0x00007fff8f8d3342 in sigprocmask ()
(gdb) backtrace#0 0x00007fff8f8d3342 in sigprocmask ()
#1 0x00007fff89586e75 in setjmp ()#2 0x00000001090c2c8b in rb_thread_terminate_all () at thread.c:1024
#3 0x0000000108f76fcc in ruby_cleanup (ex=6) at eval.c:140#4 0x0000000108f77103 in ruby_run_node (n=<value temporarily unavailable, due to optimizations>) at eval.c:244
#5 0x0000000108f30edf in main (argc=2, argv=0x7fff56ccf350) at main.c:38
@benlovell
benlovell / rabbit.sh
Created April 19, 2013 13:40
Print commands to delete rabbitmq queues.
rabbitmqadmin list queues | awk '{print $4}' | awk 'NF!=0 {print}' | awk '{print "rabbitmqadmin delete queue name="$0}'
+-------+---------------------------------------+------------------+-------------+-----------+---------+------------------------+---------------------+--------+----------+----------------+-------------------------+------------------+--------+
| vhost | name | active_consumers | auto_delete | consumers | durable | exclusive_consumer_tag | idle_since | memory | messages | messages_ready | messages_unacknowledged | node | policy |
+-------+---------------------------------------+------------------+-------------+-----------+---------+------------------------+---------------------+--------+----------+----------------+-------------------------+------------------+--------+
| / | scamalytics_broadcast_message | 1 | False | 1 | True | | | 109584 | 0 | 0 | 0 | rabbit@localhost | |
| / | scamalytics_communication_received | 1
*FFF*F
Pending:
Item can be completed
# Not yet implemented
# ./spec/models/item_spec.rb:11
Item starts as incomplete
# Not yet implemented
# ./spec/models/item_spec.rb:9
-!- Channel #jruby
16:25 < chamila_> Can somebody tell me how to connect to internet in solaris 10 Using a USB dongle?
16:26 < benlovell> lol
class Benbot < RTanque::Bot::Brain
include RTanque::Bot::BrainHelper
NAME = "benbot"
TURRET_FIRE_RANGE = RTanque::Heading::ONE_DEGREE * 5.0
THRESHOLD = 60
def tick!
check_hit
if (target = closest_target)
fire(target)
@benlovell
benlovell / gist:7039635
Created October 18, 2013 10:32
celluloid cores
herpderp~/code % ruby -e 'require "celluloid"; puts Celluloid.cores'
8