Skip to content

Instantly share code, notes, and snippets.

View gbpereira's full-sized avatar

Guilherme Pereira gbpereira

  • São Paulo - Brazil
  • 16:33 (UTC -03:00)
View GitHub Profile
@gbpereira
gbpereira / gnome-terminal-profiles.md
Created September 3, 2023 02:05 — forked from fdaciuk/gnome-terminal-profiles.md
Export / Import Gnome Terminal Profiles

Export Gnome Terminal Profile

List profiles

dconf dump /org/gnome/terminal/legacy/profiles:/

Determine the terminal profile string for the profile you will need. This is the terminal profile that I will export:

@gbpereira
gbpereira / .gemrc
Last active July 26, 2020 22:57
Guide configurarion and common commands/configurations to work with ruby environment behind a proxy
http_proxy: <proxy:port>
@gbpereira
gbpereira / .vimrc
Created February 15, 2018 20:18 — forked from luizhpcamargo/.vimrc
Vim configuration
set nocompatible " be iMproved, required
filetype off " required
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" alternatively, pass a path where Vundle should install plugins
"call vundle#begin('~/some/path/here')
" let Vundle manage Vundle, required
Plugin 'VundleVim/Vundle.vim'
#!/usr/bin/env ruby
require 'find'
dir = ARGV[0]
input = File.open(ARGV[1]).read
# output = File.new((ARGV[2] || 'output'), 'w+')
# puts "searching for #{input.lines.count} files starting at #{dir}"
@gbpereira
gbpereira / git-commands.md
Last active March 2, 2018 13:06
git commands to undo changes

Reverting batch commits

git checkout -b <new_branch> <ref_branch>
git reset <previous_commit_hash>
git add -p
git clean -f
git reset --hard

Amending commit with open Pull request

@gbpereira
gbpereira / commit-msg.md
Last active May 3, 2023 15:18
Git hooks
#!/usr/bin/env bash
#
# usage:
#   # just place it to the git repository hooks dir, named as "commit-msg"
#   # with execution permission (+x)
#   $ cp commit-msg <repo_path>/.git/hooks/
#   $ chmod +x <repo_path>/.git.hooks/commit-msg
#
pattern="^((\[SB)-[0-9]{4}\]|(\[(HOTFIX|Hotfix|hotfix)\]))\s\w+"
@gbpereira
gbpereira / capybara.rb
Last active May 17, 2019 19:49
Useful commands to work with capybara and rails
# trigger event
def trigger_event(jquery_element, event)
page.execute_script("$('#{jquery_element}').trigger('#{event}')")
end
# write html page to file
File.write('output.html', page.html)
#!/bin/bash
LOCAL_PORT=8080
REMOTE_SERVER=destination.server
REMOTE_USER=user
ssh -D $LOCAL_PORT -f -C -q -N $REMOTE_USER@$REMOTE_SERVER
@gbpereira
gbpereira / _form.html.erb
Last active May 15, 2017 21:39
Comandos para auxilio do minicurso de introdução ao Ruby on Rails
<%= form_for(@product) do |f| %>
<% if @product.errors.any? %>
<div id="error_explanation">
<h2><%= pluralize(@product.errors.count, "error") %> prohibited this product from being saved:</h2>
<ul>
<% @product.errors.full_messages.each do |message| %>
<li><%= message %></li>
<% end %>
</ul>
#!/bin/bash
GEMSET_NAME=seccomp
RAILS_VERSION=4.2.3
RUBY_VERSION=2.2.3
while [ $# -gt 0 ]; do
case "$1" in