Skip to content

Instantly share code, notes, and snippets.

View vovimayhem's full-sized avatar
🎸
Taking names and kicking ass

Roberto Quintanilla vovimayhem

🎸
Taking names and kicking ass
View GitHub Profile
@vovimayhem
vovimayhem / tidy_bytes_in_request.rb
Created April 21, 2015 20:27
TidyBytesInRequest Rack Middleware
require "active_support/core_ext/string/multibyte"
class TidyBytesInRequest
TIDY_BYTES_ENV_KEYS = %w(
HTTP_USER_AGENT
HTTP_REFERER
PATH_INFO
QUERY_STRING
REQUEST_PATH
@vovimayhem
vovimayhem / something.sh
Created April 30, 2015 19:50
Truncate the fuck those docker logs!
#
function clearDockerContainerLog() {
_dirname=$(sudo ls /var/lib/docker/containers/ | grep $1)
sudo sh -c "cat /dev/null > /var/lib/docker/containers/$_dirname/$_dirname-json.log"
_dirname=""
}
alias clean-docker-log="clearDockerContainerLog"
sudo lspci
00:00.0 Host bridge: Intel Corporation 2nd Generation Core Processor Family DRAM Controller (rev 09)
00:02.0 VGA compatible controller: Intel Corporation 2nd Generation Core Processor Family Integrated Graphics Controller (rev 09)
00:16.0 Communication controller: Intel Corporation 6 Series/C200 Series Chipset Family MEI Controller #1 (rev 04)
00:1a.0 USB controller: Intel Corporation 6 Series/C200 Series Chipset Family USB Enhanced Host Controller #2 (rev 04)
00:1b.0 Audio device: Intel Corporation 6 Series/C200 Series Chipset Family High Definition Audio Controller (rev 04)
00:1c.0 PCI bridge: Intel Corporation 6 Series/C200 Series Chipset Family PCI Express Root Port 1 (rev b4)
00:1c.1 PCI bridge: Intel Corporation 6 Series/C200 Series Chipset Family PCI Express Root Port 2 (rev b4)
00:1c.2 PCI bridge: Intel Corporation 6 Series/C200 Series Chipset Family PCI Express Root Port 3 (rev b4)
@vovimayhem
vovimayhem / rorod.sh
Last active August 30, 2015 20:38
My first try to a web-based shell script
#! /bin/bash
DIR_ON_HOST=${PWD}
APP_NAME=${PWD##*/}
echo $DIR_ON_HOST;
echo $APP_NAME;
docker run --rm -v $(pwd):/app vovimayhem/app-dev:mri-2.2.3 sh -c "gem install rails --no-rdoc --no-ri && rails new ."
@vovimayhem
vovimayhem / dev-entrypoint.sh
Last active September 29, 2015 16:32
docker rails starter
#! /bin/bash
# Include the app's bin directory to $PATH:
export PATH=/usr/src/app/bin:$PATH
set -e
# The container was invoked without any particular command... we must check if is a new development environment, install whatever we need to install, and then run the default command:
if [ -z "$1" ]; then
@vovimayhem
vovimayhem / .gitignore
Last active November 10, 2015 00:26
Sample Docer+Phoenix project
# App artifacts
/_build
/db
/deps
/*.ez
# Generate on crash by the VM
erl_crash.dump
# The config/prod.secret.exs file by default contains sensitive
@vovimayhem
vovimayhem / gist:4448604
Created January 3, 2013 23:47
Basic 2-hop tunneling... I keep forgetting this...
# ssh -N gateway_ssh_server -L local_port:target_server:target_server_port
@vovimayhem
vovimayhem / CreateRailsAppOrEngine.md
Last active December 10, 2015 20:58
Crear app/engine de Rails usando MySQL y RSpec.

New Rails App

At Terminal/Command:

  • The -T option tells rails not to include Test::Unit
  • The --database=mysql tells rails to include Mysql gem and configs
  • The --skip-bundle is self explanatory... rails new myapp -T --skip-bundle --database=mysql

in Gemfile:

@vovimayhem
vovimayhem / README.md
Last active December 31, 2015 14:48
System Wide Chruby

System Wide Chruby

@vovimayhem
vovimayhem / env.sh
Last active September 12, 2016 17:27
A convenient way to set the env vars to configure a Docker Client access to a secure remote Docker Engine
# Make sure you have this file in a folder along with your certs.
# Also, keep in mind that the filenames must follow the convention:
# - Certificate Authority Certificate must be named "ca.pem"
# - Client Certificate must be named "cert.pem"
# - Client Key must be named "key.pem"
#
# Run with `source env.sh`
export DOCKER_TLS_VERIFY=1
export DOCKER_CERT_PATH="$(pwd)"
export DOCKER_HOST=tcp://your-host-name:2376