Skip to content

Instantly share code, notes, and snippets.

@darklinden
darklinden / caddyfile
Last active June 12, 2024 02:59
caddyfile for simple file server
# docker-compose.yml
version: "3"
services:
caddy:
image: caddy:2.8-alpine
restart: unless-stopped
ports:
- "80:80"
volumes:
use num::BigInt;
fn main() {
let a = "-80538738812075974".parse::<BigInt>().unwrap();
let b = "80435758145817515".parse::<BigInt>().unwrap();
let c = "12602123297335631".parse::<BigInt>().unwrap();
let a3 = a.pow(3);
let b3 = b.pow(3);
let c3 = c.pow(3);
@darklinden
darklinden / main.rs
Created April 24, 2024 01:55
Is there a better algorithm for grouping projects by activity timeframe?
use std::collections::{HashMap, HashSet};
#[derive(Clone, Debug)]
struct Item {
start: i64,
end: i64,
id: i32,
}
impl Item {
@darklinden
darklinden / sd-webui.service
Created July 20, 2023 03:00
Start Service For stable-diffusion-webui
# /etc/systemd/system/sd-webui.service
[Service]
ExecStart=/bin/bash /home/ubuntu/stable-diffusion-webui/webui.sh --listen --api
Restart=always
WorkingDirectory=/home/ubuntu/stable-diffusion-webui
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=sd-webui
@darklinden
darklinden / use_venv.sh
Created July 16, 2023 00:53
shell for enable venv and add pwd to PYTHONPATH
#!/bin/bash
GLOBAL_PYTHON=$(which python3.10)
if [ -z "$GLOBAL_PYTHON" ]; then
GLOBAL_PYTHON=$(which python3)
fi
echo "Using global python: $GLOBAL_PYTHON"
CWD=$(pwd)
@darklinden
darklinden / docker-letsencrypt.sh
Created July 4, 2023 03:25
use docker to generate https cert
rm -rf config
mkdir config
docker run --rm \
--name=swag \
--cap-add=NET_ADMIN \
-e PUID=1000 \
-e PGID=1000 \
-e TZ=Europe/London \
-e URL=$2 \
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>sleepy.caffeinate</string>
<key>LimitLoadToSessionType</key>
<array>
<string>Aqua</string>
<string>Background</string>
@darklinden
darklinden / configure centos7 network.md
Last active March 4, 2023 09:42
Configure CentOS 7 Network Settings And Dnsmasq
@darklinden
darklinden / Install_Nodejs_16_on_CentOS.md
Last active February 14, 2023 02:49
How To Install Node.js 16 on CentOS 8 | CentOS 7

How To Install Node.js 16 on CentOS 8 | CentOS 7

from https://techviewleo.com/install-node-js-on-centos-linux/

  • Node.js packages are provided through the NodeSource Node.js Binary Distributions via .rpm. Add the repository to the system using the commands below:

    curl -fsSL https://rpm.nodesource.com/setup_16.x | sudo bash -

  • Tencent OpenCloudOS is not in the supported list

@darklinden
darklinden / float-unrepresentable-in-integer-range.md
Created February 7, 2023 04:17
Unity-WEBGL exception: float unrepresentable in integer range