Skip to content

Instantly share code, notes, and snippets.

@goodarzi
goodarzi / install.sh
Last active July 24, 2024 18:01
chan sccp asterisk 20
#!/usr/bin/env bash
ASTERISK_SRC_DIR=/path/to/asterisk/src
git clone https://github.com/chan-sccp/chan-sccp --depth=1
cd chan-sccp
./configure --with-asterisk-version=18 --with-asterisk=$ASTERISK_SRC_DIR
make -j
sudo make install
sudo make reload
#!/usr/bin/env bash
# ]
# {
# "val": "192.168.1.23",
# "upload": {
# "packets": 613376,
# "bytes": 111798380,
# "megabytes": 106
# },
@goodarzi
goodarzi / qt-6.5.3-debian12.sh
Created July 2, 2024 06:37
manual installtion of qt 6.5.3 and qt creator 14 on debian bookworm
# install qt
# https://doc.qt.io/qt-6/linux.html
# https://doc.qt.io/qt-6/linux-requirements.html
# https://doc.qt.io/qt-6/configure-options.html
mkdir -p ~/code/qt
cd ~/code/qt
sudo apt-get install build-essential libgl1-mesa-dev
# qtbase
@goodarzi
goodarzi / xfce-vnc.sh
Created February 9, 2024 19:32
Install vnc server debian 12 (bookworm)
#!/usr/bin/env bash
sudo apt install tightvncserver
if [ ! -e $HOME/.Xresources ]; then
touch $HOME/.Xresources
fi
echo ":1=$USER" | sudo tee -a /etc/tigervnc/vncserver.users
@goodarzi
goodarzi / systemd-timer-install.sh
Created January 29, 2024 10:09
Bash script to install it self as systemd timer
#!/usr/bin/env bash
# set -x
script_name=$(basename "${0%.*}")
install_systemd_timer() {
if [ -z "$1" ]; then
echo "Timer interval not defined"
return 1
@goodarzi
goodarzi / reboot-hg8245h.expect
Created January 28, 2024 10:16
Huawei HG8245H ONT reboot script
#!/usr/bin/expect
set timeout 20
spawn telnet 192.168.0.1
expect "Login:"
send "root\r"
expect "Password:"
send "admin\r"
expect "WAP>"
send "reset\r"
@goodarzi
goodarzi / doh-adguard.mobileConfig
Last active November 1, 2023 21:48
iOS DNS Settings for cellular data
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>PayloadContent</key>
<array>
<dict>
<key>DNSSettings</key>
<dict>
<key>DNSProtocol</key>
@goodarzi
goodarzi / ipasn-ipset.sh
Created October 30, 2023 20:07
Get ASN from ip address and then create ipset with all IP4/6 prefix associated with ASN
#!/usr/bin/env bash
[[ -v 1 ]] && IP=$1 || { echo "Please enter ip address"; exit 1; }
ASNS=$(curl -s https://stat.ripe.net/data/network-info/data.json?resource=$IP | jq -r .data.asns[])
for asn in $ASNS; do
echo "-i origin AS${asn}" | nc whois.radb.net 43 | tee >(grep '^route6:' | sed 's/.*\s\([abcdef0-9:\/]*\)/\1/' >> as${asn}_route6) >(grep '^route:' | sed 's/.*\s\([-0-9\.\/]*\)/\1/' >> as${asn}_route4) 1>/dev/null
done
ipset create as${asn}_route4 nethash -exist
ipset create as${asn}_route6 nethash family inet6 -exist
@goodarzi
goodarzi / bash-macos.sh
Last active November 1, 2023 18:11
Install Bash 5.2 on macOS
# Install bash using HomeBrew
brew install bash
# Add new Bash to macOS shell list
sudo echo -e "/usr/local/bin/bash\n" >> /etc/shells
# Setup macOS .bashrc
[[ -f ~/.bashrc ]] || touch ~/.bashrc
grep -v '^\s*#' ~/.profile | grep '\. ~/\.bashrc\|source ~/\.bashrc' || echo -e "\n[[ '\$BASH' && -f ~/.bashrc ]] && . ~/.bashrc\n" >> ~/.profile