Skip to content

Instantly share code, notes, and snippets.

View r1b's full-sized avatar
🌍
(hack planet)

r1b

🌍
(hack planet)
View GitHub Profile
@r1b
r1b / stream-no-data-listener.js
Created December 27, 2019 21:25
Extended example from node stream docs
const net = require('net');
net.createServer((socket) => {
// We add an 'end' listener, but never consume the data.
socket.on('end', () => {
// It will never get here.
socket.end('The message was received but was not processed.\n');
});
}).listen(1337);
@r1b
r1b / pause-on-connect.js
Created December 26, 2019 03:42
Illustrating pauseOnConnect close behavior
const net = require('net');
const server = net.createServer({pauseOnConnect: true});
server.on("connection", socket => {
socket.on("end", () => {
console.log("got a FIN");
});
socket.on("close", () => {
console.log("sent my FIN");
server.close();

Keybase proof

I hereby claim:

  • I am r1b on github.
  • I am r1b (https://keybase.io/r1b) on keybase.
  • I have a public key ASCwY9N5U20tXzBDM43kRZ_tmtARb9b9V36-SBjOiIOlMgo

To claim this, I am signing this object:

@r1b
r1b / art.sh
Last active March 14, 2016 04:48
art
#!/bin/bash
curl -sL http://www.wikiart.org/en/random | pup 'img[itemprop="image"] attr{src}' | sed 's/\!.*//' | xargs -- curl -so $HOME/art.jpg
gsettings set org.gnome.desktop.background picture-uri file://$HOME/art.jpg
@r1b
r1b / exhaust.js
Last active August 29, 2015 14:15
Exhaust stream
function exhaust(stream, cb) {
var data = '';
stream.on('data', function (chunk) {
data += chunk.toString();
});
stream.on('error', function (err) {
return cb(err);
});
@r1b
r1b / nuwave-wicd
Last active August 29, 2015 14:15
Connect to NUWave on Linux with wicd
Properties ->
[x] Use these settings for all networks sharing this essid
[x] Use encryption
+ PEAP with GTC
Identity: <myNEU username>
Password: <myNEU password>
Key:
! = I am working on this
- = I am not working on this
* = I am really interested in making this
$ = You could make money with this
From the...
+ MS Windows dept
- Indicate which device disconnected when it makes that stupid beep noise
@r1b
r1b / country2nmap.py
Created June 15, 2014 02:43
Convert nirsoft country .csv ip ranges to nmap target selection format
# I am not responsible &c
# RCJ 2014
import sys
import requests
url = 'http://www.nirsoft.net/countryip/' + sys.argv[1] + '.csv'
r = requests.get(url)
if r.status_code != 200:
print "Bad country code: " + sys.argv[1]
@r1b
r1b / slice.c
Created December 6, 2013 07:07
Capture audio and store the last n seconds in a circular buffer.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <signal.h>
#include "sndfile.h"
#include "portaudio.h"
#define SAMPLE_RATE 44100
#define FRAMES_PER_BUFFER 1024
#define NUM_SECONDS 3