Skip to content

Instantly share code, notes, and snippets.

View Nill-R's full-sized avatar

Nill Ringil Nill-R

View GitHub Profile
@Nill-R
Nill-R / nftables.conf
Created January 18, 2023 20:19
nftables log output new state
#!/usr/sbin/nft -f
flush ruleset
table ip filter {
chain output_log {
type filter hook output priority 0;
oifname eth0 tcp dport 80 ct state new log prefix "New outgoing http connection: " group 1 accept
oifname eth0 tcp dport 443 ct state new log prefix "New outgoing https connection: " group 1 accept
@Nill-R
Nill-R / nftables.conf
Last active October 12, 2022 10:31
VPN killswitch by nftables
#!/usr/sbin/nft -f
flush ruleset
table inet filter {
counter dns {
}
counter dot {
}
counter l2tp{
}
counter l2tp_4500 {
@Nill-R
Nill-R / 10-eth-wlan-bridge.yaml
Last active January 5, 2022 05:36
RPi 4B+ ethernet and wlan bridge config for netplan
network:
ethernets:
eth0:
match:
driver: bcmgenet smsc95xx lan78xx
set-name: eth0
dhcp4: false
dhcp6: false
wifis:
@Nill-R
Nill-R / convert_to_utf8.bash
Last active December 31, 2021 07:38
Convert to utf8
#!/usr/bin/env bash
# https://github.com/nijel/enca
find ./ -name "*.php" -o -name "*.html" -o -name "*.css" -o -name "*.js" -type f | while read file; do enca -L russian -x UTF-8 "$file"; done;
@Nill-R
Nill-R / lipsum.sh
Last active December 18, 2021 01:31 — forked from candu/lipsum
Command-line Lorem Ipsum generator using curl, lipsum.com, and jq
#!/bin/sh
AMOUNT=10
WHAT=paras
START=true
while getopts ":n:wpbls" opt; do
case $opt in
n)
AMOUNT=$OPTARG
@Nill-R
Nill-R / nftables.conf
Last active January 3, 2022 16:36
First look to nftables
#!/usr/sbin/nft -f
flush ruleset
define CF_IPS = {
173.245.48.0/20,
103.21.244.0/22,
103.22.200.0/22,
103.31.4.0/22,
141.101.64.0/18,
@Nill-R
Nill-R / config.json
Created October 7, 2021 09:55
nginx and shadowsocks-rust configs for ss+v2ray+nginx
{
"server":"127.0.0.1",
"server_port":8389,
"local_port":3181,
"password":"YOUR_PASSWORD_HERE",
"timeout":60,
"method":"aes-256-gcm",
"plugin":"v2ray-plugin",
"plugin_opts": "server",
"fast_open":true,
[Unit]
Description=Shadowsocks-rust Default Server Service
Documentation=https://github.com/shadowsocks/shadowsocks-rust
After=network.target
[Service]
Type=simple
DynamicUser=yes
LimitNOFILE=32768
ExecStart=/usr/local/bin/ssserver --config /etc/shadowsocks-rust/config.json --log-without-time
## NOTE! this works for me but has recieved very limited testing!
## Enable auto updates for GITEA:
# shell script to check github repo for "latest" tag and compare to current running gitea version
# assumes systemd is in use to manage gitea service
# assumes gitea binary file lives at: /usr/local/bin/gitea
# assumes Ubuntu 18.04 is in use (but should work on any debian / apt system)
# assumes your local gitea api instance is reachable at: "http://192.168.4.22:3000/api/v1/version"
# assumes your ok with downloading the latest binary from github without any validation
#
@Nill-R
Nill-R / monitoring_https.bash
Last active February 26, 2020 07:10
Simple monitoring scripts using nagios plugin
#!/usr/bin/env bash
if [ -z "$1" ]; then
echo "No domain for check"
exit 1
fi
/usr/lib/nagios/plugins/check_http -j HEAD --ssl -H $1 > /tmp/$1.check 2>&1
if [ $? -eq 0 ]