Skip to content

Instantly share code, notes, and snippets.

View eric-glb's full-sized avatar

Éric eric-glb

  • France
  • 10:21 (UTC +02:00)
View GitHub Profile
@eric-glb
eric-glb / 20GB_random.sh
Last active December 14, 2022 13:40
Generate quickly 20GB of random data using openssl
#!/usr/bin/env bash
# Generate 20GB file of random data in /dev/shm (~ramdisk)
time openssl enc -aes-256-ctr \
-pass pass:"$(dd if=/dev/urandom bs=128 count=1 2>/dev/null | base64)" \
-nosalt < /dev/zero 2>/dev/null |
dd bs=4M \
count=5120 \
status=progress \
iflag=fullblock \
@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
@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 / 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

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 / 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"
@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 / git-debug.md
Created August 21, 2023 15:07
How to debug git CLI issues
@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 / 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: