Skip to content

Instantly share code, notes, and snippets.

View highgain86j's full-sized avatar

Tahiro Hashizume highgain86j

View GitHub Profile
@highgain86j
highgain86j / nginx_host_only_to_fqdn_redirect
Last active October 15, 2023 11:45
nginx configuration for host-only to fqdn redirecting.
;Where you have local httpd and client machines receiving domain-name via DHCP, following addition to nginx config
;would often be useful.
;For clarification, client machines get domain-name specified as 'intra.example.com' via DHCP in this example.
;BTW this type of setup is often found in situations where hostname-only name resolution would make things easier, say where
;you have Windows Active Directory in place, or local resources available, like network printers, NAS and so on.
;Whils specifying local domain over DHCP serves well for simple name-resolution applications that does not require FQDN,
;virtual-hosts as typically found configured on web servers would not favor that.
;Specifically, requests to something like 'http://www' must be redirected to 'http://www.intra.example.com', the proper FQDN.
;
;As per nginx documentation, you may have multiple server_name directives each specifying different host-only part of fqdn.
@highgain86j
highgain86j / plugin_directory_organizer.bat
Last active October 8, 2023 12:54
This batch file makes the management of VST plugins easier on Windows.
rem @echo off
if "%PROCESSOR_ARCHITECTURE%" equ "AMD64" (
rem x64
if not exist "%ProgramFiles%\Common Files\VST2" (
mkdir "%ProgramFiles%\Common Files\VST2"
)
if not exist "%ProgramFiles%\Common Files\VST3" (
mkdir "%ProgramFiles%\Common Files\VST3"
@highgain86j
highgain86j / Win11tweaks.bat
Created July 25, 2022 04:35
Windows 11 tweaks
@echo off
reg add "HKCU\Software\Classes\CLSID\{86ca1aa0-34aa-4e8b-a509-50c905bae2a2}\InprocServer32" /f /ve
reg add "HKCU\Software\Classes\CLSID\{d93ed569-3b3e-4bff-8355-3c44f6a52bb5}\InprocServer32" /f /ve
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\Start_ShowClassicMode" /t REG_DWORD /d 1
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\TaskbarSi" /t REG_DWORD /d 0
exit
@highgain86j
highgain86j / runthis.sh
Last active December 1, 2021 02:27
OpenWrt must-have
#!/bin/bash
for file in `find /etc/bird*.conf /etc/config/ -type f`; do
sed -i 's/\(10\.255\.53\.\)0/\1100/g' "${file}"
sed -i 's/\(10\.255\.53\.\)90/\1110/g' "${file}"
sed -i 's/\(10\.1\.1[4,5]\.\)90/\130/g' "${file}"
done; \
for service in network bird4 bird6; do
"/etc/init.d/${service}" restart
done
@highgain86j
highgain86j / disable-wifi-power-management.service
Created December 7, 2019 10:32
systemd config to disable wifi power management at boot
[Unit]
Description=Disable Wi-Fi power management on wls1
Requires=sys-subsystem-net-devices-wls1.device
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/usr/sbin/iwconfig wls1 power off
ExecStop=/usr/sbin/iwconfig wls1 power on
@highgain86j
highgain86j / dslite.sh.diff
Created September 13, 2019 08:00
Obvious, isn't it?
*** dslite.sh.orig 2019-09-13 16:50:15.182508583 +0900
--- dslite.sh 2019-09-13 16:51:34.557074668 +0900
***************
*** 1,3 ****
--- 1,4 ----
+
#!/bin/sh
# dslite.sh - IPv4-in-IPv6 tunnel backend
# Copyright (c) 2013 OpenWrt.org
*************** proto_dslite_setup() {
@highgain86j
highgain86j / add_encaplimit_command.sh
Last active September 1, 2021 20:00
This bash file enables configuration of encaplimit on tunnel interfaces on EdgeOS.
#!/bin/bash
temp="node.def"
interface_templates_dir=/opt/vyatta/share/vyatta-cfg/templates/interfaces
ip4ip6_dir=`find ${interface_templates_dir} -type d -name node\.tag | egrep '\/ipv6-tunnel\/node\.tag$'`
ip4ip6_encaplimit_dir="${ip4ip6_dir}/encaplimit"
ip4ip4_dir=`find ${interface_templates_dir} -type d -name node\.tag | egrep '\/tunnel\/node\.tag$'`
ip4ip4_encaplimit_dir="${ip4ip4_dir}/encaplimit"
@highgain86j
highgain86j / edgeos_curl_update.sh
Last active January 28, 2019 01:00
edgeos_curl_update.sh
#!/bin/bash
wrapper_op=/opt/vyatta/bin/vyatta-op-cmd-wrapper
wrapper_cfg=/opt/vyatta/sbin/vyatta-cfg-cmd-wrapper_cfg
function write_update_main(){
local temp_upgrade_scr=/config/update.sh
echo '#!/bin/bash' | sudo tee ${temp_upgrade_scr}
echo 'PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin' | sudo tee -a ${temp_upgrade_scr}
cat << EOF | while read line; do echo "${wrapper_cfg} ${line}" | sudo tee -a ${temp_upgrade_scr}; done
@highgain86j
highgain86j / 90-alsa.rules
Created November 5, 2018 13:07
udev rules
SUBSYSTEM!="sound", GOTO="my_audio_end"
ACTION=="add", GOTO="my_usb_audio_add"
ACTION=="remove", GOTO="my_usb_audio_remove"
ACTION!="add", ACTION!="remove", GOTO="my_usb_audio_end"
LABEL="my_usb_audio_add"
ATTRS{idVendor}=="279d", ATTRS{idProduct}=="0006", ATTR{id}="sa9023", ATTR{index}="-2"
@highgain86j
highgain86j / screen.sh
Created October 28, 2018 04:05
screen for backgrounding
#!/bin/bash
function launch(){
local execbin="`which ${target}`"
local str="`screen -list "${target}" | egrep 'Detached|Attached' | awk '{print $1}'`"
ps aux | egrep -v 'grep|ps aux|screen|SCREEN' | grep pts | grep \^${USER} | grep ${target}
if [ "${str}" != "" ]; then
echo -e "\"${str}\" is present."
echo "Reattaching... (ignoring options)"
sleep 1