Skip to content

Instantly share code, notes, and snippets.

@grifferz
grifferz / mastodon_well_known.conf
Last active September 27, 2023 08:47
Apache config snippet to redirect Mastodon webfinger
RewriteEngine On
RewriteCond %{QUERY_STRING} ^resource=acct:andy@ [NC]
RewriteRule /.well-known/webfinger https://social.bitfolk.com/.well-known/webfinger?resource=acct:grifferz@social.bitfolk.com [NC,L,R=301]
RewriteCond %{QUERY_STRING} ^resource=acct:grifferz@ [NC]
RewriteRule /.well-known/webfinger https://social.bitfolk.com/.well-known/webfinger?resource=acct:grifferz@social.bitfolk.com [NC,L,R=301]
@dwd
dwd / whatnwords.py
Created July 7, 2022 17:04
Encode lat/long using interleaved base32/NATO progressive representation
# Copyright 2022 Dave Cridland
# Licensed under MIT
import sys
lat, long = [float(n) for n in sys.argv[1:3]]
LIMIT = 2 ** 20
SHIFT = 6
// note : if you're on github gist and want to copy paste this code, you can click on the "Raw" button
// and then do Ctrl A, Ctrl C, Ctrl V
// (code below by Kurt Spencer, slightly modified code to run as Processing tab)
// maybe you should rather use this new (improved) version of the noise instead : https://github.com/KdotJPG/OpenSimplex2
/*
* OpenSimplex Noise in Java.
* by Kurt Spencer
*
* v1.1 (October 5, 2014)
@BalorPrice
BalorPrice / simple_scroll.asm
Last active March 13, 2023 22:55
Simple ZX Spectrum scroller - amended from John Metcalf's 69-byte scroller
org 32768
init_scroll:
ld hl,message-1 ; set to refresh char on first call
ld (scroll_pos),hl
ld hl,pix_count ; variable to check if new character needed
ld (hl),1
ret
update_scroll:
@fubel
fubel / radon_transform.py
Created September 4, 2016 09:43
Python implementation of the Radon Transform
""" Radon Transform as described in Birkfellner, Wolfgang. Applied Medical Image Processing: A Basic Course. [p. 344] """
from scipy import misc
import numpy as np
import matplotlib.pyplot as plt
def discrete_radon_transform(image, steps):
R = np.zeros((steps, len(image)), dtype='float64')
for s in range(steps):
rotation = misc.imrotate(image, -s*180/steps).astype('float64')
R[:,s] = sum(rotation)
@noelboss
noelboss / git-deployment.md
Last active July 16, 2024 09:50
Simple automated GIT Deployment using Hooks

Simple automated GIT Deployment using GIT Hooks

Here are the simple steps needed to create a deployment from your local GIT repository to a server based on this in-depth tutorial.

How it works

You are developing in a working-copy on your local machine, lets say on the master branch. Most of the time, people would push code to a remote server like github.com or gitlab.com and pull or export it to a production server. Or you use a service like deepl.io to act upon a Web-Hook that's triggered that service.

@tomas789
tomas789 / gist:10915069
Created April 16, 2014 18:07
C++/C++11 Variadic template CSV parser. Supports quoted strings, custom parsers, strongly typed, STL-like, generic, fast, highly customizable.
#include <functional>
#include <fstream>
#include <iostream>
#include <limits>
#include <sstream>
#include <tuple>
#include <vector>
template <typename ... TList>
struct DefaultParsersTuple;