Skip to content

Instantly share code, notes, and snippets.

View SwagDevOps's full-sized avatar

Dimitri Arrigoni SwagDevOps

  • Colmar, France
  • 10:35 (UTC +02:00)
View GitHub Profile
@SwagDevOps
SwagDevOps / behind_ssl_proxy.conf
Last active February 16, 2025 15:28
Tell apache we’re behind a reverse proxy handling SSL
# vim: set filetype=apache ts=2 sw=2 expandtab:
<IfModule mod_remoteip.c>
RemoteIPHeader X-Forwarded-For
RemoteIPTrustedProxy 127.0.0.1
</IfModule>
<IfModule mod_setenvif.c>
SetEnvIfNoCase X-Forwarded-Proto "^https$" HTTPS=on
</IfModule>
vim /etc/systemd/system/traefik.service
systemctl daemon-reload
useradd -r -s /bin/false -U -M traefik
mkdir -pv /etc/traefik/storage
mkdir -pv /var/log/traefik/
chown -Rfv traefik:traefik /etc/traefik/ /var/log/traefik/
@SwagDevOps
SwagDevOps / dante-proxy-socks-setup.md
Last active January 30, 2025 16:59
dante (proxy socks)

Service

systemctl edit danted.service
systemctl daemon-reload
service danted restart

Logging

@SwagDevOps
SwagDevOps / touchpad
Created June 15, 2022 06:11
Touchpad not working after suspending laptop (MaxBook Y13 Pro - BMAX)
#!/usr/bin/env sh
# @file /lib/systemd/system-sleep/touchpad
# @see https://askubuntu.com/questions/671910/touchpad-not-working-after-suspending-laptop
set -eu
# constants ----------------------------------------------------------
MODULES="i2c_hid_acpi"
@SwagDevOps
SwagDevOps / srt_fix.rb
Last active May 24, 2021 22:44
Fix srt file with sentences on identical tiemestamps
#!/usr/bin/env ruby
# frozen_string_literal: true
class SrtFix
autoload(:Pathname, 'pathname')
def initialize(filepath)
@filepath = Pathname.new(filepath)
end
@SwagDevOps
SwagDevOps / icy-notify.lua
Last active July 7, 2025 22:17
MPV notifications based on icy-title and icy-name
-- ~/.config/mpv/scripts/icy-notify.lua
local utils = require 'mp.utils'
local msg = require 'mp.msg'
local DEBUG = false
-- table ----------------------------------------------------------------------
table.union = function(a, b)
local result = {}
@SwagDevOps
SwagDevOps / transistor.rb
Last active April 8, 2021 22:17
transistor.rb
#!/usr/bin/env ruby
# -*- coding: utf-8 -*-
autoload(:YAML, 'yaml')
autoload(:Pathname, 'pathname')
autoload(:Etc, 'etc')
# Sample of use:
#
# ```sh
#!/usr/bin/env sh
# Some (useful) shell tricks.
set -eux
# read from deb file without extracting to the filesystem
dpkg --fsys-tarfile gitkraken.deb | tar xOf - ./usr/share/gitkraken/version > VERSION

Names incorporating the interfaces's MAC address

With systemd 197 we have added native support for a number of different naming policies into systemd/udevd proper and made a scheme similar to biosdevname's (but generally more powerful, and closer to kernel-internal device identification schemes) the default. The following different naming schemes for network interfaces are now supported by udev natively:

  1. Names incorporating Firmware/BIOS provided index numbers for on-board devices (example: eno1)
  2. Names incorporating Firmware/BIOS provided PCI Express hotplug slot index numbers (example: ens1)
  3. Names incorporating physical/geographical location of the connector of the hardware (example: enp2s0)
@SwagDevOps
SwagDevOps / utf-8.py
Created February 17, 2019 16:58
How to set the default encoding to UTF-8 in Python?
import sys, os
reload(sys)
sys.setdefaultencoding("UTF-8")
# @see http://pythonic.zoomquiet.top/data/20130407004931/index.html