Skip to content

Instantly share code, notes, and snippets.

View b3z's full-sized avatar
🚿
showering

b3z

🚿
showering
  • 14:15 (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 / 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 / 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 / olatDark.js
Last active November 14, 2021 15:32
Crappy OLAT Darkmode. But better than burning Eyes - paste in site inspect console - mod of MartB
(function() {
'use strict';
var cssStuff = "";
function addGlobalStyle(css) {
cssStuff += css + "\n";
}
function loadGlobalStyle(css) {
var html, style;
@b3z
b3z / nio_env.yml
Created November 18, 2021 18:17
A working PyNio environment for conda
name: nio
channels:
- conda-forge
- defaults
dependencies:
- boost-cpp=1.72.0=hdf9ef73_0
- bzip2=1.0.8=h0d85af4_4
- c-ares=1.18.0=h0d85af4_0
- ca-certificates=2021.10.8=h033912b_0
- cairo=1.16.0=hec6a9b0_1003
@b3z
b3z / SimplexSolverExample.java
Last active November 26, 2021 06:44
Apache Commons math3 Simplex solver example
import java.util.ArrayList;
import java.util.Collection;
import org.apache.commons.math3.optim.MaxIter;
import org.apache.commons.math3.optim.PointValuePair;
import org.apache.commons.math3.optim.linear.LinearConstraint;
import org.apache.commons.math3.optim.linear.LinearConstraintSet;
import org.apache.commons.math3.optim.linear.LinearObjectiveFunction;
import org.apache.commons.math3.optim.linear.NonNegativeConstraint;
import org.apache.commons.math3.optim.linear.Relationship;