Skip to content

Instantly share code, notes, and snippets.

View Alceatraz's full-sized avatar
🉑
Mojar +1s

Alceatraz Warprays Alceatraz

🉑
Mojar +1s
View GitHub Profile
@Alceatraz
Alceatraz / htpasswd.html
Created February 11, 2025 12:30
APR1(Apache MD5) htpasswd generate in JavaScript
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8"/>
<title>APR1 HTPasswd Generator</title>
</head>
<body>
<p>See console</p>
</body>
<script>
#!/usr/bin/env bash
CIPHERS='ALL:eNULL'
DELAY=${2:-0.1}
SERVER=${1:?usage: $0 <host:port> [delay, default is ${DELAY}s] [ciphers, default is ${CIPHERS}]}
MAXLEN=$(openssl ciphers "$CIPHERS" | sed -e 's/:/\n/g' | awk '{ if ( length > L ) { L=length} }END{ print L}')
echo Using $(openssl version).
declare -A TLSMAP=( [tls1_1]=cipher [tls1_2]=cipher [tls1_3]=ciphersuites )
@Alceatraz
Alceatraz / install.sh
Created November 25, 2024 06:10
K3s in Debian 12 Sandbox by systemd-nspawn
debootstrap --include=dbus,systemd stable /opt/container/k3s https://mirrors4.tuna.tsinghua.edu.cn/debian/
echo 1 > /proc/sys/net/ipv4/ip_forward
echo 1 > /proc/sys/vm/overcommit_memory
echo 196608 > /proc/sys/net/netfilter/nf_conntrack_max
echo 1 > /proc/sys/kernel/panic_on_oops
echo 10 > /proc/sys/kernel/panic
modprobe br_netfilter
modprobe overlay
@Alceatraz
Alceatraz / TOTP.java
Last active March 9, 2024 14:32
RFC6238 TOTP in java lib-less only std lib
package org.example;
import javax.crypto.Mac;
import javax.crypto.spec.SecretKeySpec;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;
import java.security.SecureRandom;
@Alceatraz
Alceatraz / dget.sh
Created March 22, 2023 09:42
A simple script to download container image
#!/usr/bin/env bash
name=$1
file=$1
file=$(sed "s#/#-#g" <<< "$file")
file=$(sed "s#:#-#g" <<< "$file")
file="$file.tar.gz"
docker pull "your.mirror.site/$name"
docker tag "your.mirror.site/$name" "$name"