Skip to content

Instantly share code, notes, and snippets.

View dbonates's full-sized avatar
🏠
Working from home

Daniel Bonates dbonates

🏠
Working from home
View GitHub Profile
@dbonates
dbonates / gist:5374672
Created April 12, 2013 19:57
gitorious-unicorn.nginx - um exemplo
server {
listen 80;
server_name git.local;
rewrite ^(.*) https://git.local$1 permanent;
}
server {
listen 443;
ssl on;
@dbonates
dbonates / gist:5374802
Last active December 16, 2015 04:09
.bash_aliases for easy day job.
alias c='clear'
alias tarc='tar -zcvf'
alias tard='tar -zxvf'
alias vi='nano'
alias edit='nano'
alias update='apt-get update && apt-get upgrade'
alias nreload='sudo service nginx restart'
@dbonates
dbonates / gist:5374868
Last active December 16, 2015 04:09
HTTP Status/Response
402 Payment Required
200 OK
Standard response for successful HTTP requests. The actual response will depend on the request method used. In a GET request, the response will contain an entity corresponding to the requested resource. In a POST request the response will contain an entity describing or containing the result of the action.
204 No Content
The server successfully processed the request, but is not returning any content.
@dbonates
dbonates / gist:5374878
Last active December 16, 2015 04:08
Custom BASH PS1 for GIT users
# Reset
Color_Off="\[\033[0m\]" # Text Reset
# Regular Colors
Black="\[\033[0;30m\]" # Black
Red="\[\033[0;31m\]" # Red
Green="\[\033[0;32m\]" # Green
Yellow="\[\033[0;33m\]" # Yellow
Blue="\[\033[0;34m\]" # Blue
Purple="\[\033[0;35m\]" # Purple
@dbonates
dbonates / gist:5374916
Last active December 16, 2015 04:09
Load ViewController from storyboard
UIStoryboard *sb = self.storyboard;
LoginViewController *loginWindow = (LoginViewController *)[sb instantiateViewControllerWithIdentifier:@"LoginWindow"];
[self presentViewController:loginWindow animated:YES completion:nil];
@dbonates
dbonates / gist:5375018
Last active December 16, 2015 04:09
mySQL - General and usefull commands
# change root password (pass '' to remove password)
mysqladmin -u root -p'old_password' password 'new_password'
# Log with user bonates just using database database_name:
mysql -u bonates -p simple_cms_development
# create an user and give him all access to a table
GRANT ALL PRIVILEGES ON table_name.* to 'user_name'@'localhost' identified by 'user_password';
@dbonates
dbonates / install.sh
Last active December 16, 2015 04:09
setup linode vps
#!/bin/bash
##################################################
#
# Arquivos que devem estar neste diretório
#
# rm info.php.txt
# rm install.sh
# rm iptables_basic.txt
# rm jail.local.txt
# rm phpmyadmin-https-server.txt
@dbonates
dbonates / gist:5375250
Created April 12, 2013 21:25
nginx.HTTPS server
# HTTPS server
#
server {
listen 443;
server_name localhost;
root html;
index index.html index.htm;
ssl on;
@dbonates
dbonates / rails_on_lion.sh
Last active October 27, 2017 01:44
Ruby on Rails + rbenv + sqlite3 + mysql + postgresql on Mac
# install Command Line Tools for Xcode (*** if not yet!)
#Install Homebrew
$ ruby <(curl -fsSkL raw.github.com/mxcl/homebrew/go)
# Add Homebrews binary path to the front of the $PATH
$ echo "export PATH=/usr/local/sbin:$PATH" >> ~/.bash_profile
$ source ~/.bash_profile
# checar instalação do homebrew e possíveis pendências:
@dbonates
dbonates / linode_local_prepare.sh
Last active December 16, 2015 13:28
public keys for access without login prompt
#TODO: Adicionar o arquivo com o script local, que deve ser executado antes deste.
echo "remote ip:"
read TARGETIP
# generating keys
ssh-keygen -q -t rsa -f ~/.ssh/id_rsa -N ""
# sending to remote server (as root)
scp ~/.ssh/id_rsa.pub root@$TARGETIP: