Skip to content

Instantly share code, notes, and snippets.

View fumiyas's full-sized avatar
💭
> 突然の死 <

SATOH Fumiyasu fumiyas

💭
> 突然の死 <
View GitHub Profile
#!/bin/bash
##
## RHEL binutils ld(1) wrapper to do chrpath(1) hacks
## Copyright (c) 2016 SATOH Fumiyasu @ OSS Technology Corp.
## <http://www.OSSTech.co.jp/>
##
## License: GNU General Public License version 3 or later
##
set -u
@fumiyas
fumiyas / centos-vault-repos.bash
Created March 18, 2022 06:39
CentOS: Replace obsolete CentOS repos with CentOS Vault mirrored in Japan
##
## CentOS: Replace obsolete CentOS repos with CentOS Vault mirrored in Japan
## Copyright (c) 2022 SATOH Fumiyasu @ OSSTech Corp., Japan
##
## License: GNU General Public License version 3
##
set -u
set -e
umask 0022
--- /usr/share/vpnc-scripts/vpnc-script 2021-08-19 01:47:24.000000000 +0900
+++ /home/fumiyas/bin/vpnc-script 2022-02-03 18:01:06.473080699 +0900
@@ -147,7 +147,10 @@
RESOLVEDENABLED=0
fi
-if [ -r /etc/openwrt_release ] && [ -n "$OPENWRT_INTERFACE" ]; then
+if :; then
+ MODIFYRESOLVCONF=echo
+ RESTORERESOLVCONF=echo
@fumiyas
fumiyas / run_and_get_rc.sh
Last active December 15, 2021 03:30
Shell: Get a return code (exit code) from a command on set -e
#!/bin/sh
run_and_get_rc() {
local _rc_vname="$1"; shift
local _rc
local _shopts="$-"
if [ "${_rc_vname#*[!a-z_]}" != "$_rc_vname" ]; then
echo "run_and_get_rc: Invaid return variable name: $_rc_vname" 1>&2
exit 1
@fumiyas
fumiyas / httpd.conf
Last active December 15, 2021 03:20
Apache HTTPD: Default virtualhost definition to deny access to an unexpected server name, but ACME
Alias /.well-known/acme-challenge/ /var/www/acme/.well-known/acme-challenge/
<Directory /var/www/acme/.well-known/acme-challenge>
Require all granted
</Directory>
<VirtualHost 127.0.0.1:80>
<IfModule status_module>
<Location /server-status>
Require ip 127.0.0.1 ::1
SetHandler server-status
#!/bin/sh
##
## ~/bin/diff-highlight
##
set -u
if [ -n "${BASH+set}" ]; then
shopt -s lastpipe 2>/dev/null ## Bash 4.2+ for `exec ... |exec ...`
fi
@fumiyas
fumiyas / dnsstubq.c
Last active October 1, 2021 10:10
Command-line DNS stub resolver
/*
Command-line DNS stub resolver
Copyright (C) 2018-2021 SATOH Fumiyasu @ OSS Technology Corp., Japan
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
@fumiyas
fumiyas / update-ca-trust-hook.spec
Last active September 16, 2021 00:00
RHEL: Hack: Run commands after update-ca-trust(8)
## OSSTech update-ca-trust-hook
## ======================================================================
%{?vendor_package}
%global rel 152
#%%global rel_extra experimental
%global dist_name update-ca-trust-hook
%global dist_ver_base 1.0
@fumiyas
fumiyas / authorized_keys
Last active March 24, 2021 08:17
Proxy server to connect over SSH
## Allow the key to execute the specific socat command-line only
restrict,command="exec socat -lh -d STDIO TCP-CONNECT:10.0.0.1:389" ssh-...
@fumiyas
fumiyas / socat-over-serial-getty.sh
Last active March 4, 2021 00:59
socat over serial port
#!/bin/sh
##
## socat over serial: getty
## Copyright (c) 2016 SATOH Fumiyasu @ OSS Technology Corp., Japan
##
## License: GNU General Public License version 3
##
set -u