Skip to content

Instantly share code, notes, and snippets.

View peltho's full-sized avatar

Thomas Pellegatta peltho

  • France
View GitHub Profile
@peltho
peltho / svelte.md
Last active May 16, 2024 03:44
Svelte cheatsheet
@peltho
peltho / golang.md
Last active May 11, 2024 18:18
Golang cheatsheet

Golang cheatsheet

Variables

var foo int
var foo = 0
foo := 0

var a, b, c int = 1, 2, 3
@peltho
peltho / EEPROM update (for RPI4 on ArchARM)
Last active April 4, 2024 09:16
Updating RPI4 EEPROM for ArchARM
pacman -Syu --needed git python3 binutils
git clone https://github.com/raspberrypi/rpi-eeprom.git /opt/rpi-eeprom
mkdir -p /lib/firmware/raspberrypi
ln -s /opt/rpi-eeprom/firmware-2711/ /lib/firmware/raspberrypi/bootloader
@peltho
peltho / pass.md
Last active December 16, 2023 13:21
How to setup a pass server

Pass (unix password manager)

Configuration

Server-side
  1. Create a GPG encrypted key: gpg2 --full-gen-key
  2. Export it in a file to share with your guests: gpg2 --export-secret-keys > key.gpg
  3. Retrieve your key with: gpg --list-keys
  4. Init a pass directory: pass init
@peltho
peltho / Actors.md
Last active October 7, 2023 09:59
Transcript of "Way to do things" from Peter Bourgon

Ways to do things (from Peter Bourgon)

Actors

// Actor model (state machine)
type stateMachine struct {
    state string
    actionc chan func()
}
@peltho
peltho / moist.ino
Last active July 20, 2023 19:04
Arduino moisture sensor sketch
#include <Arduino.h>
#define MOIST_PIN_1 A5
#define MOIST_PIN_2 A4
#define MOIST_PIN_3 A3
#define MOIST_PIN_4 A2
#define MOIST_PIN_5 A1
#define PWRBTN 7
#define RELAYPIN 5
@peltho
peltho / arduino.go
Created July 18, 2023 19:54
IO with Arduino
package main
import (
"fmt"
"bufio"
"github.com/tarm/serial"
"log"
)
type Arduino struct {
@peltho
peltho / .skhdrc
Created March 16, 2023 15:26
Skhd config file
# Move to window in current workspace
cmd - left : yabai -m window --focus west
cmd - down : yabai -m window --focus south
cmd - up : yabai -m window --focus north
cmd - right : yabai -m window --focus east
# Shift window in current workspace
cmd + shift - left : yabai -m window --swap west || $(yabai -m window --display west; yabai -m display --focus west)
cmd + shift - down : yabai -m window --swap south || $(yabai -m window --display south; yabai -m display --focus south)
cmd + shift - up : yabai -m window --swap north || $(yabai -m window --display north; yabai -m display --focus north)
@peltho
peltho / .yabairc
Created March 16, 2023 15:24
Yabai config file (OSX)
#!/usr/bin/env sh
# *yabai --load-sa* is configured to run through sudo without a password
sudo yabai --load-sa
yabai -m signal --add event=dock_did_restart action="sudo yabai --load-sa"
# bar settings
yabai -m config top_padding 10
# global settings
@peltho
peltho / .bash_prompt
Created January 1, 2021 11:06
bash prompt
# This prompt inspired by gf3, sindresorhus, alrra, and mathiasbynens.
# but customized to me. <3
default_username='thomas'
# Colors
grey="\033[38;5;248m"
red="\033[38;5;196m"
orange="\033[38;5;208m"
blue="\033[38;5;75m"