Skip to content

Instantly share code, notes, and snippets.

View Fuwn's full-sized avatar
✒️
亀の甲より年の功

Fuwn Fuwn

✒️
亀の甲より年の功
View GitHub Profile
@Fuwn
Fuwn / ConsoleColour.h
Last active January 23, 2020 07:52
Windows specific console out text colour changer.
// Usage:
// std::cout << COLOUR_HERE << "Text";
// Example:
// std::cout << red << "Text";
//
// You can also make new colours by combing the base RGB colours.
// FOREGROUND_RED, FOREGROUND_GREEN, FOREGROUND_BLUE are the base colours.
// FOREGROUND_INTENSITY gives vibrance. The colour name can be changed by
// changing; inline std::ostream& THIS_VALUE_HERE(std::ostream& s)
@Fuwn
Fuwn / PM2 Cheat Sheat
Last active June 22, 2021 21:25
PM2 Cheat Sheat
# Fork mode
pm2 start app.js --name my-api # Name process
# Cluster mode
pm2 start app.js -i 0 # Will start maximum processes with LB depending on available CPUs
pm2 start app.js -i max # Same as above, but deprecated.
pm2 scale app +3 # Scales `app` up by 3 workers
pm2 scale app 2 # Scales `app` up or down to 2 workers total
# Listing
const path = require('path');
const config = require('../config.js');
const fs = require('fs');
const sharp = require('sharp');
const ffmpeg = require('fluent-ffmpeg');
const utilsController = {};
utilsController.videoExtensions = ['.webm', '.mp4', '.wmv', '.avi', '.mov'];
utilsController.generateThumbs = function(file, basedomain) {
@Fuwn
Fuwn / build.bat
Last active June 22, 2021 21:24
RGBDS build script
rgbasm -o main.o main.asm
rgblink -o game.gb main.o
rgbfix -v -p 0 game.gb
document.getElementsByName("image_width")[0].value = 1000;document.getElementsByName("image_height")[0].value = 1;
@Fuwn
Fuwn / DD_RFC.md
Created May 27, 2021 06:14
Double dot operator for initializing vector with another vector's elements

I recently came across a situation where I had to push multiple vectors of thread handles to a central vector.

The first element that I was adding to the central thread comes as follows;

// This works.

// `example_crate::make()` returns a `std::thread::JoinHandle<()>`;
let mut threads = vec![example_crate::make()];
# Imports
import re
import requests
import sys
import time
# Constants
YOUTUBE_HEADER_IMAGE_START_URL: str = "yt3.ggpht.com/"
YOUTUBE_HEADER_IMAGE_END_URL: str = "-no-nd-rj"
@Fuwn
Fuwn / image-to-bmp3.sh
Created January 14, 2022 06:54
Image to BMP3 Converter for Worlds
# Check if a filename was supplied
if ! test -n "${1}";
then
echo "bmp-to-bmp3.sh <file.bmp>"
exit 1
fi
# Check if ImageMagick is installed
if ! command -v mogrify &> /dev/null;
then