Skip to content

Instantly share code, notes, and snippets.

@ilya16
ilya16 / masked_batchnorm.py
Created February 26, 2021 15:08
Masked Normalization layers in PyTorch
from typing import Optional
import torch
import torch.nn.functional as F
from torch import Tensor
from torch.nn.modules.batchnorm import _BatchNorm
# Masked Batch Normalization
@ivanstepanovftw
ivanstepanovftw / # Bash Error & Backtrace Function Function.md
Last active August 29, 2023 22:40
Bash Error & Backtrace Function

Bash Error & Backtrace Function

./error.sh

variable="$(echo INJECTED | base64)"
variable='$(echo '"$variable"' | base64 --decode)'
error
error "$variable     foo"
error '  foo"bar  ' $'\n''\nbaz)'
@Nathan-Franck
Nathan-Franck / main.zig
Created August 24, 2023 22:58
Forcing language features into zig at comptime
const std = @import("std");
const sfy = @import("structify.zig");
pub fn main() !void {
// Object builders just like c# or typescript, easy peasy! Tooling could be better.
{
const Config = struct {
a: i32,
b: i16,
@Proxy13
Proxy13 / guide-change-imei-snapdragon.md
Created September 27, 2023 09:02
[GUIDE] How to change IMEI on Snapdragon devices

[GUIDE] How to change IMEI on Snapdragon devices

FOR EDUCATIONAL PURPOSE ONLY, CHANGING IMEI IS ILLEGAL IN MOST COUNTRIES, MAKE SURE YOU CONVINCE YOUR ACTIONS BEFORE DOING THIS.

I DON'T RESPONSIBLE IF YOUR DEVICE IS BROKEN OR THE IMEI IS NOT CHANGED CAUSED BY YOU DIDN'T FOLLOW THE STEPS CAREFULLY OR HAVING A DIFFERENT EFS PARTITION SCHEME.

This guide was tested on Google Pixel 3, different device may also have a different EFS partition scheme, please make sure you adjust it with this guide. Other Google Pixel devices may use this guide without adjusting.

Prerequisites:

@carlosgmartin
carlosgmartin / jax_saturating_arithmetic.py
Last active April 27, 2025 05:20
Implementation of saturating arithmetic for JAX
"""
https://github.com/jax-ml/jax/issues/26566
"""
import itertools
import operator
import jax
from jax import numpy as jnp
from tqdm import tqdm