Skip to content

Instantly share code, notes, and snippets.

@piaverous
piaverous / setup_ssh_agent_with_apple_keychain.sh
Last active July 12, 2024 00:31
A simple bash snippet to add to your .bashrc or .zshrc in order to easily load password protected SSH Keys from the Apple Keychain, and never worry about them again !
###
# SSH keys setup with Apple keychain
###
if [ -z "$SSH_AUTH_SOCK" ] && [ -z "$SSH_AGENT_PID" ]; then
# If no SSH Agent is running, start one and load keys from Apple keychain
eval `ssh-agent -s` &> /dev/null
ssh-add --apple-load-keychain &> /dev/null
else
if [ -z "$(ssh-add -l | grep SHA256)" ]; then
# If agent is running but has no keys, load keys from Apple keychain
@alyandon
alyandon / snapd-regain-sanity.patch
Last active January 26, 2023 16:47
Give users control over snapd autorefresh mechanism - apply patch over offiical repo and build binaries
diff --git a/cmd/snapd/main.go b/cmd/snapd/main.go
index 741d998404..55d06d2d9c 100644
--- a/cmd/snapd/main.go
+++ b/cmd/snapd/main.go
@@ -52,6 +52,10 @@ func init() {
}
func main() {
+ if _, found := os.LookupEnv("SNAPD_DISABLE_AUTOREFRESH"); found {
+ logger.Noticef("AutoRefresh disabled due to SNAPD_DISABLE_AUTOREFRESH environment variable being set")
@NiKiZe
NiKiZe / start_wwan.sh
Created September 2, 2021 19:19
Start MC7700 LTE on Raspberry Pi
#!/bin/bash
# Connect a Raspberry Pi to LTE using MC7700 Mini PCI Modem with adapter to USB-C
sudo qmicli -d /dev/cdc-wdm0 -p --wds-stop-network
sudo cat /sys/class/net/wwan0/qmi/raw_ip
sudo ip link set dev wwan0 down
# Enable OS Raw IP Mode setting (not persistent)
sudo su -c "echo Y > /sys/class/net/wwan0/qmi/raw_ip"
sudo qmicli -d /dev/cdc-wdm0 -p --device-open-net="net-raw-ip|net-no-qos-header" --wds-start-network="ip-type=6" --client-no-release-cid
@kesyog
kesyog / i3 multiple monitors.md
Last active May 4, 2025 06:43
Configuring multiple displays with i3

Configuring multiple displays with i3

Motivation

I've run into a few common issues running i3 on a laptop with external monitors.

  • When running i3, external monitors aren't always detected properly.
  • When running multiple displays with different resolutions, text scaling is inconsistent.
  • I'd like to be able to automatically change configurations if I unplug my external monitor(s), plug in a projector, etc.
@probonopd
probonopd / Wayland.md
Last active July 26, 2025 07:36
Think twice about Wayland. It breaks everything!

Think twice before abandoning X11. Wayland breaks everything!

image

Source: https://x.com/LundukeJournal/status/1940441670098809093

Wayland breaks everything! It is binary incompatible, provides no clear transition path with 1:1 replacements for everything in X11, and is even philosophically incompatible with X11. Hence, if you are interested in existing applications to "just work" without the need for adjustments, then you may be better off avoiding Wayland.

Wayland solves no issues I have but breaks almost everything I need. Even the most basic, most simple things (like xkill) - in this case with no obvious replacement. And usually it stays broken, because the Wayland folks mostly seem to care about Automotive, Gnome, maybe KDE - and alienating everyone else (e.g., people using just an X11 window manager or something like GNUstep) in the process.

@graninas
graninas / What_killed_Haskell_could_kill_Rust.md
Last active July 20, 2025 07:34
What killed Haskell, could kill Rust, too

At the beginning of 2030, I found this essay in my archives. From what I know today, I think it was very insightful at the moment of writing. And I feel it should be published because it can teach us, Rust developers, how to prevent that sad story from happening again.


What killed Haskell, could kill Rust, too

What killed Haskell, could kill Rust, too. Why would I even mention Haskell in this context? Well, Haskell and Rust are deeply related. Not because Rust is Haskell without HKTs. (Some of you know what that means, and the rest of you will wonder for a very long time). Much of the style of Rust is similar in many ways to the style of Haskell. In some sense Rust is a reincarnation of Haskell, with a little bit of C-ish like syntax, a very small amount.

Is Haskell dead?

@barakplasma
barakplasma / find_apartment_on_facebook.py
Last active July 24, 2024 15:53
Scrape Facebook Groups for Apartments using Python
import os
import re
import sqlite3
import argparse
import itertools
import seaborn as sns
import matplotlib.pyplot as plt
import pandas as pd
@fnky
fnky / ANSI.md
Last active July 26, 2025 02:37
ANSI Escape Codes

ANSI Escape Sequences

Standard escape codes are prefixed with Escape:

  • Ctrl-Key: ^[
  • Octal: \033
  • Unicode: \u001b
  • Hexadecimal: \x1B
  • Decimal: 27
https://ondemand.npr.org/anon.npr-mp3/npr/waitwait/2006/01/20060107_waitwait_01.mp3
https://ondemand.npr.org/anon.npr-mp3/npr/waitwait/2006/01/20060107_waitwait_02.mp3
https://ondemand.npr.org/anon.npr-mp3/npr/waitwait/2006/01/20060107_waitwait_03.mp3
https://ondemand.npr.org/anon.npr-mp3/npr/waitwait/2006/01/20060107_waitwait_04.mp3
https://ondemand.npr.org/anon.npr-mp3/npr/waitwait/2006/01/20060107_waitwait_05.mp3
https://ondemand.npr.org/anon.npr-mp3/npr/waitwait/2006/01/20060107_waitwait_06.mp3
https://ondemand.npr.org/anon.npr-mp3/npr/waitwait/2006/01/20060114_waitwait_01.mp3
https://ondemand.npr.org/anon.npr-mp3/npr/waitwait/2006/01/20060114_waitwait_02.mp3
https://ondemand.npr.org/anon.npr-mp3/npr/waitwait/2006/01/20060114_waitwait_03.mp3
https://ondemand.npr.org/anon.npr-mp3/npr/waitwait/2006/01/20060114_waitwait_04.mp3
@pirate
pirate / full-page.js
Last active February 23, 2022 02:38
Requested behavior for --full-page CLI option for chrome --headless --screenshot.
const puppeteer = require('puppeteer');
(async () => {
const browser = await puppeteer.launch();
const page = await browser.newPage();
await page.setViewport({width: 1440, height: 1200});
await page.goto('https://example.com', {waitUntil: 'networkidle2'});
await page.screenshot({path: 'screenshot.png', fullPage: true});
await browser.close();
})();