Skip to content

Instantly share code, notes, and snippets.

View tsolar's full-sized avatar

Tomás Solar Castro tsolar

  • Santiago, Chile
View GitHub Profile
@tsolar
tsolar / pg_dump_restore.sh
Created February 23, 2016 19:29
dump & restore postgres db
#!/bin/bash
pg_dump -i -h <hostname> -p 5432 -U <user> -F c -b -v -f /tmp/<filename>.sql <database_name>
pg_restore -i -h <local_hostname> -p 5432 -U <user> -d <database_name> -v /tmp/<filename>.sql
@tsolar
tsolar / fonts.conf
Created February 23, 2016 21:59
arial font
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
<match target="font" >
<edit mode="assign" name="rgba" >
<const>rgb</const>
</edit>
</match>
<match target="font">
<edit mode="assign" name="lcdfilter">
@tsolar
tsolar / rename-branch.sh
Created May 10, 2016 18:08 — forked from stuart11n/gist:9628955
rename git branch locally and remotely
git branch -m old_branch new_branch # Rename branch locally
git push origin :old_branch # Delete the old branch
git push --set-upstream origin new_branch # Push the new branch, set local branch to track the new remote
@tsolar
tsolar / active_for_authentication.rb
Last active June 9, 2016 16:56
Permitir sólo a algunos emails acceder a la app en Rails
# from http://www.rubydoc.info/github/plataformatec/devise/master/Devise/Models/Authenticatable
# Poner en el modelo User
def special_condition_is_valid?
permitted_emails = [
# Poner acá los emails permitidos para acceder
"email1@example.com",
"email2@example.com"
]
if permitted_emails.include?(self.email)
@tsolar
tsolar / .zshrc
Created June 11, 2016 04:21
config de zsh usando oh-my-zsh
# Path to your oh-my-zsh installation.
export ZSH=/home/tom/.oh-my-zsh
# Set name of the theme to load.
# Look in ~/.oh-my-zsh/themes/
# Optionally, if you set this to "random", it'll load a random theme each
# time that oh-my-zsh is loaded.
#ZSH_THEME="robbyrussell"
ZSH_THEME="amuse"
@tsolar
tsolar / package_install_libreadline6_libreadline6-dev.log
Created December 7, 2016 03:15
rvm libreadline error debian sid
$ cat /home/tom/.rvm/log/1481080358_ruby-2.3.3/package_install_libreadline6_libreadline6-dev.log
[2016-12-07 00:12:48] requirements_debian_libs_install
requirements_debian_libs_install ()
{
__rvm_try_sudo apt-get --no-install-recommends --yes install "$@" || return $?
}
current path: /home/tom
GEM_HOME=/home/tom/.rvm/gems/ruby-2.2.2
GEM_PATH=/home/tom/.rvm/gems/ruby-2.2.2:/home/tom/.rvm/gems/ruby-2.2.2@global
PATH=/home/tom/.rvm/gems/ruby-2.2.2/bin:/home/tom/.rvm/gems/ruby-2.2.2@global/bin:/home/tom/.rvm/rubies/ruby-2.2.2/bin:/home/tom/.nvm/v0.10.32/bin:./node_modules/.bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games:/home/tom/opt/bin:/home/tom/.composer/vendor/bin:/home/tom/.rvm/bin:/home/tom/.rvm/bin:/home/tom/.rvm/bin:/home/tom/.rvm/bin
@tsolar
tsolar / timezone_select.rb
Last active July 24, 2023 12:28
time zone select rails, with canonical name in value
form.select :timezone, ActiveSupport::TimeZone.all.map{|tz| [ "(GMT#{tz.formatted_offset}) #{tz.name}", tz.tzinfo.canonical_zone.name] }, {prompt: "Elija zona horaria"}, class: 'form-control'
@tsolar
tsolar / Postman.desktop
Created June 1, 2017 16:27 — forked from pierremonico/Postman.desktop
Install Postman
[Desktop Entry]
Encoding=UTF-8
Name=Postman
Exec=postman
Icon=/opt/Postman/resources/app/assets/icon.png
Terminal=false
Type=Application
Categories=Development;
@tsolar
tsolar / .powerline-shell.json
Last active December 4, 2017 14:04
powershell config
{
"segments": [
"time",
"ruby_version",
"virtual_env",
"username",
"hostname",
"ssh",
"cwd",
"git",
@tsolar
tsolar / Vagrantfile
Created May 4, 2018 03:40
Vagrantfile to run rails projects
# -*- mode: ruby -*-
# vi: set ft=ruby :
# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure("2") do |config|
# The most common configuration options are documented and commented below.
# For a complete reference, please see the online documentation at