Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@VictorTaelin
VictorTaelin / sat.md
Last active April 23, 2024 10:19
Simple SAT Solver via superpositions

Solving SAT via interaction net superpositions

I've recently been amazed, if not mind-blown, by how a very simple, "one-line" SAT solver on Interaction Nets can outperform brute-force by orders of magnitude by exploiting "superposed booleans" and optimal evaluation of λ-expressions. In this brief note, I'll provide some background for you to understand how this works, and then I'll present a simple code you can run in your own computer to observe and replicate this effect. Note this is a new observation, so I know little about how this algorithm behaves asymptotically, but I find it quite

@jossef
jossef / force-delete-k8s-namespace.py
Created August 13, 2020 12:50
force delete k8s namespace
#!/usr/bin/env python3
import atexit
import json
import requests
import subprocess
import sys
namespace = sys.argv[1]
proxy_process = subprocess.Popen(['kubectl', 'proxy'])
atexit.register(proxy_process.kill)

Kubectl plugin

This plugin adds completion for the Kubernetes cluster manager, as well as some aliases for common kubectl commands.

To use it, add kubectl to the plugins array in your zshrc file:

plugins=(... kubectl)
@tsuriga
tsuriga / app.html
Last active April 23, 2024 10:18
Saving and loading files in an Electron application
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Tsuri's Electron Note Sample App</title>
<link href="./app.css" rel="stylesheet" />
<script src="app.js"></script>
</head>
<body>
<h1>Welcome to note sample app!</h1>

Recovering deleted files in Ubuntu with ext4 filesystem

Recently, I deleted some files by mistake in a Ubuntu machine with an ext4 fs. These notes document the steps I took to get them back.

Important

  • this procedure assumes that the partition that contained the deleted files is different from the root partition, as that was the scenario with which I had to deal (deleted files were in my home dir). The procedure needs that the partition that contained the files is unmounted, so if the deleted files were in the root partition, the process would be a bit different (e.g. storing the fs journal in a USB stick, using a live CD/USB to boot and issue the commands, etc.)
  • if something is not clear, you need more information, etc. check the sources below

With that out the way, let's begin.

@aamiaa
aamiaa / CompleteMokokoQuest.md
Last active April 23, 2024 10:13
Complete Discord Mokoko Quest

Complete Discord Mokoko Quest

How to use this script:

  1. Accept the quest under User Settings -> Gift Inventory
  2. Join a vc
  3. Stream any window (can be notepad or something)
  4. Press Ctrl+Shift+I to open DevTools
  5. Go to the Console tab
  6. Paste the following code and hit enter:
let wpRequire;
@munrocket
munrocket / wgsl_noise.md
Last active April 23, 2024 10:11
WGSL Noise Algorithms

WGSL Noise Algorithms

Operator % has changed, probably current code with it need a fix

Good and fast integer hash

// https://www.pcg-random.org/
fn pcg(n: u32) -> u32 {
    var h = n * 747796405u + 2891336453u;
    h = ((h >> ((h >> 28u) + 4u)) ^ h) * 277803737u;
@adrianhajdin
adrianhajdin / cron.route.ts
Created September 30, 2023 10:15
Web Scraping Full Course 2023 | Build and Deploy eCommerce Price Tracker
import { NextResponse } from "next/server";
import { getLowestPrice, getHighestPrice, getAveragePrice, getEmailNotifType } from "@/lib/utils";
import { connectToDB } from "@/lib/mongoose";
import Product from "@/lib/models/product.model";
import { scrapeAmazonProduct } from "@/lib/scraper";
import { generateEmailBody, sendEmail } from "@/lib/nodemailer";
export const maxDuration = 300; // This function can run for a maximum of 300 seconds
export const dynamic = "force-dynamic";
@insdavm
insdavm / wireguard-over-tcp.md
Last active April 23, 2024 10:09
WireGuard over TCP with udptunnel

WireGuard over TCP with udptunnel

udptunnel is a small program which can tunnel UDP packets bi-directionally over a TCP connection. Its primary purpose (and original motivation) is to allow multi-media conferences to traverse a firewall which allows only outgoing TCP connections.

Server

# udptunnel -s 443 127.0.0.1/51820

Client

@juanbrujo
juanbrujo / PlayStationBIOSFilesNAEUJP.md
Last active April 23, 2024 10:07
Files for PlayStation BIOS Files NA-EU-JP