Skip to content

Instantly share code, notes, and snippets.

View giubueno's full-sized avatar

Giulliano Bueno giubueno

View GitHub Profile
{
"name": "myApp",
"scripts": {
"git:config": "git config --global url.\"https://${GITHUB_TOKEN}:[email protected]\".insteadOf [email protected]:blacklane && git config --global --add url.\"https://${GITHUB_TOKEN}:[email protected]\".insteadOf ssh://[email protected]",
"preinstall": "if [ -n \"$GITHUB_TOKEN\" ]; then npm git:config; fi",
}
"devDependencies": {
// a bunch of private dependencies
}
}
@giubueno
giubueno / docker
Last active April 9, 2019 14:14
Docker commands
# Complete clean up
docker ps -a | grep -v CONTAINER | awk '{print $1}' | xargs docker stop
docker ps -a | grep -v CONTAINER | awk '{print $1}' | xargs docker rm
docker images | grep -v 'IMAGE ID' | awk '{print $3}' | xargs docker rmi
# Remove all stopped containers.
docker rm $(docker ps -a -q)
# Remove all untagged images
docker rmi $(docker images | grep "^<none>" | awk "{print $3}")
import { fromJS } from 'immutable';
import sjcl from 'sjcl';
/*
* This function gets the encrypted object from the session storage,
* decrypt it and set the state back into the store.
*/
export function recoverStateFromSession(key, state, password) {
const encryptedData = JSON.parse(sessionStorage.getItem(key));
if(!encryptedData) { return state; }
@giubueno
giubueno / nginx.conf
Created November 24, 2017 10:22 — forked from Stanback/nginx.conf
Example Nginx configuration for adding cross-origin resource sharing (CORS) support to reverse proxied APIs
#
# CORS header support
#
# One way to use this is by placing it into a file called "cors_support"
# under your Nginx configuration directory and placing the following
# statement inside your **location** block(s):
#
# include cors_support;
#
# As of Nginx 1.7.5, add_header supports an "always" parameter which
@giubueno
giubueno / Install-Docker-on-Linux-Mint.sh
Created February 20, 2017 08:56 — forked from sirkkalap/Install-Docker-on-Linux-Mint.sh
Install Docker on Linux Mint
##########################################
# To run:
# curl -sSL https://gist.githubusercontent.com/sirkkalap/e87cd580a47b180a7d32/raw/d9c9ebae4f5cf64eed4676e8aedac265b5a51bfa/Install-Docker-on-Linux-Mint.sh | bash -x
##########################################
# Check that HTTPS transport is available to APT
if [ ! -e /usr/lib/apt/methods/https ]; then
sudo apt-get update
sudo apt-get install -y apt-transport-https
fi
@giubueno
giubueno / tmux-cheatsheet.markdown
Created April 14, 2016 10:39 — forked from MohamedAlaa/tmux-cheatsheet.markdown
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
package spullara.util.concurrent;
import org.junit.BeforeClass;
import org.junit.Test;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.concurrent.*;
import java.util.concurrent.atomic.AtomicBoolean;
@giubueno
giubueno / database.yml.example mysql2
Created December 1, 2015 23:43 — forked from erichurst/database.yml.example mysql2
Rails 3 database.yml examples
# MySQL. Versions 4.1 and 5.0 are recommended.
#
# Install the MySQL driver:
# gem install mysql2
#
# And be sure to use new-style password hashing:
# http://dev.mysql.com/doc/refman/5.0/en/old-client.html
development:
adapter: mysql2
encoding: utf8
#! /bin/sh
### BEGIN INIT INFO
# Provides: redis-server
# Required-Start: $syslog
# Required-Stop: $syslog
# Should-Start: $local_fs
# Should-Stop: $local_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: redis-server - Persistent key-value db
@giubueno
giubueno / 0-readme.md
Last active August 29, 2015 13:56 — forked from crmaxx/0-readme.md

Amazon AWS EC2 production for Ruby on Rails

Prepare cloud

Speed up ssh login

echo 'UseDNS no # if slow connection' >> /etc/ssh/sshd_config
echo 'PrintMotd yes # if you need motd messages' >> /etc/ssh/sshd_config

From /etc/pam.d/login && /etc/pam.d/sshd delete all strings included

session optional pam_motd.so