Skip to content

Instantly share code, notes, and snippets.

View sdeluce's full-sized avatar

Stéphane Deluce sdeluce

View GitHub Profile
@bulletmark
bulletmark / wifi-switcher
Last active March 1, 2025 22:00
Small program to switch wifi off/on when wired connection goes on/off
#!/usr/bin/env python3
# If you are using Linux NetworkManager then this dispatcher script toggles
# your wifi radio ON whenever all your wired connections are not connected, or
# turns the wifi radio OFF when any wired connection is connected. Simply copy
# this to /etc/NetworkManager/dispatcher.d/99-wifi and ensure it is executable
# (i.e. `sudo chmod 755 /etc/NetworkManager/dispatcher.d/99-wifi`). No other
# configuration is required. Get the latest version from
# https://gist.github.com/bulletmark/8e051a0a9ffdce689d86988c528e7764
# Author: Mark Blakeney, Jun 2020.
from __future__ import annotations
@marcosvpj
marcosvpj / vscode-remove-duplicate-lines.md
Last active July 17, 2024 19:08
How to remove duplicate lines in Visual Studio Code?

If the order of lines is not important##

Sort lines alphabetically, if they aren't already, and perform these steps:
(based on this related question: https://stackoverflow.com/q/1573361/3258851)

  1. Control+F

  2. Toggle "Replace mode"

  3. Toggle "Use Regular Expression" (the icon with the .* symbol)

@181192
181192 / increase_root_fedora.md
Last active April 12, 2025 21:13
How to increase the root partition size on Fedora

How to increase the root partition size on Fedora

Boot up with an Fedora Live USB stick.

  1. Run vgs to check if there's any space:
$ sudo vgs
  VG     #PV #LV #SN Attr   VSize    VFree
  fedora   1   3   0 wz--n- <237.28g    0 
@joemaller
joemaller / luxon.md
Created January 23, 2018 14:29
Luxon Timestamps

Finding this took me longer than it should have, probably because I was impatiently looking for "timeststamp" instead of "milliseconds of the Unix epoch". For future searchers, Luxon uses the methods DateTime.fromMillis and DateTime.valueOf.

// Create a Luxon DateTime from a JS Unix timestamp
const ts = new Date().getTime();     // 1516717417146
const dt = DateTime.fromMillis(ts);  // { ts: 2018-01-23T09:23:37.146-05:00 ...
console.log(dt.valueOf());           // 1516717417146
sudo apt-get update
sudo apt-get install hostapd isc-dhcp-server
sudo apt-get install iptables-persistent
sudo nano /etc/dhcp/dhcpd.conf
# Find the lines that say
option domain-name "example.org";
option domain-name-servers ns1.example.org, ns2.example.org;
@jcavat
jcavat / Dockerfile
Last active April 15, 2025 17:40
docker-compose with php/mysql/phpmyadmin/apache
FROM php:7.1.2-apache
RUN docker-php-ext-install mysqli
@sdeluce
sdeluce / bootable USB
Last active January 27, 2017 18:49
Création d'un clef usb bootable via OsX en Cli
# convertir l'iso en img
hdiutil convert -format UDRW -o ~/path/to/target.img ~/path/to/mint.iso
# Convertir l'img dmg en img
mv ~/path/to/target.img.dmg ~/path/to/target.img
# Liste des périphériques
diskutil list
# Replace N by value find in list
@fntlnz
fntlnz / self-signed-certificate-with-custom-ca.md
Last active August 13, 2025 16:23
Self Signed Certificate with Custom Root CA

Create Root CA (Done once)

Create Root Key

Attention: this is the key used to sign the certificate requests, anyone holding this can sign certificates on your behalf. So keep it in a safe place!

openssl genrsa -des3 -out rootCA.key 4096
@sdeluce
sdeluce / .zshrc
Created August 25, 2015 08:53
Add Apple Numpad to ZSH terminal
# Keypad
# 0 . Enter
bindkey -s "^[Op" "0"
bindkey -s "^[On" "."
bindkey -s "^[OM" "^M"
# 1 2 3
bindkey -s "^[Oq" "1"
bindkey -s "^[Or" "2"
bindkey -s "^[Os" "3"
# 4 5 6
@cryptix
cryptix / pgpTestTool.go
Created December 28, 2014 16:20
PGP file encryption in golang
package main
import (
"archive/zip"
"fmt"
"log"
"os"
"time"
"github.com/cryptix/go/logging"