Skip to content

Instantly share code, notes, and snippets.

View wmerfalen's full-sized avatar
⚒️
never stop

William Merfalen wmerfalen

⚒️
never stop
View GitHub Profile

My Hobby Projects

C/C++ projects

knockd

knockd is a simple port knocking daemon that utilizes libpcap to capture packets before it reaches the firewall (i.e.: iptables)

@wmerfalen
wmerfalen / license.h
Created December 3, 2023 03:35
example license based on zlib (https://www.zlib.net/zlib_license.html)
/*
xorlock -- a top-down 2D shooter inspired by Nuclear Throne and Diablo II+III
version 0.0.1-beta, December 2nd, 2023
Copyright (C) 2022-2023 William Merfalen
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
@wmerfalen
wmerfalen / rand-c.sh
Created November 11, 2023 06:17
random hex-encoded C string
dd if=/dev/urandom bs=32 count=5 skip=32 2>/dev/null | hexdump | cut -d' ' -f2- | sed -E 's|\s([a-f0-9]{2})([a-f0-9]{2})|\\x\1\\x\2|gi' | sed -E 's|^([a-f0-9]{2})([a-f0-9]{2})|\\x\1\\x\2|' | head -n 2 | tr -d '[:space:]'
@wmerfalen
wmerfalen / rand32.sh
Created November 8, 2023 21:34
Generate 32 random alphanumeric bytes
dd if=/dev/urandom count=32 bs=8 2>/dev/null | base64 | tr -d '[:punct:]' | head -c 32 | tr -d '[:space:]'
This file has been truncated, but you can view the full file.
{"filename":"db.json","collections":[{"name":"env","data":[{"data":{"gameTime":4099,"accessibleRooms":"[\"W10N10\",\"W10N9\",\"W10N8\",\"W10N7\",\"W10N6\",\"W10N5\",\"W10N4\",\"W10N3\",\"W10N2\",\"W10N1\",\"W10N0\",\"W9N10\",\"W9N9\",\"W9N8\",\"W9N7\",\"W9N6\",\"W9N5\",\"W9N4\",\"W9N3\",\"W9N2\",\"W9N1\",\"W9N0\",\"W8N10\",\"W8N9\",\"W8N8\",\"W8N7\",\"W8N6\",\"W8N5\",\"W8N4\",\"W8N3\",\"W8N2\",\"W8N1\",\"W8N0\",\"W7N10\",\"W7N9\",\"W7N8\",\"W7N7\",\"W7N6\",\"W7N5\",\"W7N4\",\"W7N3\",\"W7N2\",\"W7N1\",\"W7N0\",\"W6N10\",\"W6N9\",\"W6N8\",\"W6N7\",\"W6N6\",\"W6N5\",\"W6N4\",\"W6N3\",\"W6N2\",\"W6N1\",\"W6N0\",\"W5N10\",\"W5N9\",\"W5N8\",\"W5N7\",\"W5N6\",\"W5N5\",\"W5N4\",\"W5N3\",\"W5N2\",\"W5N1\",\"W5N0\",\"W4N10\",\"W4N9\",\"W4N8\",\"W4N7\",\"W4N6\",\"W4N5\",\"W4N4\",\"W4N3\",\"W4N2\",\"W4N1\",\"W4N0\",\"W3N10\",\"W3N9\",\"W3N8\",\"W3N7\",\"W3N6\",\"W3N5\",\"W3N4\",\"W3N3\",\"W3N2\",\"W3N1\",\"W3N0\",\"W2N10\",\"W2N9\",\"W2N8\",\"W2N7\",\"W2N6\",\"W2N5\",\"W2N4\",\"W2N3\",\"W2N2\",\"W2N1\",\"W2N0\",\"W1N10\"
@wmerfalen
wmerfalen / vanilla-class.js
Created August 22, 2023 22:41
[vanilla JS]: Add a class to a given element using
let element = document.querySelector("selector")
element.classList.add("class")
@wmerfalen
wmerfalen / debounce.js
Created August 22, 2023 10:07
Javascript Debounce
// Source: https://www.freecodecamp.org/news/javascript-debounce-example/
function debounce(func, timeout = 300){
let timer;
return (...args) => {
clearTimeout(timer);
timer = setTimeout(() => { func.apply(this, args); }, timeout);
};
}
function saveInput(){
console.log('Saving data');
@wmerfalen
wmerfalen / host-to-network.js
Created April 28, 2023 09:14
host to network conversion functions
/**
I copied this from: https://github.com/mattcg/network-byte-order/blob/master/lib/index.js
Go give that repo a star
*/
/* Copyright 2010 Membase, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@wmerfalen
wmerfalen / tokenize.js
Last active February 21, 2023 01:16
Turn url search params into an associative array
const tokenize = (__in_url=null) => {
let url = window.location.href;
if(__in_url !== null){
url = __in_url;
}
return (new URLSearchParams((new URL(url)).search));
};
/**
* Example:
/usr/bin/astyle -A2 -t -xn -xc -xl -xk -xV -C -xG -S -K -N -M80 -U -W1 -j --suffix=none $@