Skip to content

Instantly share code, notes, and snippets.

View geek's full-sized avatar
🏠
Working from home

Wyatt Preul geek

🏠
Working from home
View GitHub Profile
@geek
geek / gist:1068913
Created July 7, 2011 05:05
.vimrc on Ubuntu for node
set nocompatible
filetype off " required!
set rtp+=~/.vim/vundle.git/
call vundle#rc()
" My Bundles here:
"
" original repos on github
Bundle 'tpope/vim-fugitive'
@geek
geek / xprofile
Created August 30, 2012 15:35
Ubuntu add 1920x1080 resolution forever
~/.xprofile
xrandr --newmode "1920x1080_60.00" 173.00 1920 2048 2248 2576 1080 1083 1088 1120 -hsync +vsync
xrandr --addmode Virtual1 1920x1080_60.00
xrandr --output Virtual1 --mode 1920x1080_60.00
@geek
geek / .bashrc
Created November 27, 2012 18:13
Set path to node_modules bin
export PATH="$HOME/bin:$PATH"
##### NPM STUFF
# Checks that the child directory is a subdirectory of the parent
is_subdirectory() {
local child="$1"
local parent="$2"
if [[ "${child##${parent}}" != "$child" ]]; then
return 0
@geek
geek / install.md
Last active December 1, 2020 12:30
Installing and running SmartOS on OSX with VirtualBox
var ChildProcess = require('child_process');
setInterval(function () {
ChildProcess.exec('echo', function () {
console.log(Math.round(process.memoryUsage().rss / (1024 * 1024)) + 'M used');
});
}, 100);
var ChildProcess = require('child_process');
var maxMem = Math.round(process.memoryUsage().rss / (1024 * 1024)) * 2;
console.time('leak');
setInterval(function () {
ChildProcess.exec('echo', function () {
var mem = Math.round(process.memoryUsage().rss / (1024 * 1024));
var Http = require('http');
Http.createServer(function (req, res) {
res.writeHead(200, {'Content-Type': 'text/plain'});
res.end('Hello World\n');
Http.request({ host: 'localhost', port: 9000}).end();
}).listen(8000);
// Middle tier (similulates inbound and outbound traffic)
// Load modules
var Http = require('http');
setInterval(function () {
Http.request({ port: 9000 }).end();
}, 0);
var Http = require('http');
setInterval(function () {
Http.get('http://localhost:9000/', function(res) {
console.log("Got response: " + res.statusCode);
}).on('error', function(e) {
console.log("Got error: " + e.message);
});
}, 5);
@geek
geek / mem.js
Created June 24, 2013 17:34
Here is an example of code that grows the memory for a while then eventually stabilizes
var ChildProcess = require('child_process');
var maxMem = Math.round(process.memoryUsage().rss / (1024 * 1024)) * 2;
setInterval(function () {
ChildProcess.exec('echo', function () {
var mem = Math.round(process.memoryUsage().rss / (1024 * 1024));
console.log(mem + 'M used');