Skip to content

Instantly share code, notes, and snippets.

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

Francisco Martins franciscomxs

🏠
Working from home
View GitHub Profile
@franciscomxs
franciscomxs / ubuntu_steps.sh
Created July 5, 2012 17:06 — forked from johnrees/_ubuntu_steps.sh
Standard Rails 3.* setup for Ubuntu 10.04 LTS 32
# As root user
# Update the OS
sudo apt-get update
sudo apt-get upgrade
sudo apt-get dist-upgrade
# Setup Hostname & TimeZone
echo "{{HOSTNAME}}" > /etc/hostname
hostname -F /etc/hostname
dpkg-reconfigure tzdata
@franciscomxs
franciscomxs / rails-ubuntu12.04.sh
Last active October 9, 2015 17:58
Instalação do Rails em redes restritas no Ubuntu 12.04
#!/usr/bin/env bash
sudo apt-get install build-essential zlib1g-dev curl git-core libgeoip-dev imagemagick vim libxslt-dev mysql-server mysql-client libmysql-ruby libmysqlclient-dev -y
cd
git clone https://github.com/sstephenson/rbenv.git .rbenv
cd .rbenv
mkdir plugins
cd plugins
git clone https://github.com/sstephenson/rbenv-vars.git
git clone https://github.com/sstephenson/ruby-build.git
git clone https://github.com/fesplugas/rbenv-installer.git
#!/bin/sh
cd /home/user/app/ || exit
unset GIT_DIR
git reset --hard
git pull origin master -f
bundle install --gemfile "Gemfile" --path "bundle" --deployment --without development test
bundle exec rake db:migrate RAILS_ENV=production
bundle exec rake assets:precompile
touch tmp/restart.txt
@franciscomxs
franciscomxs / developer.md
Last active August 29, 2015 14:09
Teste developer

Teste ruby developer

Um balancete é um resumo contábil das movimentações financeiras da empresa.

Balancete

Um balancete tem 3 grupos: Ativo, Passivo e Contas de resultado. Neste teste vamos focar apenas nos dois primeiros.

Cada grupo (código de 1 digito) tem uma série de subgrupos (código de dois dígitos), cada subgrupo contém uma série de contas sintéticas (código de três digitos) e cada conta sintética contém várias contas analíticas (código de 4 dígitos).

require 'mina/bundler'
require 'mina/rails'
require 'mina/git'
require 'mina/rvm'
set :user, 'w2b'
set :forward_agent, true
set :domain, 'w2b.co'
set :port, '22'
@franciscomxs
franciscomxs / rename.rb
Last active September 13, 2015 04:42
Rename my animes and series to use Episode.Extension format
REGEX = /([0-9]{2,3}).*([\.mp4|\.mkv|.rmvb|.avi]{4,5})/
Dir['*'].each do |file_name|
if (match = REGEX.match(file_name)) && File.exist?(file_name)
new_name = "#{match[1]}#{match[2]}"
File.rename(file_name, new_name)
end
end
@franciscomxs
franciscomxs / MainActivity.java
Created December 15, 2015 17:28
Android - Binding Service to Activity
// ...
private MyService myService;
private boolean messengerBound = false;
@Override
protected void onStart() {
super.onStart();
Intent intent = new Intent(this, PlayerService.class);
bindService(intent, serviceConnection, Context.BIND_AUTO_CREATE);
pg_dump -U <username> -W -Fc <databasename> > <filename>.dump
scp -i ~/.ssh/cx_<id>_pkey <user>@<ip>:<filename>.dump <filename>.dump
pg_restore -c -U postgres -d <databasename> <filename>.dump
@franciscomxs
franciscomxs / bash
Created September 11, 2017 14:11
Modify specific commit
$ git rebase --interactive 'SHORT_SHA^'
# In the default editor, modify `pick` to `edit` in the line whose commit you want to modify.
# Make your changes and then commit them with the same message you had before:
$ git commit --all --amend --no-edit
$ git rebase --continue
@franciscomxs
franciscomxs / curl-format.txt
Created April 4, 2018 21:57
Curl - get request time
time_namelookup: %{time_namelookup}\n
time_connect: %{time_connect}\n
time_appconnect: %{time_appconnect}\n
time_pretransfer: %{time_pretransfer}\n
time_redirect: %{time_redirect}\n
time_starttransfer: %{time_starttransfer}\n
----------\n
time_total: %{time_total}\n