Skip to content

Instantly share code, notes, and snippets.

View dgoguerra's full-sized avatar

Diego Guerra dgoguerra

View GitHub Profile
@dgoguerra
dgoguerra / avoid-sudo-default-requiretty.sh
Last active April 18, 2016 17:31
Avoid 'sudo: sorry, you must have a tty to run sudo' error on Amazon Linux
#!/bin/bash
SUDOERS_FILE=/etc/sudoers.d/999-vagrant-cloud-init-requiretty
echo 'Defaults:ec2-user !requiretty' > $SUDOERS_FILE
echo 'Defaults:root !requiretty' >> $SUDOERS_FILE
chmod 440 $SUDOERS_FILE
@dgoguerra
dgoguerra / submodule.md
Last active March 9, 2016 17:14
git submodules

Create a submodule:

git submodule add [email protected]:user/repo.git path/to/module

To change the commit a submodule points to, just move to the commit inside it:

cd path/to/module
@dgoguerra
dgoguerra / configure-dns.md
Last active February 21, 2016 18:05
Configure a custom DNS on Ubuntu 12.04

Add the folllowing lines on /etc/network/interfaces for the appropriate interface (e.g. wlan0).

auto wlan0
dns-nameservers X.X.X.X Y.Y.Y.Y

And run:

var readline = require('readline');
var rl = readline.createInterface({
input: proc.stdout,
terminal: false
});
rl.on('line', function(line) {
console.log('new line: '+line);
});

:w !sudo tee %

@dgoguerra
dgoguerra / install-nodejs.sh
Created January 11, 2016 12:45 — forked from TooTallNate/install-nodejs.sh
Simple Node.js installation script using the precompiled binary tarballs
#!/bin/sh
VERSION=0.8.6
PLATFORM=darwin
ARCH=x64
PREFIX="$HOME/node-v$VERSION-$PLATFORM-$ARCH"
mkdir -p "$PREFIX" && \
curl http://nodejs.org/dist/v$VERSION/node-v$VERSION-$PLATFORM-$ARCH.tar.gz \
| tar xzvf - --strip-components=1 -C "$PREFIX"
@dgoguerra
dgoguerra / oh-my-zsh-install.md
Last active December 16, 2015 22:22
oh-my-zsh installation http://ohmyz.sh/

Installation:

sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"

Once installed, to toggle betwen zsh and bash (default shell in OSX) without uninstalling oh-my-zsh (uninstall_oh_my_zsh), just run the appropriate:

chsh -s /bin/zsh
chsh -s /bin/bash
@dgoguerra
dgoguerra / ubuntu-compass-ruby
Last active December 10, 2017 03:17 — forked from stephanetimmermans/ubuntu-compass-ruby
Install Compass+Ruby on Ubuntu 14.04
#https://gorails.com/setup/ubuntu/14.04
sudo apt-get update
sudo apt-get install -y git-core curl zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev libcurl4-openssl-dev python-software-properties
sudo apt-get install -y libgdbm-dev libncurses5-dev automake libtool bison libffi-dev
curl -L https://get.rvm.io | bash -s stable
source ~/.rvm/scripts/rvm
echo "source ~/.rvm/scripts/rvm" >> ~/.bashrc
rvm install 2.3.1
rvm use 2.3.1 --default
@dgoguerra
dgoguerra / osx-quicklook.sh
Last active December 4, 2016 18:26
Open all plain text files with Quick Look, and enable text selection in them
# See: https://coderwall.com/p/dlithw/use-osx-finder-quicklook-to-preview-all-plain-text-files
# download last release from https://github.com/whomwah/qlstephen/downloads
wget https://github.com/downloads/whomwah/qlstephen/QLStephen.qlgenerator.zip
# copy the plugin to /Library/QuickLook/
unzip QLStephen.qlgenerator.zip
sudo mv QLStephen.qlgenerator /Library/QuickLook/
# enable text selection
@dgoguerra
dgoguerra / proxy-toggle.sh
Last active August 6, 2024 00:10 — forked from mnewt/proxy-toggle.sh
Script to toggle Mac OS X SOCKS proxy, and setup a SOCKS server with SSH
#!/bin/sh
PROXY_INTERFACE="Wi-Fi"
PROXY_HOST=127.0.0.1
PROXY_PORT=1080
# A host where ssh can login without interaction, with a key-based
# authentication.
SOCKS_PROC_USER="username"
SOCKS_PROC_HOST="example.com"