Skip to content

Instantly share code, notes, and snippets.

View filipechagas's full-sized avatar
🏖️
OOO

Filipe Chagas filipechagas

🏖️
OOO
View GitHub Profile
@filipechagas
filipechagas / gist:4148594
Created November 26, 2012 14:49
List all available versions of a gem - including pre releases
gem list --remote -a --prerelease name_of_gem
@filipechagas
filipechagas / dnsmasq OS X.md
Created July 27, 2022 11:24 — forked from ogrrd/dnsmasq OS X.md
Setup dnsmasq on OS X

Never touch your local /etc/hosts file in OS X again

To setup your computer to work with *.test domains, e.g. project.test, awesome.test and so on, without having to add to your hosts file each time.

Requirements

Install

@filipechagas
filipechagas / docker-remote-host-api.md
Created July 26, 2022 18:54
Configuring a Docker Server for local development with Docker Remote Host API

Configuring a Docker Server for local development with Docker Remote Host API

This assumes both machines, server and client, are on the same network and the port that will be used is open for network connections.

On the server

Assuming you already have docker installed

vi /lib/systemd/system/docker.service

@filipechagas
filipechagas / remove-refind.sh
Created May 26, 2016 23:18
Removing REFIND from Mac
# Start on recovery mode
# Go on terminal
$ mount -t msdos /dev/disk0s1 /Volumes/ESP.
$ rm -rf /Volumes/ESP/efi/refind
# from http://www.rodsbooks.com/refind/installing.html#uninstalling
@filipechagas
filipechagas / pg-advisory-lock.sql
Created September 2, 2021 17:11
Postgres Advisory Lock - Pessimistic application enforced lock
SELECT version, json_content, pg_try_advisory_xact_lock(s.id) as locked, s.id as id
FROM snapshots s
WHERE ar_id = $1
-- from https://github.com/crabzilla/crabzilla/blob/f66e43ca4d7c119a00fab68c48386aa7672b0e95/crabzilla-engine-postgres/src/main/java/io/github/crabzilla/engine/command/CommandController.kt#L48
-- more at https://hashrocket.com/blog/posts/advisory-locks-in-postgres
@filipechagas
filipechagas / sendtotmux.vim
Created July 15, 2021 19:26
VI mapping to execute tests on tmux
map <leader>t :call SendToTmux("clear\ryarn test:unit " . expand('%') . "\r")<cr>
@filipechagas
filipechagas / setuppsql.sh
Created July 1, 2021 19:44
Setting up PostgreSQL in Manjaro
sudo pacman -S postgresql postgis
sudo su postgres -l # or sudo -u postgres -i
initdb --locale $LANG -E UTF8 -D '/var/lib/postgres/data/'
exit
sudo systemctl enable --now postgresql.service
sudo su postgres -c psql
CREATE USER deployer WITH PASSWORD 'eldeployerloco';
@filipechagas
filipechagas / arch-caps-map.md
Created June 29, 2021 20:35
Arch - Map Caps to Esc (press) and Control (press and hold)

pacman -S interception-tools interception-caps2esc

Create /etc/interception/udevmon.d/caps2esc.yaml with the following content:

- JOB: "intercept -g $DEVNODE | caps2esc | uinput -d $DEVNODE"
  DEVICE:
    EVENTS:
      EV_KEY: [KEY_CAPSLOCK, KEY_ESC]
@filipechagas
filipechagas / smallest.rb
Created April 23, 2021 17:48
Smallets Positive Integer
class Smallest
def self.resolve(array_size, array_of_numbers)
( (1..array_size + 1).to_a - array_of_numbers ).min
end
end
@filipechagas
filipechagas / gist:3796109
Created September 27, 2012 19:54
Ctags on Mac Osx

http://gmarik.info/blog/2010/10/08/ctags-on-OSX

Snow Leo ships with ctags not suitable for Ruby development. Ie if you try to generate tags recursively, it will error out:

$ ctags R
ctags: illegal option -
R
usage: ctags [-BFadtuwvx] [-f tagsfile] file …

$ which ctags
/usr/bin/ctags