Skip to content

Instantly share code, notes, and snippets.

@mataha
mataha / bootstrap.cmd
Last active July 3, 2024 14:46
curl shell test
:<<"#!/bin/sh"
::: curl -fsSL "..." | sh
::: | cmd /d/q/k echo off
@if not "%=^%=" == "%=%=" (set \p=^%<nul) else (set \p=%%<nul)
set last=
for /f delims^= %\p%l in ('^"doskey /history^"') do (set "last=%\p%~l")
if defined last (echo(Last command: "%last%")
:parse
@(verify "" || setlocal DisableDelayedExpansion EnableExtensions) 2>nul || (
(echo(Command Extensions could not be enabled; terminating the program.)
) >&2 && goto :EOF "Command Extensions could not be enabled"
@if not "-h" == "%~1" if not "-?" == "%~1" (goto :main)
@(
(echo(Language-independent ACP ^(active code page^) retrieval)
(echo()
// SPDX-License-Identifier: GPL-2.0-only
/*
* linux/fs/binfmt_script.c
*
* Copyright (C) 1996 Martin von Löwis
* original #!-checking implemented by tytso.
*/
#include <linux/module.h>
#include <linux/string.h>
@mataha
mataha / weather.dos
Last active October 3, 2022 00:30
wttr.in in your conhost.exe
weather=(powershell -NoProfile -NonInteractive "[Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor [Net.SecurityProtocolType]::Tls12; $place = [uri]::EscapeUriString($(If ([string]::IsNullOrWhiteSpace('$*')) { "${env:WTTR_LOCATION}" } Else { '$*' })); $weather = (Invoke-WebRequest "wttr.in/${place}?mF" -UseBasicParsing -Method 'Get' -UserAgent 'curl').Content; echo `r ${weather}.Replace($([char] 0x2196), $([char] 0x005C)).Replace($([char] 0x2197), $([char] 0x002F)).Replace($([char] 0x2198), $([char] 0x005C)).Replace($([char] 0x2199), $([char] 0x002F)).Replace($([char] 0x26A1).ToString(), $([char] 0x250C).ToString() + $([char] 0x2518).ToString()).Trim();")
@mataha
mataha / fxp.mjs
Last active June 11, 2022 04:24
Get ladder data for a player in Fxp GunZ
#!/usr/bin/env -S node --experimental-fetch --no-warnings --tls-max-v1.3
import path from 'node:path';
import process from 'node:process';
import url from 'node:url';
const __filename = path.resolve(url.fileURLToPath(import.meta.url));
/**
* @typedef {Object} RankingQuery
;(function () {
function getRandomWaifu() {
return "Ai Hayasaka";
}
const name = window.prompt("Type your character's name:", getRandomWaifu());
if (!name) {
alert("Invalid character name.");
return false;
/*
* conredir, a hack to get working console IO with Windows GUI applications
*
* Copyright (c) 2013, Martin Herkt
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
@mataha
mataha / d2rwlist.txt
Last active April 27, 2022 16:42
Diablo II Resurrected - wantlist
~*~ Mataha's Diablo II: Resurrected wantlist ~*~
~*~ All of the items here are nonladder only ~*~
Expansion
=========
Runes
-----
HRs. Lots of them. But mostly Bers.
@mataha
mataha / metrics.c
Last active June 8, 2021 22:16
Windows system metrics
#include <stdio.h>
#include <stdlib.h>
#include <windows.h>
#define print_metric(metric) \
do \
{ \
printf("%s: %d\n", #metric, GetSystemMetrics(metric)); \
} while (0)
@mataha
mataha / protocol.txt
Created May 16, 2021 09:06
GunZ locator protocol example
Example locator request and response (International GunZ).
Note that some servers would send slightly different responses, e.g. Freestyle
GunZ (response from FGunZ would include some additional fields, e.g. server
description - I don't know if it's 1.5 source specific).
Everything is in little-endian order unless specified.