Skip to content

Instantly share code, notes, and snippets.

int a[] = { 1,2,3,4,5,6,7,8,9 };
int b[] = { 2,4,8,12,16,18 };
int *c;
int main() {
int i, j, k;
c = malloc(sizeof(a) + sizeof(b));
for (i = 0, j = 0, k = 0; i < sizeof(a)/sizeof(int) && j < sizeof(b)/sizeof(int); ) {
### Keybase proof
I hereby claim:
* I am sodabrew on github.
* I am sodabrew (https://keybase.io/sodabrew) on keybase.
* I have a public key ASCnrCRnlJkvgi_CpU8yRPfSOP5xtJfkgv9siUDwtD49NQo
To claim this, I am signing this object:
@sodabrew
sodabrew / rbx-crash.txt
Created July 17, 2015 06:03
mysql2 rbx crash
https://travis-ci.org/brianmario/mysql2/jobs/71173451
warning: parser/current is loading parser/ruby21, which recognizes
warning: 2.1.6-compliant syntax, but you are running 2.1.0.
warning: please see https://github.com/whitequark/parser#compatibility-with-ruby-mri.
Running RuboCop...
Inspecting 36 files
...........The Rubinius process is aborting with signal: SIGSEGV
--- begin system info ---
node info: testing-worker-linux-08b40318-2-25201-linux-14-71173451 #1 SMP Fri Mar 13 20:06:37 MSK 2015
The Rubinius process is aborting with signal: SIGSEGV
--- begin system info ---
node info: testing-worker-linux-f25aadab-2-12270-linux-10-70783939 #1 SMP Tue May 12 18:07:50 MSK 2015
--- end system info ---
--- begin rubinius info ---
process info: travis rbx 5357 2.5.7 2.1.0 2015-06-17 d4fdeaad 3.4 JIT
--- end rubinius info ---
--- begin system backtrace ---
/home/travis/.rvm/rubies/rbx-2.5.7/bin/rbx() [0x69990a]
/lib/x86_64-linux-gnu/libpthread.so.0(+0xfcb0) [0x7fb52a22fcb0]
#!/usr/bin/env tumblr_ruby
require 'zk'
require 'json'
require 'logger'
require 'socket'
require 'timeout'
require 'nrpe_check'
class CheckHBase
include NRPE::Check
@sodabrew
sodabrew / ec2_vpc.rb
Created December 16, 2013 21:34
Add EC2 VPC facts to Facter 1.7, drop this file into `/etc/facter/facts.d/`
require 'facter/ec2'
# We might be in a VPC, which fails the normal EC2 MAC address checks
if !Facter.value('ec2_instance_id') && Facter.value('virtual') =~ /xen/ && Facter::Util::EC2.can_connect?(0.2)
Facter.debug "This is an EC2 VPC instance"
metadata
userdata
# vpc-id is in a newer metadata api rev than the usual EC2 facts
Facter.add(:ec2_vpc_id) do
diff --git a/Gemfile b/Gemfile
index 1422da2..521b4da 100644
--- a/Gemfile
+++ b/Gemfile
@@ -38,7 +38,7 @@ group :test do
end
platforms :mri_19, :mri_20 do
- gem 'debugger'
+ # gem 'debugger'
@sodabrew
sodabrew / p9813.ino
Created May 10, 2012 19:28
Arduino code for P9813 pixels (e.g. Grove chainable RGB module)
/* Arduino code for P9813 pixels (e.g. Grove chainable RGB module)
*
* Originally from:
* http://auschristmaslighting.com/forums/index.php/topic,1261.msg15498.html#msg15498
*/
#define uint8 unsigned char
#define uint16 unsigned int
#define uint32 unsigned long int
@sodabrew
sodabrew / gist:2655193
Created May 10, 2012 19:10
libevent HTTP server client IP address
void http_request_cb(struct evhttp_request *req, void *user)
{
char *client_ip;
u_short client_port;
evhttp_connection_get_peer(evhttp_request_get_connection(req), &client_ip, &client_port);
printf("Client IP [%s] port [%d]\n", client_ip, client_port);
}
# Is there a better way to deep copy a structure in Ruby?
if templates.has_key?(ip)
# There's no deep copy in Ruby, so we do this horrific thing
desired_records = Marshal::load(Marshal.dump(templates[ip]))
end