Skip to content

Instantly share code, notes, and snippets.

View sanderfoobar's full-sized avatar

Sander sanderfoobar

  • City 17
View GitHub Profile
@bitraid
bitraid / reddit.user.js
Last active November 26, 2022 18:41
greasemonkey reddit to teddit
// ==UserScript==
// @name reddit to teddit
// @namespace https://gist.github.com/bitraid/d1901de54382532a03b9b22a207f0417
// @version 1.0
// @description reddit to teddit
// @match *://*.reddit.com/*
// @match *://reddit.com/*
// @grant none
// @run-at document-start
// ==/UserScript==
@ciscorn
ciscorn / install_pillow_simd.sh
Created May 4, 2018 07:50
Install pillow-simd on Ubuntu
#!/bin/env bash
pip3 uninstall pillow
apt install \
libjpeg-turbo8-dev \
zlib1g-dev \
libtiff5-dev \
liblcms2-dev \
libfreetype6-dev \
@weihanglo
weihanglo / draw_gradient_pillow.py
Last active June 15, 2023 04:10
Draw gradient color with Pillow
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from PIL import Image, ImageDraw
im = Image.open('img_original.png')
def interpolate(f_co, t_co, interval):
det_co =[(t - f) / interval for f , t in zip(f_co, t_co)]
for i in range(interval):
@jhnns
jhnns / git-pr
Last active March 15, 2021 07:50
Git custom command to quickly checkout pull-requests from different origins as described in https://help.github.com/articles/checking-out-pull-requests-locally. Place this file somewhere in your path and git will run it everytime you type `git pr ...`
#!/bin/bash
if [ -z "$1" ]; then
echo "Usage: git pr [clean] [<remote>] <id-or-url>"
echo ""
echo "Examples:"
echo "git pr 42 --> git fetch origin pull/42/head:pr/origin/42"
echo "git pr upstream 42 --> git fetch upstream pull/42/head:pr/upstream/42"
echo "git pr https://github.com/peerigon/phridge/pull/1 --> git fetch https://github.com/peerigon/phridge.git pull/1/head:pr/peerigon/phridge/1"
echo "git pr clean --> Deletes all branches that match pr/*/* and pr/*/*/*"
def int_to_tuple(num, base=4):
result = ((),) * (num % base)
if num >= base:
result = (int_to_tuple(num // base, base),) + result
return result
def tuple_to_int(tup, base=4):
if len(tup) == 0:
return 0
return tuple_to_int(tup[0], base)*base + tup.count(())
@bkdinoop
bkdinoop / login-example
Last active April 8, 2024 07:05
Flask-Login : login.py created by https://github.com/maxcountryman : Matthew Frazier
# -*- coding: utf-8 -*-
"""
Flask-Login example
===================
This is a small application that provides a trivial demonstration of
Flask-Login, including remember me functionality.
:copyright: (C) 2011 by Matthew Frazier.
:license: MIT/X11, see LICENSE for more details.
"""