Skip to content

Instantly share code, notes, and snippets.

@zajdee
zajdee / jool-init.sh
Last active December 29, 2024 02:20
Init Jool in a namespace
#!/bin/bash
# Save the file as e.g. /usr/sbin/jool-init.sh
# Edit to match your translation prefix
NAT64_PFX=64:ff9b::/96
# Edit to match your dual-stack interface
DUALSTACKIFACE=ens5
modprobe jool
# add namespace and devices to link the two namespaces
@niksumeiko
niksumeiko / disable-html-form-input-autocomplete-autofill.md
Last active December 29, 2024 02:19
Disable HTML form input autocomplete and autofill

Disable HTML Form Input Autocomplete and Autofill

  1. Add autocomplete="off" onto <form> element;
  2. Add hidden <input> with autocomplete="false" as a first children element of the form.
<form autocomplete="off" method="post" action="">
    <input autocomplete="false" name="hidden" type="text" style="display:none;">
    ...
@staltz
staltz / introrx.md
Last active December 29, 2024 02:17
The introduction to Reactive Programming you've been missing
@Euro-pol
Euro-pol / AC_DDoS_Protection.md
Last active December 29, 2024 02:16
Assetto Corsa self-hosted DDoS protection tutorial (proxy)

Introduction

Hey guys, I've been hosting an Asseto Corsa server on my Raspberry Pi 4, but been wondering how to set up DDoS protection. I've been searching for any self-hosted proxies for AC, but couldn't find any so I dug deeper. I found out that nginx can work with UDP and TCP connections, so I'm writing this little guide.

Requirements

  • A VPS with Ubuntu Server (or similar)
  • Nginx with stream (on Ubuntu, install libnginx-mod-stream)
  • An already setup Asseto Corsa server
  • Your home server's ports open (for the AC server to be accessible)

How-to

@MaskRay
MaskRay / johnson.cc
Last active December 29, 2024 02:12
Johnson's algorithm - Finding All the Elementary Circuits of a Directed Graph
#include <algorithm>
#include <cstdio>
#include <type_traits>
#include <vector>
using namespace std;
#define ALL(x) (x).begin(), (x).end()
#define FOR(i, a, b) for (remove_cv<remove_reference<decltype(b)>::type>::type i = (a); i < (b); i++)
#define REP(i, n) FOR(i, 0, n)
@chenhunghan
chenhunghan / llama_cpp_dspy_evaluate.py
Created April 1, 2024 13:15
DSPy llm evaluation with metric using llama.cpp
# A gist for using the `llama.cpp` model with the `dspy` library.
#
# DSPy features used in this gist
# - `dspy.Predict`
# - `dspy.Signature`
# - `dspy.context`
# - `dspy.evaluate.Evaluate`
#
# The script first prompts the model to answer a example question and assess the correctness and engagingness of the answer using a evaluator.
#
@Ellivers
Ellivers / main.md
Last active December 29, 2024 02:08
Practices and Tricks

Good Data Pack Practices and Common Tricks

Structuring and Consistency

An organized structure to your data pack's folders and file names always helps you understand your code better and leads to less bugs. Place files that have something in common in the same folder, and name them based on what their purpose is.

Consistency in naming stuff like tags, files, and scores can help keep you sane. Always have a clear structure in place, such as prefixing tag and objective names with your namespace (namespace.name) and giving tags different categories (namespace.entity.name, namespace.block.name).

If you are unsure of how a good structure could look, you could take a look at some vanilla assets, such as the lang file or the built-in data pack, as well as get ideas from looking at data packs that other people have made.

@jan-bar
jan-bar / index-2fa.html
Created November 22, 2024 05:34
trilium two-factor authentication
<div style="text-align: center">
<p id="secs2fa"></p>
<p id="GetCode"><button>GetCode</button></p>
<div id="show2fa"></div>
</div>
@MaxXor
MaxXor / btrfs-guide.md
Last active December 29, 2024 02:06
Btrfs guide to set up an LUKS-encrypted btrfs raid volume with included maintenance & recovery guide

Encrypted Btrfs storage setup and maintenance guide

Initial setup with LUKS/dm-crypt

This exemplary initial setup uses two devices /dev/sdb and /dev/sdc but can be applied to any amount of devices by following the steps with additional devices.

Create keyfile:

dd bs=64 count=1 if=/dev/urandom of=/etc/cryptkey iflag=fullblock
chmod 600 /etc/cryptkey
@Grayda
Grayda / WIN11-INSTALL.txt
Last active December 29, 2024 02:04
Autopilot / Intune onboarding BadKB scripts
REM This script automates the Windows 11 installation from a USB stick.
REM You'll probably need to adjust the delays to match your hardware,
REM because each machine takes a different amount of time to load various screens
DEFAULTDELAY 300
REM Move to the locale selector and select English (Australia), then press Next and then Install Now
TAB
STRING English (Australia)
ALT N