Skip to content

Instantly share code, notes, and snippets.

View Ruivalim's full-sized avatar
🏠
Working from home

Rui Valim Ruivalim

🏠
Working from home
View GitHub Profile
@Ruivalim
Ruivalim / resize_disk_image.md
Last active November 23, 2022 01:09 — forked from joseluisq/resize_disk_image.md
How to resize a qcow2 disk image on Linux

How to resize a qcow2 disk image on Linux

This example takes olddisk.qcow2 and resizes it into newdisk.qcow2, extending one of the guest's partitions to fill the extra space.

1. qcow2 format

1.1. Verify the filesystems of olddisk.qcow2

@Ruivalim
Ruivalim / docker_output.py
Last active November 8, 2022 18:18 — forked from oseme-techguy/docker_output.py
Docker Python logger output to stdout
import logging
from sys import stdout
# Define logger
logger = logging.getLogger('mylogger')
logger.setLevel(logging.DEBUG) # set logger level
logFormatter = logging.Formatter("%(asctime)s %(levelname)-8s %(message)s")
consoleHandler = logging.StreamHandler(stdout) #set streamhandler to stdout
consoleHandler.setFormatter(logFormatter)
@Ruivalim
Ruivalim / kitty.conf
Last active November 4, 2022 15:35
kitty.conf
font_size 25.0
map alt+left send_text all \x1b\x62
map alt+right send_text all \x1b\x66
enabled_layouts tall:bias=50;full_size=1;mirrored=false
map ctrl+[ layout_action decrease_num_full_size_windows
map ctrl+] layout_action increase_num_full_size_windows
@Ruivalim
Ruivalim / .alias
Last active February 7, 2024 19:44
dotfiles
alias ls="lsd -la"
alias work="cd ~/work"
alias finder="open -a Finder ."
function toBaseN(num, base) {
if (num === 0) {
return '0';
}
var digits = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
var len = Math.min(digits.length, base);
var result = '';
while (num > 0) {
result = digits[num % len] + result;
num = parseInt(num / len, 10);
@Ruivalim
Ruivalim / base64.js
Created March 12, 2021 20:56 — forked from jhurliman/base64.js
An extremely simple implementation of base64 encoding / decoding using node.js Buffers (plus url-safe versions)
/*
* base64.js: An extremely simple implementation of base64 encoding / decoding using node.js Buffers
*
* (C) 2010, Nodejitsu Inc.
* (C) 2011, Cull TV, Inc.
*
*/
var base64 = exports;
@Ruivalim
Ruivalim / estados-cidades.json
Created May 11, 2020 05:01 — forked from letanure/estados-cidades.json
JSON estados cidades do brasil, dividido por estados. segunda lista atualizada em 2020, dados do IBGE
{
"estados": [
{
"sigla": "AC",
"nome": "Acre",
"cidades": [
"Acrelândia",
"Assis Brasil",
"Brasiléia",
"Bujari",
{"lastUpload":"2020-10-18T20:33:36.066Z","extensionVersion":"v3.4.3"}