Skip to content

Instantly share code, notes, and snippets.

View SwagDevOps's full-sized avatar
🚀
Like a Rocket

Dimitri Arrigoni SwagDevOps

🚀
Like a Rocket
  • Colmar, France
  • 03:52 (UTC +02:00)
View GitHub Profile
@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 February 14, 2023 14:55
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
#!/usr/bin/env sh
# ```sh
# apt-get remove --purge bcmwl-kernel-source
# cd /usr/local/src
# git clone https://github.com/antoineco/broadcom-wl
# ```
# Current regulatory domain.
REG_COUNTRY=${REG_COUNTRY:-FR}
@SwagDevOps
SwagDevOps / hddtemp-report
Created April 8, 2018 13:12
Get all devices (hdd) temperatures at once.
#!/usr/bin/env sh
# Get all devices (hdd) temperatures at once.
#
# Sample of use:
#
# ```sh
# sudo hddtemp-report
# sudo hddtemp-report /tmp/hddtemp-report
# sudo hddtemp-report /tmp/hddtemp-report '%s: $alignr %s'
@SwagDevOps
SwagDevOps / volume-control
Last active March 17, 2018 14:45
Simple Volume Control based on ``pactl``
#!/usr/bin/env ruby
require 'shellwords'
# Simple Volume Control based on ``pactl``
#
# Sample of (CLI) use:
#
# ```
# volume-control up