Skip to content

Instantly share code, notes, and snippets.

View gtramontina's full-sized avatar

Guilherme J. Tramontina gtramontina

View GitHub Profile
@m-radzikowski
m-radzikowski / script-template.sh
Last active November 15, 2024 11:25
Minimal safe Bash script template - see the article with full description: https://betterdev.blog/minimal-safe-bash-script-template/
#!/usr/bin/env bash
set -Eeuo pipefail
trap cleanup SIGINT SIGTERM ERR EXIT
script_dir=$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd -P)
usage() {
cat <<EOF
Usage: $(basename "${BASH_SOURCE[0]}") [-h] [-v] [-f] -p param_value arg1 [arg2...]
@lopezjurip
lopezjurip / 00000000000000_enable_uuid.rb
Created July 19, 2016 17:28
Rails 5 w/ Postgres: Use UUID instead of a numeric ID as primary keys
# db/migrate/00000000000000_enable_uuid.rb
class EnableUuid < ActiveRecord::Migration[5.0]
def change
execute 'create extension "uuid-ossp"'
enable_extension 'uuid-ossp'
end
end
@a0s
a0s / brew-cask-cleanup.rb
Last active November 5, 2019 14:14
Clean (move to trash) old brew cask versions
#!ruby
# Requirements:
# brew install trash
casks_path = '/opt/homebrew-cask/Caskroom'
class Version < Array
def initialize s
super(s.split('.').map { |e| e.to_i })
@MohamedAlaa
MohamedAlaa / tmux-cheatsheet.markdown
Last active November 15, 2024 09:51
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@klauswuestefeld
klauswuestefeld / gist:1103582
Created July 25, 2011 04:55
PrevaylerJr - "To serve the persistence needs of 99% of information systems in the world using 23 semicolons."
import java.io.*;
public class PrevaylerJr {
public static interface Command extends Serializable {
Object executeOn(Object system);
}