Skip to content

Instantly share code, notes, and snippets.

View dfasolin's full-sized avatar
🌚
Working from moon

Danilo Salmazio dfasolin

🌚
Working from moon
View GitHub Profile
@dfasolin
dfasolin / .aliases_bash
Created January 11, 2011 00:35
Bash profile for RVM and little more...
#-------------------------------------------------------------
# Source global definitions (if any)
#-------------------------------------------------------------
if [ -f /etc/bashrc ]; then
. /etc/bashrc # --> Read /etc/bashrc, if present.
fi
#-------------------------------------------------------------
# Automatic setting of $DISPLAY (if not set already).
@dfasolin
dfasolin / spool.sql
Created May 31, 2011 20:41
Exemplo de Spool no Oracle
set linesize 1000
set pagesize 0
set trimspool on
set feedback off
set time off
set timing off
set echo off
select 'Inicio: ' || to_char(sysdate,'HH24:MI:SS') from dual;
@dfasolin
dfasolin / gist:1055430
Created June 30, 2011 01:15
Installing MySQL2 gem on OSX 10.6
Uninstall your MySQL using the commands below
---------
sudo rm /usr/local/mysql
sudo rm -rf /usr/local/mysql*
sudo rm -rf /Library/StartupItems/MySQLCOM
sudo rm -rf /Library/PreferencePanes/My*
edit /etc/hostconfig and remove the line MYSQLCOM=-YES-
sudo rm -rf /Library/Receipts/mysql*
sudo rm -rf /Library/Receipts/MySQL*
@dfasolin
dfasolin / gist:d32236134e8ff5a85c8c
Last active August 29, 2015 14:01
Authenticated proxy in Windows command prompt
Use proxycfg -u to get the proxy informations
set http_proxy=http://username:[email protected]:port
@dfasolin
dfasolin / gist:4e73c159d0d73538ff06
Created May 26, 2014 01:25
Login and Create Database in Postgres
# su - postgres
$ createdb mydb
$ psql -s mydb
# create user someuser password 'somepassword';
# GRANT ALL PRIVILEGES ON DATABASE mydb TO someuser;
@dfasolin
dfasolin / gist:b1565805d1c67c6f4140
Last active August 29, 2015 14:01
Configure Proxy Settings for the Linux
Configure the proxy settings in the .bashrc
If you want set the proxy for all the users you can do it in the system wide .bashrc file.
sudo vi /etc/bash.bashrc
#proxy settings
export http_proxy=http://DOMAIN\USERNAME:PASSWORD@SERVER:PORT/
export ftp_proxy=http://DOMAIN\USERNAME:PASSWORD@SERVER:PORT/
Additionally if you want APT to use a proxy server you can configure it in the /etc/apt/apt.conf configuration file.
sudo vi /etc/apt/apt.conf
@dfasolin
dfasolin / update-hosts.sh
Last active January 8, 2016 09:24
Automatically update local hosts file with hosts-file.net
#!/usr/bin/env sh
# Filename: update-hosts.sh
# Authors: George Lesica <[email protected]>
# Danilo Fasolin Salmazio <[email protected]>
# Description: Replaces the HOSTS file with a customized version (hosts-file.net) that blocks
# domains that serve ads and malicious software, creating a backup of the old
# file.
# Improvements: Add the partial file, a /etc/hosts_dev with some development hosts and creates
# a logfile
@dfasolin
dfasolin / gist:97de0713ec65ab5c5fb8
Last active August 29, 2015 14:02
Create a Rails Project from Zero
Get RVM and configure it
New - $ curl -sSL https://get.rvm.io | bash -s stable
Existent - $ rvm get stable
$ rvm requirements
Mac - $ brew install libyaml
Linux - $ apt-get install libyaml-dev
Mac - $ rvm install 2.0.0 --with-openssl-dir=$HOME/.rvm/opt/openssl
Linux - $ rvm install 2.0.0 --with-openssl-dir=$HOME/.rvm/usr
@dfasolin
dfasolin / gist:d3a2628b87da4776e2ed
Created January 2, 2015 19:27
Criando um ambiente RoR no Cloud9
# Instalando o Ruby no RVM
rvm install 2.0.0-p451
# Criando uma gemset e instalando o Rails
rvm gemset create rails_4_0_5
rvm 2.0.0-p451@gastos_rails_4_0_5 #usando a gemset com a versão do ruby instalada
gem install rails -v 4.0.5
# Verificando se tudo foi ok
ruby -v
@dfasolin
dfasolin / gist:97ea83c6c27b949d70b0b1252e533a1e
Created December 13, 2016 21:36
Customizing your shell prompt
Customizing your shell prompt
Shell prompts are extremely customizable. You can customize them in two ways: (1) by using command characters that print out special things and (2) by using colors. Also, customizing the prompt is different in different shells; I'm going to cover tcsh and zsh here. bash is the other popular shell, but I think it sucks, and I never use it, so I'm not going to waste any time on it.
tcsh
zsh
tcsh
I'll start with tcsh, since it's the default BSD and Mac OS X shell. Here's a very simple prompt: