Skip to content

Instantly share code, notes, and snippets.

View 1player's full-sized avatar
💥

Stéphane Travostino 1player

💥
View GitHub Profile
# Ansible managed
[Unit]
After=network-online.target
[Container]
ContainerName=backup
Image=docker.io/mazzolino/restic
HostName=xxx
Environment="RUN_ON_STARTUP=true"
#!/bin/bash
set -euo pipefail
REPO=sftp:[email protected]:restic-home/
export RESTIC_CACHE_DIR=/var/cache/restic
restic -r $REPO --password-file=/etc/restic.key unlock
@1player
1player / gestures.el
Created February 8, 2024 12:09
Emacs two finger gestures to scroll back and forth
(defun debounce (time fn)
(let ((ready t))
(lambda ()
(interactive)
(when ready
(funcall fn)
(setq ready nil)
(run-at-time time nil (lambda () (setq ready t)))))))
(global-set-key (kbd "<triple-wheel-right>") (debounce "0.25 sec" #'previous-buffer))
#!/bin/bash
set -euo pipefail
i2c_from_output() {
dir=$(ls -d /sys/bus/pci/devices/0000:03:00.0/drm/card*/card*-"$1"/i2c*)
dev=$(basename "$dir")
echo "/dev/$dev"
}
@1player
1player / bazarr.docker-compose.yml
Last active February 17, 2024 20:41
Poor man's media centre
# Bazarr downloads subtitles
version: "3.4"
services:
bazarr:
image: linuxserver/bazarr:1.0.5-development
container_name: bazarr
restart: unless-stopped
environment:
- TZ=Europe/London
@1player
1player / mullvad.sh
Last active September 28, 2024 21:31
Script to set up Mullvad VPN from Wireguard config files (+ Tailscale VPN support)
#!/bin/bash
#
# Requires: wg-quick from wireguard-tools package.
#
# How to configure: go on your Mullvad account page and download the
# Wireguard configuration for all countries.
# Unpack the archive at $HOME/.config/mullvad/
#
# Then run `mullvad.sh up <2-char country code>`
# and `mullvad.sh down` to tear it down.
@1player
1player / list-unused-flatpak-directories.sh
Created June 14, 2022 09:14
Show all unused ~/.var/app directories from uninstalled Flatpaks, and their size
#!/bin/bash
set -euo pipefail
base_dir=$(realpath $HOME/.var/app --relative-to=$(pwd))
comm -13 <(flatpak list --columns=application | sort) <(ls -1 $HOME/.var/app/ | sort) \
| sed "s#^#$base_dir/#" | tr '\n' '\0' | du -sch --files0-from=-
@1player
1player / squad-toggle-sprint.ahk
Created February 8, 2021 10:47
Toggle sprint AutoHotKey script for Squad
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn ; Enable warnings to assist with detecting common errors.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
#IfWinActive, SquadGame
; 0=walk, 1=hold sprint, 2=toggle sprint
mode := 0
@1player
1player / gist:af5f02ccbe7c930f793fc104c99975df
Created February 5, 2020 14:51
Auto dark mode HN - Cascadea
/* Hey there! Thanks for buying Cascadea.
Since it looks like this is your first custom style,
here's a few tips to get you started.
First, you need to write some CSS code for the site
you'd like to customize. That's what this handy
editor is for! I recommend using Safari's Web
Inspector to check out the layout and stylesheet
of the website you'd like to modify, so you can
figure out what you need to customize.
// ==UserScript==
// @name Dark mode HN
// @version 0.1
// @description try to take over the world!
// @author You
// @match https://news.ycombinator.com/*
// @grant GM_addStyle
// ==/UserScript==
(function() {