Skip to content

Instantly share code, notes, and snippets.

View nuclearsandwich's full-sized avatar

Steven! Ragnarök nuclearsandwich

View GitHub Profile
@clalancette
clalancette / ros-sync-remove-dbgsym.py
Created September 11, 2019 13:37
Python script to remove dbgsym packages from ROS sync notices and recalculate package numbers
#!/usr/bin/python3
import sys
if len(sys.argv) != 3:
print("Usage: %s <input> <distro>" % (sys.argv[0]))
sys.exit(1)
infile = sys.argv[1]
distro = sys.argv[2]
@JEG2
JEG2 / what_am_i.md
Created February 19, 2014 00:49
I'm trying to solve or at least learn more about this problem.

I have a problem that pretty much boils down to this:

a = [1, 2, 3]
b = [1.1, 2.2, 3.3]

# BEGIN GROSS SOLUTION:  avert your eyes!
results = [ ]
a.each do |i|
 b.each do |j|
[16:56:05] <k1t___> youre making a mistake
[16:56:18] <k1t___> i promise you motherfucker
[16:56:28] <k1t___> adrian lamo
[16:56:31] <k1t___> kevin mitnick
[16:56:38] <k1t___> these dont ring bells?
[16:56:50] <k1t___> my friends you fucking faggot stupid motherfucker
[16:56:56] <k1t___> ill own your soul you faggot
[16:57:19] <k1t___> and your moms
[16:57:25] <k1t___> and your pathetic fathers
@marcinbunsch
marcinbunsch / wat_spec.rb
Created June 25, 2012 20:45
expecting an error once
class Wat
attr_accessor :collaborator, :credentials
def foo(arg)
@collaborator.foo(arg)
rescue
@collaborator.set_auth_credentials(credentials)
@collaborator.foo(arg)
end
@rtomayko
rtomayko / latency.txt
Created June 1, 2012 00:43 — forked from jhclark/latency.txt
Latency numbers every programmer should know
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns
Send 1K bytes over 1 Gbps network 10,000 ns 0.01 ms
Read 1 MB sequentially from memory 250,000 ns 0.25 ms
Round trip within same datacenter 500,000 ns 0.5 ms
Read 1 MB sequentially from SSD 1,000,000 ns 1 ms 4X memory
@bokmann
bokmann / ActiveRepository.rb
Created March 27, 2012 16:15
ActiveRepository Strawman
# MOTIVATION: As rails apps are growing, people are noticing the drawbacks
# of the ActiveRecord pattern. Several apps I have seen, and several
# developers I have spoken to are looking towards other patterns for object
# persistence. The major drawback with ActiveRecord is that the notion
# of the domain object is conflated with what it means to store/retrieve
# it in any given format (like sql, json, key/value, etc).
#
# This is an attempt to codify the Repository pattern in a way that would
# feel comfortable to beginner and seasoned Ruby developers alike.
#
@marcel
marcel / gist:2100703
Created March 19, 2012 07:24
giftube – Generates an animated gif from a YouTube url.
#!/usr/bin/env ruby
# giftube – Generates an animated gif from a YouTube url.
#
# Usage:
#
# giftube [youtube url] [minute:second] [duration]
#
# ex.
#
@dysinger
dysinger / vlc-stream-desktop-to-mp4.sh
Created March 7, 2012 01:40
Stream your desktop with VLC (screencam)
# stream video from your desktop & audio from another device into an h264/mp3 avi video with VLC
vlc screen:// --screen-fps=12 \
--input-slave=alsa://hw:1,0 \
--qt-start-minimized \
--sout "#transcode{venc=x264,vcodec=h264,fps=12,vb=640,acodec=mp3,channels=1,ab=64}\
:std{access=file,mux=mp4,dst=screencam-$(date -u +%Y-%m-%d-%s).avi}"
@bmizerany
bmizerany / gist:1557817
Created January 4, 2012 00:48
Clueless Recruiter
From: Matthew Greenburg <[email protected]>
CC: Carl Narcisse <[email protected]>
Blake,
My name is Matt Greenburg with Astreya Partners, an IT staffing company in Santa Clara. We bring on full time employees of Astreya to work on-site at our clients' locations. I came across your resume and was wondering if you were entertaining new career opportunities at this time. I think you would be a great fit for a position we have open as a Web Application Developer, Ruby on Rails.This position is located in Cupertino, CA at a large very well known company. Think big!
Web Application Developer, Ruby on Rails
Successful team members must be able to document, design, develop, validate and maintain complete solutions to specific business needs with minimal supervisory input in a dynamic, result driven environment. These contributors need a wide variety and depth of web-related (including associated back end) technical skills and are well organized, self-motivated people with excellent communication skills
@avdi
avdi / when.rb
Created December 5, 2011 22:17
Experimenting with Object#when in Ruby
def maybe_a_sandwich
nil
end
# Methods that might return nil are annoying. We want to write a nice
# confident chain:
result = nil
result = maybe_a_sandwich.add_horseradish.get_into_my_belly! rescue $!
result # => #<NoMethodError: undefined method `add_horseradish' for nil:NilClass>