Skip to content

Instantly share code, notes, and snippets.

@rwightman
rwightman / median_pool.py
Last active August 13, 2024 10:57
PyTorch MedianPool (MedianFilter)
import math
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.nn.modules.utils import _pair, _quadruple
class MedianPool2d(nn.Module):
""" Median pool (usable as median filter when stride=1) module.
@sudeepraja
sudeepraja / bandits.py
Last active June 18, 2023 23:04
Code to test different exploration strategies for Multi armed bandits
import numpy as np
import matplotlib.pyplot as plt
import math
number_of_bandits=10
number_of_arms=10
number_of_pulls=30000
epsilon=0.3
temperature=10.0
min_temp = 0.1
decay_rate=0.999
@physacco
physacco / README.md
Last active December 8, 2024 07:48
Python 3 extension example

Python 3 extension example

Build

python3 setup.py build

Output: build/lib.macosx-10.11-x86_64-3.5/hello.cpython-35m-darwin.so

Run

@sleepygarden
sleepygarden / deobfuscate.js
Created April 6, 2016 19:17
Partially deobfuscated hexasphere.js april fools day joke - http://pub.ist.ac.at/~edels/hexasphere/
function canvasApp() {
if (!canvasSupport()) {
return;
}
var canvas = document.getElementById('canvasOne');
var ctx = canvas.getContext('2d');
setup();
@joepie91
joepie91 / vpn.md
Last active July 3, 2025 09:58
Don't use VPN services.

Don't use VPN services.

No, seriously, don't. You're probably reading this because you've asked what VPN service to use, and this is the answer.

Note: The content in this post does not apply to using VPN for their intended purpose; that is, as a virtual private (internal) network. It only applies to using it as a glorified proxy, which is what every third-party "VPN provider" does.

  • A Russian translation of this article can be found here, contributed by Timur Demin.
  • A Turkish translation can be found here, contributed by agyild.
  • There's also this article about VPN services, which is honestly better written (and has more cat pictures!) than my article.