Skip to content

Instantly share code, notes, and snippets.

@chrisbck
chrisbck / gist:5b66068b1a459965dd54bfb662903aee
Created November 21, 2023 15:25
Rust Matching Example
// Taken from YouTube video by Jeremy Chone: https://www.youtube.com/watch?v=VQdStWU2ewY
use Activity::*;
pub enum Activity{
Sleeping(Option<u16>),
Skiing {resort: String},
Coding
}
@snej
snej / missing_includes.rb
Created October 2, 2023 16:19
Script to find missing std #includes in C++ headers
#! /usr/bin/env ruby
#
# missing_includes.rb
# By Jens Alfke <jens@couchbase.com>
# Version 2.0 -- 2 Oct 2023
# Copyright 2021-Present Couchbase, Inc.
#
# This script scans C++ header files looking for usage of common standard library classes, like
# `std::vector`, without including their corresponding headers, like `<vector>`. It similarly looks
# for standard C functions like `strlen` that are used without including their header (`<cstring>`.)
@osy
osy / tpm-rant.md
Last active April 14, 2024 06:02
TPM provides zero practical security

TPM provides zero practical security

TPM (Trusted Platform Module) is as useful for preventing real attackers as the TSA is at preventing real terrorists. The architecture is fundamentally flawed and most existing implementations are completely broken. I thought this argument was settled decades ago[1] when "trusted computing" was introduced mostly as a way to provide DRM and ownership capabilities to organizations. It has largely failed to impact the consumer market when it was introduced back in the early 2000s. However, recently there seems to be a movement by certain parties to reintroduce this failed product back to the market. Microsoft argues that in order to use Windows 11, you need TPM 2.0 compatible hardware because[2]:

The Trusted Platform Module(TPM) requirement ena

@lleyton
lleyton / translation.md
Last active January 23, 2024 16:53
(ENG) Open Source Business Challenges and Reality, Rui Ueyama

Open Source Business Challenges and Reality

Original Japanese note here.

Original Author: Rui Ueyama (creator of the mold linker)

Translated by @windowsboy111

Minimally edited by @lleyton

@hyperupcall
hyperupcall / settings.jsonc
Last active March 31, 2024 22:52
VSCode config to disable popular extensions' annoyances (telemetry, notifications, welcome pages, etc.)
// I'm tired of extensions that automatically:
// - show welcome pages / walkthroughs
// - show release notes
// - send telemetry
// - recommend things
//
// This disables all of that stuff.
// If you have more config, leave a comment so I can add it!!
{
@bladeSk
bladeSk / Unity-Linux-VSCode-Intellisense-Debugger.md
Last active April 9, 2024 11:42
How to install Unity3D on Ubuntu based Linux distros (Kubuntu, Xubuntu, POP_OS, Mint, Neon, Zorin, etc.).

How to install Unity3D on Ubuntu based Linux distros (Kubuntu, Xubuntu, POP_OS, Mint, Neon, Zorin, etc.).

This guide details how to install UnityHub, Unity, VS Code and how to get full C# support with IntelliSense and debugging.

Tested on Kubuntu 22.04.

Installing Unity Hub

Unity Hub won't run on Ubuntu newer than 20.04 because it depends on an outdated libssl. We need to manually install the package from 20.04:

@TheBrokenRail
TheBrokenRail / README.md
Last active April 26, 2024 15:48
Jailbreak Firefox!

Jailbreak-Firefox

This script allows you to install unsigned extensions (ones that aren't approved by Mozilla) on normal Firefox builds and the official Snap! That's right, no "Firefox Developer Edition" nonsense required!

⚠️ Disclaimer ⚠️

This script is not well tested, like at all. This script might break things, possibly important things. You should probably take a backup of your Firefox profile before using it. You have been warned.

Dependencies

sudo apt install -y curl unzip zip
# Only needed when jailbreaking the Snap
@slimsag
slimsag / ramblings.md
Last active December 13, 2023 08:02
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.

@mentha
mentha / flatpak-auto-update.py
Last active September 9, 2022 15:52
flatpak auto update timer
#!/usr/bin/env python3
from argparse import ArgumentParser
from contextlib import suppress
from functools import cached_property
from sys import argv, exit, stderr
from time import time
import dbus
import os
import shlex
@AnomalRoil
AnomalRoil / go-switch-bash
Last active July 1, 2022 13:37
The `go switch` function allows you to easily switch you current Go version
# to add to your ~/.bashrc or your ~/.zshrc file. Usage: $ go switch 1.18.1
function go() {
case $* in
switch* )
shift 1
gobindir=$(go env GOBIN)
# adapt to a valid directory at the beginning of your $PATH if you're not on systemd
homebindir=$(systemd-path user-binaries)
go install golang.org/dl/go"$@"@latest
$gobindir/go"$@" download