Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
What is Bash?

Avinash H. Duduskar Strykar

💭
What is Bash?
  • strykar@livedotcom
  • India
View GitHub Profile
@Strykar
Strykar / myruleset.nft
Created Jan 29, 2021
Create a set similar to ipset in nftables for large IP groups
View myruleset.nft
# ASN 18207 YouBroadBand
# 103.247.210.0/24
# 103.39.4.0/23
# 103.48.96.0/22
# 103.5.70.0/24
# 123.201.0.0/16
# 150.107.208.0/22
# 175.100.128.0/19
# 196.1.104.0/24
# 203.109.64.0/18
@Strykar
Strykar / server_nftables.sh
Created Jan 29, 2021
Server firewall using nftables
View server_nftables.sh
#!/usr/sbin/nft -f
## vim: ft=pf
flush ruleset
include "/home/strykar/myruleset.nft"
define wan = eth0
define cjd = tun0
define wg_int = wg0
define vpn_gw = 192.168.10.1
View makepkg.conf
#!/hint/bash
#
# /etc/makepkg.conf
#
#########################################################################
# SOURCE ACQUISITION
#########################################################################
#
#-- The download utilities that makepkg should use to acquire sources
View autossh_systemd_unit.service
[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"
@Strykar
Strykar / _README.md
Last active Jan 14, 2021 — forked from davejamesmiller/_README.md
Bash General-Purpose Yes/No Prompt Function ("ask")
View _README.md

This is a general-purpose function to ask Yes/No questions in Bash, either with or without a default answer. It keeps repeating the question until it gets a valid answer.

View gist:377ba77479e974326cb19aa894c8ee79
root@apu:~# time awk 'BEGIN { OFMT = "%.0f"; for (i = 0; i < 50000; i++) print (95/100 * 42) }' > /dev/null
real 0m0.517s
user 0m0.435s
sys 0m0.081s
root@apu:~# time awk 'BEGIN { for (i = 0; i < 50000; i++) printf("%.0f\n", (95/100 * 42)) }' > /dev/null
real 0m0.862s
user 0m0.624s
sys 0m0.237s
@Strykar
Strykar / update_sqm.sh
Last active Dec 30, 2020
Update SQM limits in openwrt 4 times a day
View update_sqm.sh
#!/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
_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
# User configurable variables end #
@Strykar
Strykar / owrt_ncurses-Makefile
Created Dec 17, 2020
Attempts at building Openwrt ncurses package with the tic and tput binaries to get htop to work with the kitty terminal
View owrt_ncurses-Makefile
#
# 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
View vulkaninfo.txt
==========
VULKANINFO
==========
Vulkan Instance Version: 1.2.153
Instance Extensions: count = 17
===============================
VK_EXT_acquire_xlib_display : extension revision 1
@Strykar
Strykar / failover.sh
Last active Dec 3, 2020 — forked from Apsu/failover.sh
An example failover script for dual WAN, using a ping healthcheck and managing default routes appropriately
View failover.sh
#!/bin/bash -x
# 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]}" "$@"
exit $?