Skip to content

Instantly share code, notes, and snippets.

View Himura2la's full-sized avatar
💭
Nya?

Himura Kazuto Himura2la

💭
Nya?
View GitHub Profile
@Himura2la
Himura2la / ssl-query.sh
Created December 6, 2024 08:43
Use OpenSSL to get information on a remote TLS cert
ssl-query() { openssl s_client -connect "$1" </dev/null | openssl x509 -text -noout; }
@Himura2la
Himura2la / README.md
Last active September 11, 2024 08:53
Convert text file to JSON string

Usage

wget https://gist.githubusercontent.com/Himura2la/c2ef40ce86b1698e1a7db8b144657912/raw/toJson.sh
chmod +x toJson.sh
./toJson.sh < file
@Himura2la
Himura2la / update-config.sh
Created July 1, 2024 19:28
Update file in a named volume
#!/bin/sh
echo "Usage: $0 deploy|extract (default: deploy)"
engine=podman
script_dir="$(readlink -f "$(dirname "$0")")"
set -x
action=${1-deploy}
cc=$($engine run --rm -dtv grafana-config:/g -v prometheus-config:/p busybox)
@Himura2la
Himura2la / requests.py
Last active April 3, 2024 10:49
An alternative for undeservedly popular library
from urllib.request import urlopen, Request, HTTPError
def fetch(url, method=None, data=None, headers={}):
try:
with urlopen(Request(
url,
data=data.encode('ascii') if data else None,
headers=headers,
method=method
)) as resp:
@Himura2la
Himura2la / certs.sh
Created January 10, 2024 12:30
Generate your own TLS certificate chains
# CA
openssl ecparam -genkey -name prime256v1 -out ca.key
cat > ca.conf <<EOF
[req]
prompt = no
x509_extensions = ext
distinguished_name = dn
[ext]
stat /dev/ttyUSB0 # Gid: ( 18/ dialout)
sudo usermod -aG dialout $USER
sudo reboot
@Himura2la
Himura2la / nginx.conf
Created October 13, 2023 20:15
nginx plain text response
server {
listen 80;
server_name nya.nya;
default_type text/plain;
return 200 'nya nyaaaa~\n';
}
@Himura2la
Himura2la / Win11_LocalDB_Fix.reg
Created August 21, 2023 13:12
Fix SQL Server Express LocalDB on Windows 11
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\MSSQL15E.LOCALDB\MSSQLServer\Parameters]
"SQLArg0"="-T1800"
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\MSSQL16E.LOCALDB\MSSQLServer\Parameters]
"SQLArg0"="-T1800"
@Himura2la
Himura2la / csv_sup.py
Last active July 4, 2023 11:38
CSV Supplementer
import json
import os
import csv
from urllib.request import urlopen, Request, HTTPError
csv_path = os.path.expanduser(r"~\Desktop\data.csv")
additional_cols = []
def fetch_additional_data(row):
# TODO

"([^"]+)"$ ➡️ $1

This regex is used for the following CSV transformation:

... requests
... SY 167,DSW 167
... DSJ 119
... KA 330,INS 251,K 153