Skip to content

Instantly share code, notes, and snippets.

View Strykar's full-sized avatar
💭
What is Bash?

Avinash H. Duduskar Strykar

💭
What is Bash?
  • India
View GitHub Profile
@Strykar
Strykar / update_sqm.sh
Last active January 23, 2023 02:23
Update SQM limits in openwrt 4 times a day
#!/bin/sh
# v0.1 Avinash H. Duduskar <strykar@live.com>
# This adjusts OpenWRT SQM settings by re-calculating up/down bandwidth
# Needs the Speedtest.net CLI binary - https://www.speedtest.net/apps/cli
# Call this script every 4 or 6 hours via cron
set -euf -o pipefail
_sqm_int="queue" # Your actual wan interface: ifstatus wan | grep -e l3_device
_pul="90" # Percentage of wan upload speed to set, 90-95 is good
_pdl="95" # Percentage of wan download speed to set, 90-95 is good
@Strykar
Strykar / weechat.conf
Last active December 25, 2022 07:35
A single file config for adding bots that probe Weechat's relay port to a Fail2ban jail (/etc/fail2ban/jail.d/weechat.conf)
[weechat]
filter =
enabled = false
banaction = nftables
action = nftables-allports[name=weechat]
backend = auto
logpath = /home/user/.local/share/weechat/logs/core.weechat.weechatlog
logencoding = utf-8
port = 9000
protocol = tcp
@Strykar
Strykar / owrt_ncurses-Makefile
Created December 17, 2020 07:14
Attempts at building Openwrt ncurses package with the tic and tput binaries to get htop to work with the kitty terminal
#
# Copyright (C) 2006-2015 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
include $(TOPDIR)/rules.mk
PKG_NAME:=ncurses
@Strykar
Strykar / gist:8db4f0e060e3811acee208686bf58a34
Created November 8, 2022 13:08 — forked from helloingob/gist:3efc7c4babaea3f921525a74e8f063b2
How to use aircrack-ng run by archlinux on a raspberry pi
Based on https://miloserdov.org/?p=659
Hardware:
- TP-Link TL-WN722N + TP-Link TL-ANT2408CL
- Raspberry Pi 3
1.) Get Archlinux für Raspberry
RaspArch Build 181117 (http://raspex.exton.se/?p=983)
Download (https://sourceforge.net/projects/rasparch/files/latest/download)
@Strykar
Strykar / failover.sh
Last active November 3, 2022 21:03 — forked from Apsu/failover.sh
An example failover script for dual WAN, using a ping healthcheck and managing default routes appropriately
#!/bin/bash -x
set -euf -o pipefail
# Test if sudo exists, comment out if sudo isn't installed
command -v sudo >/dev/null 2>&1 || { printf 'I require to be run as root, or sudo to be installed. Aborting. \n' >&2; exit 1; }
# Setting gateway's needs root privileges, elevate with sudo, tested on kernel 5.8.5-arch1-1.
# Comment out if script is called as root
if [ "$EUID" != 0 ]; then
sudo "${BASH_SOURCE[0]}" "$@"
@Strykar
Strykar / weechat_cert.sh
Last active November 3, 2022 21:02
acme.sh reloadcmd for Weechat relay SSL cert
#!/bin/bash
# Acme.sh reloadcmd file
set -euf -o pipefail
# Setup the TLS file the way Weechat expects it
/usr/bin/cat /home/strykar/.acme.sh/i5.xxx.in/i5.xxx.in.key > /home/strykar/.config/weechat/ssl/relay.pem
/usr/bin/cat /home/strykar/.acme.sh/i5.xxx.in/fullchain.cer >> /home/strykar/.config/weechat/ssl/relay.pem
# Run the /relay sslcertkey command via Weechat's FIFO to reload the new cert
# Weechat's FIFO plugin must be loaded and running
[Unit]
Description=AutoSSH service to remotely access signald's unix socket for weechat's signal.py (/smsg +145789323231)
After=network-online.target
# Use this instead if autossh will interact with the local SSH server
# After=network-online.target sshd.service
[Service]
Environment="AUTOSSH_GATETIME=30"
Environment="AUTOSSH_POLL=30"
Environment="AUTOSSH_FIRST_POLL=30"
#BadTCP
tcp.analysis.flags && ! tcp.analysis.window_update
#TCP header length is less than 28 and has the SYN flag enabled
(tcp.hdr_len < 28) && (tcp.flags.syn == 1)
#TCP stream time delta < 1s and packet does not have the RST/FIN flag set and no HTTP GET [&& (http.request.method != "GET")]
#Plot I/O chart vs tcp.time_delta
(tcp.time_delta > 1) && (tcp.flags.reset == 0) && (tcp.flags.fin == 0)
(tcp.time_delta > .5) && (tcp.flags.reset == 0) && (tcp.flags.fin == 0)
@Strykar
Strykar / server_nftables.sh
Last active May 20, 2022 09:09
Server firewall using nftables
#!/usr/sbin/nft -f
## vim: ft=pf
flush ruleset
define wan = eth0
define cjd = tun0
define wg_int = wg0
define vpn_gw = 192.168.10.1
define vpn_net = 192.168.10.0/24
define proto_allow = { ah, esp, igmp, ipv6 }
2022-04-01 20:52:37,777 - pyradio.radio - INFO - <<<===--- Program start ---===>>>
2022-04-01 20:52:37,777 - pyradio.radio - INFO - TUI initialization on python v. 3.10.4 (main, Mar 23 2022, 23:05:40) [GCC 11.2.0] on Arch Linux (AUR)
2022-04-01 20:52:37,777 - pyradio.radio - INFO - Terminal supports 256 colors
2022-04-01 20:52:37,777 - pyradio.themes - DEBUG - _do_init_pairs: {'Stations': [7, 0], 'Status Bar': [0, 2], 'Normal Cursor': [0, 5], 'Active Cursor': [0, 2], 'Active Station': [2, 0], 'PyRadio URL': [4, 0], 'Messages Border': [3, 0], 'Edit Cursor': [7, 5], 'Colors': 8, 'Name': 'dark', 'Path': ''}
2022-04-01 20:52:37,778 - pyradio.player - INFO - Probing available multimedia players...
2022-04-01 20:52:37,778 - pyradio.player - INFO - Implemented players: mpv, mplayer, vlc
2022-04-01 20:52:37,779 - pyradio.player - INFO - <class 'pyradio.player.VlcPlayer'> supported.
2022-04-01 20:52:37,779 - pyradio.radio - DEBUG - body starts at line 2, ends at line 66
2022-04-01 20:52:37,782 - pyradio.radio - DEBU