Skip to content

Instantly share code, notes, and snippets.

View eric-glb's full-sized avatar

Éric eric-glb

  • France
  • 20:05 (UTC +02:00)
View GitHub Profile
@eric-glb
eric-glb / WG.sh
Last active May 12, 2024 22:49
Wireguard: script to enable / disable VPN connection from CLI
#!/usr/bin/env bash
export LC_ALL=C
CLEAR="\e[0;m"
RED="\e[1;31m"
GREEN="\e[1;32m"
YELLOW="\e[1;33m"
UP="\e[1A" # Move cursor one line up
CL="\r$(printf %$(tput cols)s)\r" # Clear line
@eric-glb
eric-glb / howto-capslock-apple-keyboard.md
Last active March 19, 2024 08:47
Macbook Air 6.2 (2014) Azerty keyboard / Debian: CapsLock like on Windows

Debian: CapsLock like on Windows (Macbook Air edition)

How to configure the keyboard on Debian in order for capslock to function like on Windows, using a french Apple Keyboard (French (Macintosh)).

Solution found here, adapted for my old french Macbook Air.

Configuration file to create:

@eric-glb
eric-glb / steampipe-plugin-vanta_post-processing.md
Created September 27, 2023 10:56
steampipe & steampipe-plugin-vanta output issue: post-processing with Perl
@eric-glb
eric-glb / git-debug.md
Created August 21, 2023 15:07
How to debug git CLI issues
@eric-glb
eric-glb / show-notification.sh
Last active August 6, 2023 20:27
Bash: show a notification in the terminal's last line
write_message() {
local message
message=" ${*} "
__write() {
local reset col_bg col_fg
reset="$(tput sgr0)"
col_bg="$(tput setab 4)"
col_fg="$(tput setaf 0)"
[[ "${2-}" == "--no-background" ]] && unset col_bg
tput sc
@eric-glb
eric-glb / switch-mic
Last active May 24, 2023 11:58
Linux: short script to mute/unmute mic (to associate to a keyboard shortcut)
#!/usr/bin/env bash
# Short script to mute/unmute mic; to associate to a keyboard shortcut
icon="audio-input-microphone-symbolic"
state=$(amixer set Capture toggle | awk 'match($0, /Front Left.*\[(.*)\]/, a) {print a[1]}')
# On Debian/Ubuntu/...: apt-get install libnotify-bin
which notify-send &>/dev/null && notify-send --hint=int:transient:1 -i $icon "Mic switched: $state"
echo -e "\nMic switched: $state\n"

Use a squid proxy cache container for container build

Assuming we run a squid container configured.

Ensure the RH-based container will only use one external repo

FROM centos:7
RUN  sed -i '/^mirrorlist/d; s/^#baseurl=/baseurl=/' /etc/yum.repos.d/*.repo
...
@eric-glb
eric-glb / docker_logs.md
Last active March 16, 2023 18:18
[docker] logs, logs, logs

[docker] logs, logs, logs...

Increase the log size in docker when building a container

On a centos7

# The service file for docker.service, on a centos7
service_file=/lib/systemd/system/docker.service
@eric-glb
eric-glb / minimal_find_gateway.sh
Last active February 14, 2023 20:21
One-liner to find the gateway from a running minimal container, using /proc/net/route
GW=$(</proc/net/route awk 'NR==2 {print $3}' | sed -E 's/(..)/\1 /g' | if read a b c d; then printf '%d.%d.%d.%d' 0x$d 0x$c 0x$b 0x$a; fi)
@eric-glb
eric-glb / Makefile
Created December 14, 2022 15:19
basic C program for MPI environment validation
test: mpitest
mpirun -np 2 ./mpitest
mpitest: mpitest.c
mpicc mpitest.c -o mpitest
clean:
rm mpitest