Skip to content

Instantly share code, notes, and snippets.

View k0nsl's full-sized avatar
🎯
Focusing

k0nsl k0nsl

🎯
Focusing
View GitHub Profile
@k0nsl
k0nsl / centos7-wifi-hotspot
Created February 14, 2021 22:10
Centos 7 Wi-Fi Hotspot (nmcli)
This is probably the simplest way to create a Wi-Fi hotspot in Centos 7:
nmcli dev wifi hotspot ifname wifi-interface ssid "k0nsl-wifi" password "unsecure"
@k0nsl
k0nsl / keep-resolvers.sh
Created July 28, 2020 09:09
A sort of "set and forget" type of operation in order to not have your resolv.conf overwritten; uses two Danish resolvers (unicast and anycast respectively). Can be run once or placed in "/etc/cron.hourly" as "keep-resolvconf" -- remember to make it executable too. That is all.
#!/bin/sh
## this file can live in /etc/cron.hourly as "keep-resolvers".
sudo chattr -i /etc/resolv.conf
sudo chattr -e /etc/resolv.conf
sudo rm -f /etc/resolv.conf
sudo touch /etc/resolv.conf.tmp
sudo echo "nameserver 91.239.100.100" >> /etc/resolv.conf.tmp
sudo echo "nameserver 89.233.43.71" >> /etc/resolv.conf.tmp
@k0nsl
k0nsl / debian-unnecessary-packages.sh
Last active December 8, 2023 18:09
Remove non-critical packages (Debian)
# ref. https://wiki.debian.org/ReduceDebian
apt-get remove acpi acpid aptitude at aspell aspell-en avahi-daemon bash-completion bc bin86 bind9-host ca-certificates console-common console-data console-tools dc debian-faq debian-faq-de debian-faq-fr debian-faq-it debian-faq-zh-cn dhcp dhcp3-client dnsutils doc-debian eject fdutils file finger foomatic-filters gettext-base groff gnupg gnu-efi hplip iamerican ibritish info ispell laptop-detect libavahi-compat-libdnssd1 libc6-amd64 manpages mtools mtr-tiny mutt netcat net-tools ncurses-term openssh-client openssh-server openssl pidentd ppp pppconfig pppoe pppoeconf read-edid reportbug ssh tasksel tcsh traceroute unzip usbutils vim-common vim-tiny wamerican w3m whois zeroinstall-injector zip -y
apt-get update
#clear log files recursively:
for i in $(find /var/log -type f); do cat /dev/null > $i; done
@k0nsl
k0nsl / myweechat.md
Created April 30, 2017 16:20 — forked from pascalpoitras/config.md
My always up-to-date WeeChat configuration (weechat-dev)

WeeChat Screenshot

Enable mouse support

/mouse enable

Encrypted password in sec.conf

@k0nsl
k0nsl / gist:1aace9f2ca8e29a8dea7e4ac34131e8d
Created April 30, 2017 15:57 — forked from csexton/gist:3772971
/etc/init.d/znc startup script
#! /bin/sh
### BEGIN INIT INFO
# Provides: znc
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: znc initscript
# Description: This is the init-Script for znc.
### END INIT INFO
# Author: Henner M. Kruse
@k0nsl
k0nsl / fetcher.sh
Created April 16, 2017 17:28 — forked from narolinus/fetcher.sh
Mailcow: Fetching external resources and convert stylesheets accordingly.
#!/bin/bash
# reuires google-font-download by Clemens Lang
# https://github.com/neverpanic/google-font-download
# 1) Put both scripts in mailcow-dockerized home directory.
# 2) Reset data/web to default (only css, fonts an js).
# rm -rf data/web/{css,fonts,js} && git checkout -- data/web && git status
# 3) Run fetcher.sh
#!/bin/bash
err502=`curl -1IsS --ciphers ecdhe_ecdsa_aes_128_sha https://domain.com | grep 502`
if [[ "$err502" == *"502"* ]]; then
/sbin/service php-fpm restart
date >> /site/tools/php-fpm-restart.log
fi
@k0nsl
k0nsl / auto-ovpn.sh
Created April 4, 2017 13:22 — forked from lowstz/auto-ovpn.sh
Linux openvpn auto reconnect script
#!/bin/bash
export PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin
### Thanks Xream's Work XD
# if you don't have several vpn servers to select, you can comment following line
# and use your openvpn config file name to replace "${host}.ovpn" in while loop.
read -p "Select the host: " host
@k0nsl
k0nsl / A - Information
Created March 29, 2017 14:03 — forked from doonga/A - Information
Plex NGINX reverse proxy config using Cloudflare on Ubuntu 16.04
Credit where credit's due, I mainly used these 3 resources to get this all working. There were several others but I don't exactly remember which is which. So at least here are the 3 main places that I used.
The vast majority of this came from this link, the others helped me make it work for Plex.
http://emby.media/community/index.php?/topic/30975-reverse-proxy-with-ssl-hostname-routing-and-embyopenvpn-port-sharing/
https://gist.github.com/spikegrobstein/4384954
https://forums.plex.tv/discussion/207725/ubuntu-14-04-4-lts-plex-incorrectly-handles-lower-case-headers#latest
The data flow here is: