Skip to content

Instantly share code, notes, and snippets.

View cobalamin's full-sized avatar
👾

Simon Welker cobalamin

👾
View GitHub Profile
@midrare
midrare / dropbox_context_menu_disable.reg
Last active May 5, 2025 08:27
Dropbox context menu disable
Windows Registry Editor Version 5.00
; also ok for HKLM
; [HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Shell Extensions\Blocked]
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Shell Extensions\Blocked]
; ============================================================================
; IDs extracted from:
@ChrisRackauckas
ChrisRackauckas / diffeq_vs_torchsde.md
Last active September 28, 2022 20:49
torchsde vs DifferentialEquations.jl / DiffEqFlux.jl (Julia) benchmarks

torchsde vs DifferentialEquations.jl / DiffEqFlux.jl (Julia)

This example is a 4-dimensional geometric brownian motion. The code for the torchsde version is pulled directly from the torchsde README so that it would be a fair comparison against the author's own code. The only change to that example is the addition of a dt choice so that the simulation method and time step matches between the two different programs.

The SDE is solved 100 times. The summary of the results is as follows:

@IvanYashchuk
IvanYashchuk / poisson.jl
Last active April 29, 2021 21:29
FEniCS solver + Zygote.jl + Turing.jl
using PyFenicsAD
using Zygote
using PyCall
using Turing
import LinearAlgebra: norm
using Random, Distributions
fenics = pyimport("fenics")
fenics.set_log_level(fenics.LogLevel.ERROR)
fa = pyimport("fenics_adjoint")
@fgolemo
fgolemo / 3d_rotate_reproject.py
Last active May 8, 2025 20:52
3D rotation and reprojection in pytorch, i.e. differentiable
import numpy as np
import math
import torch
from torchvision import datasets
import cv2 # OpenCV, this is only used for visualization, see bottom of file
def rotation_matrix(axis, theta):
"""
Generalized 3d rotation via Euler-Rodriguez formula, https://www.wikiwand.com/en/Euler%E2%80%93Rodrigues_formula
@cobalamin
cobalamin / audiomgmt.sh
Created June 16, 2019 20:29
Audio management (prev/play+pause/next, volume up/down, speaker/headphone switching) via the command line
# I used the commands below not only on the command line, but also set up the aliased commands as global keyboard shortcuts.
# This can be useful if you have a keyboard that lacks media keys, or if the media keys don't behave exactly as you want them to.
# Everything below assumes PulseAudio on top of ALSA.
alias volup="amixer set 'Master' 10%+" # Using amixer because pacmd/pactl can increase beyond 100% volume, which I don't want.
alias voldn="amixer set 'Master' 10%-"
# This assumes sink port #1 and the naming of these ports. Check `pacmd list-sinks` and make adjustments if necessary.
alias outsp='pacmd "set-sink-port 1 analog-output;output-speaker' # output to speakers
alias outhp='pacmd "set-sink-port 1 analog-output;output-headphones-1' # output to headphones
@Francesco149
Francesco149 / docker-cross-device-link.md
Last active October 27, 2023 08:51
docker error creating new backup file '/var/lib/dpkg/status-old': Invalid cross-device link
@ardok
ardok / jest-config.browser.js
Created March 15, 2018 23:46
Running jest in node and browser env, then combine the coverage with istanbul
/* eslint-disable */
const common = require('../jest-config.common');
module.exports = Object.assign({}, common, {
"coverageDirectory": "<rootDir>/coverage/browser",
"testMatch": [
"**/test/browser/**/*.test.js"
],
"setupFiles": [
"<rootDir>/src/test/browser/setup.js"
]
@peteflorence
peteflorence / pytorch_bilinear_interpolation.md
Last active November 18, 2024 06:10
Bilinear interpolation in PyTorch, and benchmarking vs. numpy

Here's a simple implementation of bilinear interpolation on tensors using PyTorch.

I wrote this up since I ended up learning a lot about options for interpolation in both the numpy and PyTorch ecosystems. More generally than just interpolation, too, it's also a nice case study in how PyTorch magically can put very numpy-like code on the GPU (and by the way, do autodiff for you too).

For interpolation in PyTorch, this open issue calls for more interpolation features. There is now a nn.functional.grid_sample() feature but at least at first this didn't look like what I needed (but we'll come back to this later).

In particular I wanted to take an image, W x H x C, and sample it many times at different random locations. Note also that this is different than upsampling which exhaustively samples and also doesn't give us fle

@klaftertief
klaftertief / reactiveconf-2016-lightning-talk.md
Last active April 2, 2024 20:17
An API search engine in Elm for Elm, proposal for a Lightning Talk at ReactiveConf 2016

An API search engine in Elm for Elm

Elm is a statically typed functional language that compiles to JavaScript. It's well-known for its developer experience: the compiler provides nice error messages, the package system enforces semantic versioning for all published packages and makes sure every exposed value or type has some documentation and type annotations.

@thomastweets
thomastweets / PNGWhiteTrim.py
Last active February 8, 2024 18:53
Python script to trim all png images with white background in a folder
import Image
import sys
import glob
import ImageOps
# Trim all png images with white background in a folder
# Usage "python PNGWhiteTrim.py ../someFolder"
try:
folderName = sys.argv[1]