Skip to content

Instantly share code, notes, and snippets.

@tiagoamaro
tiagoamaro / apps.md
Last active March 29, 2024 19:09
Linux Apps
--DDL - Criando tabelas
CREATE TABLE IF NOT EXISTS cliente (
id INTEGER PRIMARY KEY AUTOINCREMENT,
nome TEXT NOT NULL,
cpf TEXT NOT NULL UNIQUE,
ativo BOOLEAN DEFAULT TRUE,
data_criacao DATETIME NOT NULL DEFAULT (datetime('now','localtime'))
);
CREATE TABLE IF NOT EXISTS conta (
ZSH=$HOME/.oh-my-zsh # Path to your oh-my-zsh configuration
ZSH_THEME="bira"
COMPLETION_WAITING_DOTS="true"
# Plugin repositories:
# => https://github.com/zsh-users/zsh-autosuggestions
# => https://github.com/zsh-users/zsh-syntax-highlighting
plugins=(zsh-autosuggestions zsh-syntax-highlighting)
# Fix zsh-syntax-highlight slow pasting
Executing instructions from https://github.com/jacobalberty/unifi-docker/tree/2cb3b97bed46cedab278f7c2d99fee8de3fd080d#setting-up-running-stopping-upgrading,
with São Paulo's timezone:
docker run -d --init \
--restart=unless-stopped \
-p 8080:8080 -p 8443:8443 -p 3478:3478/udp \
-e TZ='America/Sao Paulo' \
-v ~/unifi:/unifi \
--user unifi \
--name unifi \
@tiagoamaro
tiagoamaro / chess-com.css
Last active July 14, 2023 23:45
Chess.com Stauton piece styles on Lichess using Stylus
/* ==UserStyle==
@name 9/30/2022, 3:33:22 PM
@namespace github.com/openstyles/stylus
@version 0.0.1
@description Margin-top on chess.com board
@author github.com/tiagoamaro
==/UserStyle== */
@-moz-document domain("chess.com") {
#board-layout-main {
@tiagoamaro
tiagoamaro / hash_with_indifferent_access_benchmark.rb
Last active April 28, 2023 08:25
ActiveSupport's HashWithIndifferentAccess access benchmark vs common Ruby Hash
#####################
# Ruby Version: 2.1.6
#####################
# gem 'activesupport', '=3.2.22'
# gem 'activesupport', '=4.2.5'
require 'active_support/all'
require 'benchmark/ips'
@tiagoamaro
tiagoamaro / untilfail.sh
Created February 22, 2018 14:24
Run a command until it returns an exist status different than 0
# Author: James Healy (https://twitter.com/jim_healy)
#!/bin/bash
$@
while [ $? -eq 0 ]; do
$@
done
@tiagoamaro
tiagoamaro / apps.md
Last active November 15, 2022 17:07
Windows Apps
@tiagoamaro
tiagoamaro / howto.md
Last active November 12, 2022 23:20 — forked from d4v3y0rk/howto.md
Encryption with DM_CRYPT in WSL2

Encrypted Volumes in WSL2

Description

This is a quick guide on how to setup dm_crypt under WSL2 for working with encrypted volumes. I use an encrypted volume to store things like password recovery codes and 2nd factor backup codes etc. I recently switched over to using WSL2 and wanted to figure out how to enable this functionality there. This is the distilled howto for getting it to work.

Guide

First thing you have to do is create a custom WSL2 kernel. Inside your already installed and running WSL2 (ubuntu) installation:

  • Install some required packages.
@tiagoamaro
tiagoamaro / spotify_control
Created August 14, 2019 12:48
Spotify Control (Ubuntu)
#!/usr/bin/env bash
# Simple Spotify Control
# Just call ./spotify_control --help
# Source: https://community.spotify.com/t5/Desktop-Linux/Linux-keyboard-shortcuts/td-p/1626394
CMD="dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player"
case "$1" in
"playpause" )