Skip to content

Instantly share code, notes, and snippets.

@e7d
e7d / remove-obsolete-gpg-key-from-dnf.md
Last active April 25, 2024 20:21
Remove obsolete GPG key from DNF (Fedora)
@e7d
e7d / sample.sh
Last active December 10, 2023 10:45
Bash "try catch"
#!/bin/bash
export AnException=100
export AnotherException=101
# start with a try
try
( # open a subshell !!!
echo "do something"
[ someErrorCondition ] && throw $AnException
@e7d
e7d / find-container-by-pid.sh
Created June 26, 2023 13:43
Find a PID running container name
#!/bin/bash
set -e
error() {
echo "Error: $1"
exit 1
}
trap 'error "An unexpected error occurred. Exiting."' ERR
@e7d
e7d / README.md
Last active December 19, 2022 09:13
[Debian] Build a Squid anonymous proxy from source code

If you don't want to build Squid from scratch, you can simply Setup a Squid anonymous proxy

Build a Squid anonymous proxy from source code

Please note that this whole manual refers to the version 3.5.23 of Squid. You probably would have to adapt some commands to the version you will actually download.

Table of contents

@e7d
e7d / CIFS-auto-mount.md
Last active April 12, 2022 14:04
Auto-Mount Windows shared folders (CIFS) in Debian Stretch when network is ready

Ensure necessary dependencies are installed:

sudo apt-get update
sudo apt-get install cifs-utils

Add post-up /etc/network/if-up.d/cifs-mount to your interface (here eth0) in /etc/network/interfaces file:

# This file describes the network interfaces available on your system
@e7d
e7d / README.md
Last active March 23, 2022 22:40
[Debian] Setup a Squid anonymous proxy
@e7d
e7d / openfortigui.sh
Last active October 12, 2021 13:38 — forked from yoyosan/openfortigui.md
Build openfortigui in Fedora 34+
#!/bin/sh
# install required packages:
sudo dnf install qt5-qtbase-devel openssl-devel qtkeychain-qt5-devel -y
# create a symlink to /usr/bin/qmake, if needed
sudo ln -s /usr/lib64/qt5/bin/qmake /usr/bin/qmake
# build openfortigui code
git clone https://github.com/theinvisible/openfortigui.git /tmp/openfortigui
@e7d
e7d / switch-sink.sh
Last active August 30, 2021 10:14
Switch output device using PulseAudio sound server Control (pactl)
#!/bin/bash
if [ ! -x "$(command -v pactl)" ]; then
cat <<EOL >&2
$(basename $0): missing pactl
The PulseAudio "pactl" binary is required to use this program.
EOL
exit 1
fi
#!/bin/sh
maxBlockSize=1073741824 # 1 GB
maxBlockCount=1024
testSize=1073741824 # 1 GB
testDir=$1
if [ -z "$1" ]; then
testDir="/tmp"
fi
testFile="${testDir}/dd.dat"
@e7d
e7d / gen-self-cert.sh
Last active May 18, 2021 13:40
Generate self-signed certificate with OpenSSL
#!/bin/bash
# read input
domain=$1
if [ -z $domain ]; then
read -p "domain: " domain
fi
rsa=$2
if [ -z $rsa ]; then
rsa=2048 # 2048 bits by default