Skip to content

Instantly share code, notes, and snippets.

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

Alfonso alfonsodev

🏠
Working from home
View GitHub Profile
@alfonsodev
alfonsodev / app-ports.md
Created March 20, 2013 15:14
check applications and ports linux / unix

-Unix sockstat -l

-Linux netstat -lnp

@alfonsodev
alfonsodev / openssl-keys-gen-ssh-local.md
Created August 6, 2013 14:38
generate key to test https express.js application on local

Command line

  openssl genrsa -out hacksparrow-key.pem 1024 
  openssl req -new -key hacksparrow-key.pem -out certrequest.csr
  openssl x509 -req -in certrequest.csr -signkey hacksparrow-key.pem -out hacksparrow-cert.pem

Express application

 var options = {
@alfonsodev
alfonsodev / gist:6816186
Created October 3, 2013 20:00
zip and encrypt files and decrypt
tar -zcvf mifolder.tar.gz mifolder/ | openssl enc -aes-256-cbc -e > mifolder.tar.gz.enc
openssl aes-256-cbc -d -in mifolder.tar.gz.enc -out mifolder.tar.gz
@alfonsodev
alfonsodev / ncurses-detect-keychar.js
Last active December 26, 2015 19:09
ncurses snippet for nodejs
//first do a 'npm install ncurses'
var nc = require('ncurses'),
widgets = require('./node_modules/ncurses/lib/widgets');
var win = new nc.Window();
nc.showCursor = false;
widgets.MessageBox('Do you want to continue', { buttons: ['OK', 'Cancel'], pos: 'center'}, function(choice) {
win.refresh();
if(choice == 'OK') {
module.exports = function(callback) {
require('child_process').exec('./cursor-position.sh', function(error, stdout, stderr){
callback(error, JSON.parse(stdout));
});
}
# References:
# http://blog.mixu.net/2011/08/13/nginx-websockets-ssl-and-socket-io-deployment/
# http://blog.exceliance.fr/2012/09/10/how-to-get-ssl-with-haproxy-getting-rid-of-stunnel-stud-nginx-or-pound/
#
global
nbproc 2
maxconn 16384
defaults
@alfonsodev
alfonsodev / test.js
Last active January 2, 2016 01:59
example of chrome-driver web fixed
var webdriver = require('selenium-webdriver');
var flow = webdriver.promise.controlFlow();
var driver = new webdriver.Builder().
withCapabilities(webdriver.Capabilities.chrome()).
build();
driver.get('http://www.google.com');
driver.findElement(webdriver.By.name('q')).sendKeys('webdriver');
driver.findElement(webdriver.By.name('btnG')).click();
@alfonsodev
alfonsodev / Makefile
Created January 12, 2014 00:07
example Makefile of a Node.js project to create code coverage reports mocha, instanbul, coveralls
#!/bin/bash
MOCHA=node_modules/.bin/mocha
ISTANBUL=node_modules/.bin/istanbul
COVERALLS=node_modules/coveralls/bin/coveralls.js
# test files must start with "test*.js"
TESTS=$(shell find test/ -name "test*.js" -not -path "*service/*")
SERVICETEST=$(shell find test/service/ -name "test*.js" )
test:
$(MOCHA) -R spec $(TESTS)
test-service:

Docker Cheat Sheet

Why

Why Should I Care (For Developers)

"Docker interests me because it allows simple environment isolation and repeatability. I can create a run-time environment once, package it up, then run it again on any other machine. Furthermore, everything that runs in that environment is isolated from the underlying host (much like a virtual machine). And best of all, everything is fast and simple."

TL;DR, I just want a dev environment