Skip to content

Instantly share code, notes, and snippets.

View gmcabrita's full-sized avatar

Gonçalo Mendes Cabrita gmcabrita

View GitHub Profile
version: "3"
services:
db:
image: postgres
container_name: db
environment:
POSTGRES_USER: "${USER}"
# POSTGRES_DB: default_db
# POSTGRES_PASSWORD: password
volumes:
TARGET = alacritty
APP_NAME = Alacritty.app
ASSETS_DIR = assets
RELEASE_DIR = target/release
APP_TEMPLATE = $(ASSETS_DIR)/osx/$(APP_NAME)
APP_DIR = $(RELEASE_DIR)/osx
APP_BINARY = $(RELEASE_DIR)/$(TARGET)
APP_BINARY_DIR = $(APP_DIR)/$(APP_NAME)/Contents/MacOS
VERSION := $(shell git describe --tags --always --dirty)
all: help
version: ## Print current version
@echo $(VERSION)
help:
@grep -E '^[a-zA-Z._-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\t\033[36m%-11s\033[0m %s\n", $$1, $$2}'
@gmcabrita
gmcabrita / .flake8
Last active April 6, 2019 12:30
Python project setup.
ignore = W503
max-line-length = 79
max-complexity = 18
select = B,C,E,F,W,T4,B9
@gmcabrita
gmcabrita / models.rb
Created February 12, 2020 23:16
Prevent ActiveAdmin index page from executing the query when no filters are applied.
ActiveAdmin.register Model do
controller do
def scoped_collection
# this is super ugly but whatever
if (params.keys - ["controller", "action", "order"]).size > 0
super
else
super.none
end
end
const obj = {};
const handler = {
set(target, key, value) {
console.table("Setting", key, value);
target[key] = value;
},
deleteProperty(target, key) {
console.log(`Deleting ${key}`);
delete target[key];
},
# setup OBS camera sink
obscam() {
if [ ! -d ~/code/v4l2loopback ]; then
(
cd ~/code
git clone git@github.com:umlaeute/v4l2loopback.git
cd v4l2loopback
make
sudo make install
sudo depmod -a
@gmcabrita
gmcabrita / bookmarklet.js
Created May 9, 2020 21:33
rack-mini-profiler + speedscope.app
javascript:void(function(){params=new URLSearchParams(document.location.search.slice(1));params.set("pp","flamegraph");open('https://www.speedscope.app/#profileURL='+encodeURIComponent(`${document.location.origin}${document.location.pathname}?${params.toString()}`))}())
@gmcabrita
gmcabrita / settings.jsonc
Created May 11, 2020 19:27 — forked from thbar/settings.jsonc
Current minimalistic VSCode setup (à la atom/textmate)
{
// NOTE: these settings work well for me
// using Ruby, Elixir and Assembly languages.
//
// I would probably do something different if
// I worked more with other languages at the moment
"telemetry.enableCrashReporter": false,
"telemetry.enableTelemetry": false,
"workbench.startupEditor": "newUntitledFile",
function $e(tag='div', props={}, children=[]){
let element = document.createElement(tag);
Object.assign(element, props);
element.append(...children);
return element;
}
// With `elem.append(...children)` - with the added benefit that plain strings passed to .append() get turned into text nodes automatically, so you probably don't need $t any more.
var $t=document.createTextNode.bind(document);