Skip to content

Instantly share code, notes, and snippets.

@soarez
soarez / Makefile
Created January 30, 2013 01:19
Count stack frames
program: main.c
gcc -Wall -O0 -masm=intel -m32 -g -o program main.c
@soarez
soarez / pullall.sh
Last active December 17, 2015 12:39
update and link a folder of git versioned npm modules
#!/bin/bash
contents=`ls`
module_names=()
module_folders=()
npm_root=$(npm root -g)
do_pull=1
do_npm_install=1
do_npm_link=1
@soarez
soarez / .tmux.conf
Last active May 5, 2022 08:58
My messy tmux conf
# use b as prefix
set-option -g prefix C-b
unbind-key C-a
bind-key C-b send-prefix
# Start numbering at 1
set-option -g base-index 1
# Allows for faster key repetition
set-option -g escape-time 0
@soarez
soarez / linetransform.js
Last active December 26, 2015 10:09
Line transform
var Transform = require('stream').Transform;
var util = require('util');
module.exports = LineTransform;
util.inherits(LineTransform, Transform);
function LineTransform() {
Transform.apply(this, arguments);
this.setEncoding('utf8');
}
@soarez
soarez / ca.md
Last active April 15, 2024 12:20
How to setup your own CA with OpenSSL

How to setup your own CA with OpenSSL

For educational reasons I've decided to create my own CA. Here is what I learned.

First things first

Lets get some context first.

@soarez
soarez / sz.pub
Last active August 29, 2015 13:57
My PGP key
-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: GnuPG v1.4.14 (GNU/Linux)
mQENBFMzIewBCACqQipnUvGBhU8XTaHVDiz3yP9BJOZPyWFhuRQx/W9bDQoM5ina
NI7k9bKUdtGZVLl3jbZR2fxh/BE8lp6qA0qXrZbVMqocbH9Ih19TSA/116klV9MK
nj758sbMHfvcQpGMaxM7il9iKzn71s39opslA2UHQ6R7cukGJTpFihwNo4EhoN5j
tnui6grJkoVQQ8Jsh4bjZOTmqUHfojvGicPzQ+C5hxeBEH9h7HlC4XVYQ+Na/dvN
hMBFiFJIAalAa4E3IYuHMbNqgxSdRznR3q9j2nx60+pzwNkJfk5vWLSkNTbSzz8f
YzAJP6unTeVuKveyXurPvuoNZW8oaWaejSafABEBAAG0Iklnb3IgU29hcmV6IDxp
Z29yc29hcmV6QGdtYWlsLmNvbT6JATgEEwECACIFAlMzIewCGwMGCwkIBwMCBhUI
@soarez
soarez / model.js
Last active August 29, 2015 14:00 — forked from tdantas/model.js
var mongoose = require('mongoose');
mongoose.connect('mongodb://localhost/test');
var Schema = mongoose.Schema;
var PageSchema = Schema({
title: { type: String, default: '', trim: true },
url: { type: String, default: '', trim: true },
thumbnails: {type: Schema.ObjectId, ref: 'Thumbnail'},
});
@soarez
soarez / check.js
Created June 10, 2014 15:54
Match elements from two arrays according to a specific criteria and obtain missing and extraneous elements.
var known = [ 1, 6, 3, 9, 4 ];
var presented = [ 2, 5, 7, 4, 9, 4 ];
check(known, presented, match, done);
function match(k, p) {
if( k !== p) return false;
console.log(k, 'matched with', p);
return true;
}
@soarez
soarez / main.rs
Created July 9, 2014 21:05
a non working tcp chat server in Rust
use std::io::{Listener, Acceptor};
use std::io::net::ip::{Ipv4Addr, SocketAddr};
use std::io::net::tcp::{TcpListener, TcpStream};
use std::io::BufferedStream;
struct Client {
id: u16,
stream: BufferedStream<TcpStream>
}
@soarez
soarez / dickson-storage.js
Created August 7, 2014 22:50
Dickson storage
(function() {
var ds = window.dicksonStorage = { };
var data = getData();
var INTERVAL = 400;
setInterval(ianWorker, INTERVAL);
ds.clear = clear;
function clear() {