Skip to content

Instantly share code, notes, and snippets.

View Xennis's full-sized avatar
🚀
rocketing

Fabian Rosenthal Xennis

🚀
rocketing
View GitHub Profile
@Xennis
Xennis / verify-paddle-webhook-signature.ts
Last active November 15, 2023 15:04
Verify Paddle webhook signature as described in https://developer.paddle.com/webhooks/signature-verification (in TypeScript)
import { createHmac } from "crypto"
// Verify according to https://developer.paddle.com/webhooks/signature-verification
const verifyPaddleSignature = async (payload: string, header: string | null, secret: string) => {
if (!header) {
return false
}
const [tsPart, h1Part] = header.split(";")
if (!tsPart || !h1Part) {
return false
@Xennis
Xennis / .gitignore
Created August 23, 2017 18:45
xennis-radio
/media/
############
## Python
############
*.pyc
############
@Xennis
Xennis / split.py
Created January 7, 2016 17:15
Split a texfiles
import sys
def split_file(filename, num_max_lines=None):
num_lines = 0
with open(filename) as f:
for line in f:
num_lines += 1
sys.stdout.write(line)
if num_max_lines and num_lines >= num_max_lines:
break
@Xennis
Xennis / hierarchy.php
Last active August 29, 2015 14:27 — forked from devi/hierarchy.php
MySQL "Closure Table" for Kohana based on Bill Karwin design.
<?php defined('SYSPATH') or die('No direct script access.');
/**
* MySQL "Closure Table" for Kohana based on Bill Karwin design.
*
* @link http://www.slideshare.net/billkarwin/models-for-hierarchical-data
* @TODO improve
*
* sql schema:
* CREATE TABLE `closures` (
* `id` int(11) NOT NULL AUTO_INCREMENT,
###############################################################################
# LaTeX custom auto completion list
#
# for the LaTeX editor [Texmaker](http://www.xm1math.net/texmaker/):
# ´User´ > ´Customize Completion´
#
###############################################################################
## For [LaTeX_Vorlage_Uebungsblatt.tex](https://gist.github.com/Xennis/9637696)
\exercise
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: LaTeX_clean.bat
:: Source: https://gist.github.com/Xennis/dbfc0f0ace304d1f76f2
::
:: Based on Git ignore list:
:: http://xennis.org/wiki/Git_-_Ignore#LaTeX
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: Generated files
del *.aux
private void enableHTML5AppCache() {
webView.getSettings().setDomStorageEnabled(true);
// Set cache size to 8 mb by default. should be more than enough
webView.getSettings().setAppCacheMaxSize(1024*1024*8);
// This next one is crazy. It's the DEFAULT location for your app's cache
// But it didn't work for me without this line
webView.getSettings().setAppCachePath("/data/data/"+ getPackageName() +"/cache");
@Xennis
Xennis / google-maps-js_radius_from_meters_to_pixels.js
Last active November 7, 2023 13:20
Google Maps JS API - Convert a radius from meters to pixels
/**
* Google Maps JavaScript API - Convert a radius given in meters to the
* corresponding number of pixel.
*
* ### Credits:
*
* "JS Bin - rorecuce",
* http://jsbin.com/rorecuce/1/edit
*
* Example "Showing pixel and tile coordinates",
#!/bin/sh
git filter-branch --env-filter '
an="$GIT_AUTHOR_NAME"
am="$GIT_AUTHOR_EMAIL"
cn="$GIT_COMMITTER_NAME"
cm="$GIT_COMMITTER_EMAIL"
if [ "$GIT_COMMITTER_EMAIL" = "[email protected]" ]