Skip to content

Instantly share code, notes, and snippets.

View mon-jai's full-sized avatar

Mon mon-jai

  • National Taipei University of Technology
  • Taiwan
  • 20:41 (UTC +08:00)
View GitHub Profile

Rust Cheat Sheet

Variables & Mutability

Variables are immutable by default. This makes Rust safer and makes concurrency easier.
Immutable means once a value is bound to that variable, it cannot be changed.
For example:

fn main() {
 let x = 5;
@emidoots
emidoots / ramblings.md
Last active December 25, 2024 04:39
Because cross-compiling binaries for Windows is easier than building natively

Because cross-compiling binaries for Windows is easier than building natively

I want Microsoft to do better, want Windows to be a decent development platform-and yet, I constantly see Microsoft playing the open source game: advertising how open-source and developer friendly they are - only to crush developers under the heel of the corporate behemoth's boot.

The people who work at Microsoft are amazing, kind, talented individuals. This is aimed at the company's leadership, who I feel has on many occassions crushed myself and other developers under. It's a plea for help.

The source of truth for the 'open source' C#, C++, Rust, and other Windows SDKs is proprietary

You probably haven't heard of it before, but if you've ever used win32 API bindings in C#, C++, Rust, or other languages, odds are they were generated from a repository called microsoft/win32metadata.

# https://superuser.com/a/1492456
echo "$(whoami) ALL=(ALL) NOPASSWD:ALL" | sudo dd of="/etc/sudoers.d/$(whoami)"
sudo apt install -y wslu
# https://superuser.com/a/1568668/1172895
WINDOWS_USER_PROFILE="$(wslpath "$(wslvar USERPROFILE)")"
HOME_DICECTORY="/home/$(whoami)"
# https://askubuntu.com/a/86891
cp -vra ~/. $WINDOWS_USER_PROFILE
@FeepingCreature
FeepingCreature / youre_doing_json_apis_wrong.md
Last active March 14, 2025 09:16
You Are Doing JSON APIs Wrong

You are doing JSON APIs wrong.

When you use JSON to call an API - not a REST API, but something like JSON-RPC - you will usually want to encode one of several possible messages.

Your request body looks like this:

{
 "type": "MessageWithA",
@paulloz
paulloz / content.md
Last active November 16, 2024 23:26
Visual Studio Code and C# code completion and debugger for Godot

Visual Studio Code and C# code completion and debugger for Godot

Ok, this is a quick document to guide you through the setup of a Godot project in Visual Studio Code.
I'll assume you have a working C# environment installed. Note that on Linux, you might need to install Mono for everything to work fine with Godot 3.x.

1. Install the necessary extensions

First off, make sure you have the following extensions installed and active in Visual Studio Code:

@M0r13n
M0r13n / doh
Last active March 12, 2025 11:43
Setup Cloudflare as a DoH (DNS over HTTPS) resolver on Mikrotik devices (RouterOS v7.0.2+)
# Temporarily add a normal upstream DNS resolver
/ip dns set servers=1.1.1.1,1.0.0.1
# CA certificates extracted from Mozilla
/tool fetch url=https://curl.se/ca/cacert.pem
# Import the downloaded ca-store (127 certificates)
/certificate import file-name=cacert.pem passphrase=""
# Set the DoH resolver to cloudflare
@joepie91
joepie91 / es-modules-are-terrible-actually.md
Last active February 25, 2025 06:17
ES Modules are terrible, actually

ES Modules are terrible, actually

This post was adapted from an earlier Twitter thread.

It's incredible how many collective developer hours have been wasted on pushing through the turd that is ES Modules (often mistakenly called "ES6 Modules"). Causing a big ecosystem divide and massive tooling support issues, for... well, no reason, really. There are no actual advantages to it. At all.

It looks shiny and new and some libraries use it in their documentation without any explanation, so people assume that it's the new thing that must be used. And then I end up having to explain to them why, unlike CommonJS, it doesn't actually work everywhere yet, and may never do so. For example, you can't import ESM modules from a CommonJS file! (Update: I've released a module that works around this issue.)

And then there's Rollup, which apparently requires ESM to be u

Dogfooding
  • Dogfooding is using an app or feature shortly before it's publically released.
  • The term dogfood comes from the expression "eating your own dogfood".
Fishfooding
  • Fishfooding is using an app or feature really early in its development before it's even really finished.
  • The term "fishfood" actually comes from the Google+ team inside of Google.
  • Google+ was internally codenamed Emerald Sea.
@FreddieOliveira
FreddieOliveira / docker.md
Last active March 7, 2025 03:38
This tutorial shows how to run docker natively on Android, without VMs and chroot.

Docker on Android 🐋📱

Edit 🎉

All packages, except for Tini have been added to termux-root. To install them, simply pkg install root-repo && pkg install docker. This will install the whole docker suite, left only Tini to be compiled manually.


Summary

@pajaydev
pajaydev / js-objects-compare.md
Last active December 9, 2024 14:25
JS Objects : Object.keys vs for..in vs getOwnPropertyNames vs Object.entries

Object.keys vs for..in vs getOwnPropertyNames vs Object.entries

const language = {
  name: 'JavaScript',
  author: 'Brendan Eich'
};

// Inheriting from another object.
Object.setPrototypeOf(language, {createdAt: "Netscape"});