Skip to content

Instantly share code, notes, and snippets.

View b3z's full-sized avatar
🚿
showering

b3z

🚿
showering
  • 03:27 (UTC +02:00)
View GitHub Profile
@b3z
b3z / gogsDownloader.sh
Created February 8, 2020 12:52
Download Gogs via command line.
curl -s https://api.github.com/repos/gogs/gogs/releases/latest \
| grep "linux_amd64.*zip" \
| cut -d : -f 2,3 \
| tr -d \" \
| wget -qi -
@b3z
b3z / theme.css
Created February 10, 2020 21:32
Yet another goes dark theme
.full {
background: #2E313E
}
.hljs {
display: block;
overflow-x: auto;
padding: 0.5em;
background-color: #2b2b2b !important;
@b3z
b3z / pouchdbBenchmark.ts
Created February 25, 2020 09:43
A little benchmark for typescript pouchdb. Hell it is fast.
//import PouchDB from 'pouchdb';
var PouchDB = require('pouchdb');
PouchDB.plugin(require('pouchdb-quick-search'));
class Database {
db: any;
constructor(databaseName: string) {
this.db = new PouchDB(databaseName);
@b3z
b3z / DrStrange.java
Created March 2, 2020 09:11
Yep, that one DrStrange gist.
import java.util.ArrayList;
import java.util.List;
class DrStrange {
private static List<Integer> numbers;
public DrStrange() {
numbers = new ArrayList<>(); }
@b3z
b3z / lineGenerator.py
Created July 30, 2020 10:20
Me trying to generate word lines for Discoed categories. I didn't succeed.
import sys
from fontTools.ttLib import TTFont
from fontTools.ttLib.tables._c_m_a_p import CmapSubtable
font = TTFont('whitney.ttf')
cmap = font['cmap']
t = cmap.getcmap(3,1).cmap
s = font.getGlyphSet()
units_per_em = font['head'].unitsPerEm
@b3z
b3z / pyny.py
Last active February 1, 2021 11:36
Tiny Python Webserver
#!/usr/bin/env python3
# A tiny webserver in python
# ready to run!
import os
import configparser
import socket
@b3z
b3z / resize.sh
Created September 17, 2020 11:04
Multi image resizing
#!/bin/bash
for f in p*.[jJ][pP][gG]
do
echo $f
convert $f -resize 1024x683^ -gravity center -extent 1024x683 print_$f
done
# resizes all jpgs in a dir to 1024x683 px with gravity centered:wq
@b3z
b3z / binding.md
Last active December 28, 2023 23:55
DDNet binding cheatsheet

Teewords config cheatsheet

In this repository you will find a collection of teeworlds binds, configs and scripts which you can use in your settings_ddnet.cfg

If you feel like a bind is missing please contribute.


How binding works

@b3z
b3z / otfSVD.java
Last active November 26, 2021 06:55
On the fly version polynomapproximation singular value decomposition
import org.apache.commons.math3.linear.Array2DRowRealMatrix;
import org.apache.commons.math3.linear.RealMatrix;
import org.apache.commons.math3.linear.SingularValueDecomposition;
public class Test3 {
public static void main(String[] args) {
double [][] data = {{12, 25425.6}, {15, 49816.5}, {23, 180506.9}, {27, 292460.1}};
int numCoefficients = 4; // 4 means a polynomial of rank 3 --> x3 + x2 + x1 + d
@b3z
b3z / inverse.py
Last active November 26, 2021 06:52
Multiplicative inverse element modulo n
def euka(a, b):
u, v, s, t = 1, 0, 0, 1
while b!=0:
q=a//b
a, b = b, a-q*b
u, s = s, u-q*s
v, t = t, v-q*t
return a, u, v
def modinverse(a, n):