Skip to content

Instantly share code, notes, and snippets.

View williamcanin's full-sized avatar
🐍
Simple is better than complex.

William C. Canin williamcanin

🐍
Simple is better than complex.
View GitHub Profile
# Arch Linux
# ===============================================================
# Installation with LVM, LUKS (in HOME /dev/sdb) and Systemd-Boot
# ===============================================================
# by: William C. Canin
# Note: The >>> are commands
>>> loadkeys br-abnt2
>>> timedatectl set-timezone America/Sao_Paulo
@williamcanin
williamcanin / convert_dv.py
Last active November 25, 2021 09:18
Converting video formats to MOV. Compatible with Davinci Resolve.
#!/usr/bin/env python3
import argparse
from os import listdir
from os.path import isdir, join, splitext
from pathlib import Path
from subprocess import call
from typing import Union
@williamcanin
williamcanin / jankenpon_en.py
Created December 3, 2019 00:05
Python script to play Rock-Paper-Scissors
#!/usr/bin/env python
# by William C. Canin <https://williamcanin.github.io>
# Date: 02 dec, 2019
# Version: 1.0.1
# Description: Game Rock-Paper-Scissors.
from random import choice, random
from textwrap import dedent
@williamcanin
williamcanin / jankenpon_ptbr.py
Last active December 3, 2019 00:06
Python script para jogar Pedra Papel Tesoura (Rock-Paper-Scissors)
#!/usr/bin/env python
# por William C. Canin <https://williamcanin.github.io>
# Date: 02 dez, 2019
# Versão: 1.0.1
# Descrição: Jogo Pedra Papel Tesoura.
from random import choice, random
from textwrap import dedent
@williamcanin
williamcanin / create-ruby-gem.md
Created July 2, 2016 01:59 — forked from kelvinst/create-ruby-gem.md
Como criar uma gem ruby?

Como criar uma gem ruby?

Escolhi tratar sobre esse assunto hoje simplesmente porque foi uma das primeiras coisas que me perguntei "como eu faço isso?" no mundo ruby. Acredito que muita gente se pergunte a mesma coisa e espero que eu possa ajudar em algo para elas. 😀

O que é uma gem?

Bem, se você é um programador java, você chama sua gem de jar, se você é um programador C#, você chama de dll. Resumindo, é uma lib, uma biblioteca contendo códigos que você pode reaproveitar importando em outros projetos.

E usar gems no ruby é muito fácil, se você já deu uma brincada com rails por exemplo, é só você adicionar o código gem 'nome_da_gem' no arquivo Gemfile que está no root, depois executar o comando bundle install para baixar sua gem do repositório e pronto, só sair usando a biblioteca!

/: Bus 02.Port 1: Dev 1, Class=root_hub, Driver=ehci-pci/2p, 480M
|__ Port 1: Dev 2, If 0, Class=Hub, Driver=hub/6p, 480M
/: Bus 01.Port 1: Dev 1, Class=root_hub, Driver=ehci-pci/2p, 480M
|__ Port 1: Dev 2, If 0, Class=Hub, Driver=hub/6p, 480M
|__ Port 2: Dev 3, If 0, Class=Video, Driver=uvcvideo, 480M
|__ Port 2: Dev 3, If 1, Class=Video, Driver=uvcvideo, 480M
|__ Port 5: Dev 5, If 0, Class=Wireless, Driver=btusb, 12M
|__ Port 5: Dev 5, If 1, Class=Wireless, Driver=btusb, 12M
00:00.0 Host bridge: Intel Corporation 2nd Generation Core Processor Family DRAM Controller (rev 09)
Subsystem: Sony Corporation Device 908b
Flags: bus master, fast devsel, latency 0
Capabilities: <access denied>
.
. # Resto do counteúdo retirado por ser extenso
.
13:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller (rev 06)
Subsystem: Sony Corporation Device 908b
william @archlinux $
└‣ mount
proc on /proc type proc (rw,nosuid,nodev,noexec,relatime)
sys on /sys type sysfs (rw,nosuid,nodev,noexec,relatime)
dev on /dev type devtmpfs (rw,nosuid,relatime,size=1996208k,nr_inodes=499052,mode=755)
run on /run type tmpfs (rw,nosuid,nodev,relatime,mode=755)
/dev/sda8 on / type ext4 (rw,relatime,data=ordered)
.
.
/dev/sdb on /run/media/william/sandisk type vfat (rw,nosuid,nodev,relatime,uid=1000,gid=1002,fmask=0022,dmask=0022,codepage=437,iocharset=iso8859-1,shortname=mixed,showexec,utf8,flush,errors=remount-ro,uhelper=udisks2)
@williamcanin
williamcanin / A-start-job-is-running-for-dev-disk-by-code2.sh
Last active August 24, 2025 02:19
"/etc/fstab" of ArchLinux for post: Linux Boot: A start job is running for dev-disk-by (https://williamcanin.github.io/blog/linux-boot-a-start-job-is-running-for-dev-disk-by/)
#
# /etc/fstab: static file system information
#
# <file system> <dir> <type> <options> <dump> <pass>
UUID=2253f584-8ff4-46c2-9cf6-386415684be8 / ext4 rw,relatime,data=ordered 0 1
UUID=4aed3ea2-5d85-4bc2-96e2-abc6ad877640 none swap defaults 0 0
UUID=87daa4d7-ec56-460f-ab11-b2788aa373ec /mnt/home ext4 defaults,auto,rw 0 1
NAME FSTYPE LABEL UUID MOUNTPOINT
sda
├─sda1 ntfs Dados-Ntfs 66E421B71C85E362
├─sda2
├─sda3 ext4 fedora ef0da60e-1bf5-4a7c-92d4-25999c784ad5
├─sda5 ext4 87daa4d7-ec56-460f-ab11-b2788aa373ec /mnt/home
├─sda6 ext4 db5b49b3-200a-4172-b036-1b5f42dbe73e
├─sda7 swap 035b2802-752a-45b6-a87c-c4d466cdf53d [SWAP]
└─sda8 ext4 archlinux 2253f584-8ff4-46c2-9cf6-386415684be8 /
sr0