Skip to content

Instantly share code, notes, and snippets.

@viridia
viridia / asset-migration.md
Last active January 5, 2025 07:18
Migrating to Bevy Assets V2

Migrating to Bevy Assets V2

Migrating a custom asset loader

Existing asset loaders will need a few small changes to get them to work with Bevy Assets V2.

First, you'll need to add the asset type as an associated type of the loader. This type is called Asset and represents the type of the "default asset" produced by the loader.

You'll also need to add a Settings type which represents options that can be passed to the loader when you request an asset. If your asset has no settings, then you can just set it to the unit type.

@RubenKelevra
RubenKelevra / fast_firefox.md
Last active January 5, 2025 07:17
Make Firefox fast again
@fatbobman
fatbobman / adaptiveSheet.swift
Created October 22, 2022 00:53
Adaptive Height Sheet
import SwiftUI
struct ContentView: View {
@State var show = false
var body: some View {
VStack {
Button("Pop Sheet") { show.toggle() }
}
.adaptiveSheet(isPresent: $show) { SheetView() }
}
@dsevero
dsevero / gumbel-softmax-trick.py
Last active January 5, 2025 07:16
Gumbel-Softmax Trick
# We can produce samples from an un-normalized distribution by adding
# iid Gumbel noise together with the argmax operator; which is denoted as the Gumbel-Max Trick.
# However, argmax doesn't produce meaningful gradient signals, so we replace argmax
# by softmax, with a temperature parameter (Gumbel-Softmax Trick).
#
# I didn't invent any of this, all credit goes to the following papers:
# - https://arxiv.org/abs/1611.00712
# - https://arxiv.org/abs/1611.01144
import numpy as np
@theabhayprajapati
theabhayprajapati / Companies.md
Last active January 5, 2025 07:15
List of 300+ Companies paying 12LPA+ base for SDE-1 role in India.

List of 300+ Companies paying 12LPA+ base for SDE-1 role in India.

source

Companies have been listed with their URLs so you can easily access their website. We would appreciate it if you could comment below with the correct URL if you find any that are broken.

  1. Acko
  2. Adobe
  3. Airbase
  4. Airbnb
  5. Airbus
@joeblau
joeblau / pre-commit
Created June 1, 2019 16:57
Pre commit git hook to run SwiftLint and SwiftFormat
#!/bin/bash
# Place this file in `.git/hooks/`
if which swiftlint >/dev/null; then
swiftlint autocorrect
else
echo "warning: SwiftLint not installed, download from https://github.com/realm/SwiftLint"
fi
git diff --diff-filter=d --staged --name-only | grep -e '\(.*\).swift$' | while read line; do
@maelvls
maelvls / README.md
Last active December 12, 2024 10:11
My hundred struggles while using Linux as my desktop driver (Ubuntu 22.04)

My hundred struggles while using Linux as my desktop driver (Ubuntu 24.04)

Hi! On Thursday 25 April 2021, I entirely switched from macOS to Linux: https://maelvls.dev/evolution-of-my-home-office/. I took note of every adjustment I had to make along the way. I use Ubuntu "vanilla" (with Gnome as my desktop manager).

🔥 Update 26 June 2023: I am abandoning "desktop" Linux! I can't bear having to work around everything all the time, not even counting the tons of problems that occur whenever I do a major version upgrade (e.g., when I upgraded from 21.10 to 22.04, my PPAs broken obviously, and also I lost all the hack I had made to the /etc to work around problems). I am officially back to macOS starting 26 June 2023. I'll still use my Linux workstation remotely over Mosh, but not as a desktop environment.

To smoothen the transition, I use the following hacks on macOS:

  1. Linear Mouse since I can't stand macOS' mouse acceleration and also to fix my mouse wheel's direction. My config:
@jinjier
jinjier / javdb-top250.md
Last active January 5, 2025 07:04
JavDB top 250 movies list. [Updated on 2024/12]
@ErikAugust
ErikAugust / spectre.c
Last active January 5, 2025 07:01
Spectre example code
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#ifdef _MSC_VER
#include <intrin.h> /* for rdtscp and clflush */
#pragma optimize("gt",on)
#else
#include <x86intrin.h> /* for rdtscp and clflush */
#endif
@jojonas
jojonas / love2d-unpacker.py
Last active January 5, 2025 07:01
Love2d executable unpacker.
import argparse
import os, os.path
import zipfile
import io
def readui32(file):
bytes = file.read(4)
number = bytes[0]
number += bytes[1] << 8
number += bytes[2] << 16