Skip to content

Instantly share code, notes, and snippets.

View jack3898's full-sized avatar

Jack Wright jack3898

View GitHub Profile
@jack3898
jack3898 / nodeReadableToWebReadable.ts
Created May 21, 2024 17:32
Node to/from web readable conversion
import { type Readable } from "node:stream";
export function nodeReadableToWebReadable(nodeReadable: Readable): ReadableStream {
return new ReadableStream({
start(controller): void {
nodeReadable.on("data", (chunk) => {
controller.enqueue(chunk);
});
nodeReadable.on("end", () => {
@jack3898
jack3898 / watch-replays.ps1
Created November 26, 2023 16:06
Run Danser CLI on new replay generated
###
# ABOUT: Watches for new replays and renders them with danser-cli
#
# HOW TO:
# 1. Download Danser from https://github.com/Wieku/danser-go and extract it
# 2. Download this script and place it in the same folder as danser-cli.exe
# 3. Open PowerShell and run the script with `.\watch-replays.ps1`
# 4. When new replays are created, they will be rendered with danser-cli
#
# NOTES:
@jack3898
jack3898 / guide.md
Last active April 17, 2024 10:04
How to authenticate with FakeYou using a username and password

How to authenticate with the FakeYou API without an API key

FakeYou's API does not have public support for an API key so unless you have been given an API token by the owner, you're left with session authentication.

This guide will predominantly revolve around TypeScript, but in the end, we will be using HTTP as our transfer protocol. So long as your language works with HTTP, you should be able to translate it to your language of choice!

Understanding how to authenticate

We will use session authentication, which means you need to send across a cookie to the API so that FakeYou recognises you.

Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
{
"tel": "(redacted)",
"mail": "(redacted)",
"location": "Essex, UK",
"message": "I am not currently looking for further opportunities. LinkedIn is the best way to get in touch!"
}
@jack3898
jack3898 / Convert collation MySQL MariaDB.md
Created July 28, 2021 08:37
A couple of queries that let you convert an entire database into a new collation.

Converting database collations for large databases (MySQL/MariaDB)

Make sure Barracuda is enabled and the default character set globally is set to your desired character set in my.cnf.

Query 1

ALTER DATABASE database_name CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci Of course, feel free to change the collations to what best suits you.

Then, get all of the queries to update the database tables and columns replacing the values that suit your situation: