Skip to content

Instantly share code, notes, and snippets.

@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 / 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 / ca.md
Last active May 3, 2024 00:04
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 / 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 / .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 / 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 / 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 / answer.js
Created October 28, 2012 20:14 — forked from tdantas/question.js
programming async trick.
//Question:
// Environment: NodeJS
// Lets suppose that you have a collection of items, and your function must persist all items using the
//database.insert(item, callback ) function. When you finish the task, you should call the callback function.
// If one item raise a error, the callback(err) must be called and never call the callback anymore.
function noop() {}
@soarez
soarez / cb6d084d356da501bbdcfb6d0ac90180e011a9e2_test_results.txt
Created October 21, 2012 11:35
Test results for joyent/node cb6d084
This file has been truncated, but you can view the full file.
python tools/gyp_node -f make
make -C out BUILDTYPE=Release V=1
cc '-D_DARWIN_USE_64_BIT_INODE=1' '-D_LARGEFILE_SOURCE' '-D_FILE_OFFSET_BITS=64' '-D_GNU_SOURCE' '-DHAVE_CONFIG_H' '-DCARES_STATICLIB' -I../deps/cares/include -I../deps/cares/src -I../deps/cares/config/darwin -Os -gdwarf-2 -mmacosx-version-min=10.5 -arch x86_64 -Wall -Wendif-labels -W -Wno-unused-parameter -fno-strict-aliasing -MMD -MF /Users/Soarez/src/joyent/node/out/Release/.deps//Users/Soarez/src/joyent/node/out/Release/obj.target/cares/deps/cares/src/ares_cancel.o.d.raw -c -o /Users/Soarez/src/joyent/node/out/Release/obj.target/cares/deps/cares/src/ares_cancel.o ../deps/cares/src/ares_cancel.c
cc '-D_DARWIN_USE_64_BIT_INODE=1' '-D_LARGEFILE_SOURCE' '-D_FILE_OFFSET_BITS=64' '-D_GNU_SOURCE' '-DHAVE_CONFIG_H' '-DCARES_STATICLIB' -I../deps/cares/include -I../deps/cares/src -I../deps/cares/config/darwin -Os -gdwarf-2 -mmacosx-version-min=10.5 -arch x86_64 -Wall -Wendif-labels -W -Wno-unused-parameter -fno-strict-aliasing -MMD -MF /Users/So
@soarez
soarez / 4d74a874da3e4fbcb8ac9dc4da56abb9bcd16935_test_results.txt
Created October 21, 2012 11:04
Test results for Soarez/node 4d74a87
make -C out BUILDTYPE=Release V=1
LD_LIBRARY_PATH=/Users/Soarez/src/joyent/node/out/Release/lib.host:/Users/Soarez/src/joyent/node/out/Release/lib.target:$LD_LIBRARY_PATH; export LD_LIBRARY_PATH; cd ../.; mkdir -p /Users/Soarez/src/joyent/node/out/Release/obj/gen; python tools/js2c.py "/Users/Soarez/src/joyent/node/out/Release/obj/gen/node_natives.h" src/node.js lib/_debugger.js lib/_linklist.js lib/assert.js lib/buffer.js lib/buffer_ieee754.js lib/child_process.js lib/console.js lib/constants.js lib/crypto.js lib/cluster.js lib/dgram.js lib/dns.js lib/domain.js lib/events.js lib/freelist.js lib/fs.js lib/http.js lib/https.js lib/module.js lib/net.js lib/os.js lib/path.js lib/punycode.js lib/querystring.js lib/readline.js lib/repl.js lib/stream.js lib/string_decoder.js lib/sys.js lib/timers.js lib/tls.js lib/tty.js lib/url.js lib/util.js lib/vm.js lib/zlib.js ./config.gypi src/macros.py
c++ '-D_LARGEFILE_SOURCE' '-D_FILE_OFFSET_BITS=64' '-D_DARWIN_USE_64_BIT_INODE=1' '-DNODE_WANT_INTERNALS=1' '-DARCH="x64