Skip to content

Instantly share code, notes, and snippets.

FILESYSTEM = "fs.img"
with open(FILESYSTEM, "rb") as f:
fs = f.read()
class ByteArray:
def __init__(self, data = b''):
self.data = data
self.read = 0
def __getitem__(self, idx):
#!/bin/bash
parse_desktop_file() {
local file="$1"
local section=""
local mainexec=""
local mainname=""
while IFS= read -r line || [[ -n "$line" ]]; do
<!doctype html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="https://cdn.tailwindcss.com?plugins=forms,typography,aspect-ratio,line-clamp,container-queries"></script>
<script src="https://cdn.jsdelivr.net/npm/marked/marked.min.js"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/katex.min.css" integrity="sha384-wcIxkf4k558AjM3Yz3BBFQUbk/zgIYC2R0QpeeYb+TwlBVMrlgLqwRjRtGZiK7ww" crossorigin="anonymous">
<script defer src="https://cdn.jsdelivr.net/npm/[email protected]/dist/katex.min.js" integrity="sha384-hIoBPJpTUs74ddyc4bFZSM1TVlQDA60VBbJS0oA934VSz82sBx1X7kSx2ATBDIyd" crossorigin="anonymous"></script>
<script defer src="https://cdn.jsdelivr.net/npm/[email protected]/dist/contrib/auto-render.min.js" integrity="sha384-43gviWU0YVjaDtb/GhzOouOXtZMP/7XUzwPTstBeZFe/+rCMvRwr4yROQP43s0Xk" crossorigin="anonymous"></script>
</head>
import matplotlib.pyplot as plt
def rgb(wavelength):
if 645 <= wavelength <= 780:
R, G, B = 1.0, 0.0, 0.0
elif 580 <= wavelength <= 645:
R, G, B = 1.0, -(wavelength - 645) / (645 - 580), 0.0
elif 510 <= wavelength <= 580:
R, G, B = (wavelength - 510) / (580 - 510), 1.0, 0.0
elif 490 <= wavelength <= 510:
var pathqs = 'path[d="M4.75 3.79l4.603 4.3-1.706 1.82L6 8.38v7.37c0 .97.784 1.75 1.75 1.75H13V20H7.75c-2.347 0-4.25-1.9-4.25-4.25V8.38L1.853 9.91.147 8.09l4.603-4.3zm11.5 2.71H11V4h5.25c2.347 0 4.25 1.9 4.25 4.25v7.37l1.647-1.53 1.706 1.82-4.603 4.3-4.603-4.3 1.706-1.82L18 15.62V8.25c0-.97-.784-1.75-1.75-1.75z"]';
var links = [];
setInterval(() => {
document.querySelectorAll(pathqs)
.forEach(e => {
let div = e.parentNode.parentNode.parentNode;
if(div.classList.contains("r-xoduu5")) {
let postlink = div.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.querySelector('a.css-146c3p1.r-bcqeeo.r-1ttztb7.r-qvutc0.r-1qd0xha.r-a023e6.r-rjixqe.r-16dba41.r-xoduu5.r-1q142lx.r-1w6e6rj.r-9aw3ui.r-3s2u2q.r-1loqt21').href;
if (postlink) {
console.log(postlink);
export default {
async fetch(request) {
const corsHeaders = {
"Access-Control-Allow-Origin": "*",
"Access-Control-Allow-Methods": "GET",
"Access-Control-Max-Age": "86400",
"Access-Control-Allow-Headers": "X-Proxy-URL, X-Proxy-Method, X-Proxy-Header",
};
if (request.method === "OPTIONS") {
import os
def plot(data, row=30):
buf = ""
tb, M = [], max(data)
for i in data:
tb.append(int(row*i/M))
rows = [[] for _ in range(max(tb))]
for p, i in enumerate(rows):
for n, j in enumerate(tb):
@morgan9e
morgan9e / cgiwrap.sh
Last active March 19, 2024 05:38
CGI to HTTP for use with `nc -e`
#!/bin/bash
while IFS=$'\n' read -r line; do
if [[ "$line" == $'\r' ]]; then
raw="${raw}\r"
break;
fi
raw="${raw}${line}\n";
done
IFS=' ' read -r rmethod rpath rver <<< "$raw";
@morgan9e
morgan9e / Containerfile
Last active March 17, 2024 13:32
Wireguard to SOCKS using container.
FROM debian:12
RUN apt-get update -y && \
apt-get install -y wireguard-tools openssh-server iproute2 openresolv
RUN ssh-keygen -A && \
echo 'root:Passw0rd' | chpasswd && \
sed -i 's/#PermitRootLogin.*/PermitRootLogin yes/' /etc/ssh/sshd_config
# sysctl not working and does not matter
#!/bin/bash
echo $0 $@ $(pwd)
cd "$(dirname "$0")"
mkdir -p rootfs upper squash
./busybox tar xzf utils.tar.gz
./busybox sh -c "utils/squashfuse ./root.sqsh ./squash"
./busybox sh -c "utils/unionfs -o cow upper=RW:squash=RO rootfs"