Skip to content

Instantly share code, notes, and snippets.

View lftbrts's full-sized avatar

lftbrts

  • Hamburg, Germany
View GitHub Profile
@lftbrts
lftbrts / git_remove_files_from_commit_after_push.txt
Last active January 14, 2022 09:35
how to remove files from commit after push
# HEAD~x means going back x commits before HEAD
git reset --soft HEAD~2
# run next cmd for all unwanted files
git reset HEAD path/to/unwanted_file
# squash commit
git commit -c ORIG_HEAD
@lftbrts
lftbrts / simple_hierarchy.php
Created August 19, 2020 07:09
simple hierarchy calculation
<?php
$hierarchy = [
'CUSTOMER_ADMIN',
'ADMIN',
'BUYER',
];
$currentRoles = [
'BUYER',
Somehow "iso9660" module not loaded. depmod scans all modules and create module dependencies if reboot does not work).
sudo depmod -a
sudo mount /dev/sr0 /mnt
ls -l /mnt
@lftbrts
lftbrts / redis-keys.sh
Last active February 6, 2020 14:20
redis | remove all keys by pattern immediatly
#!/usr/bin/env bash
redis-cli -n 0 -h localhost -p 10009 KEYS "kv:foo_baz:*" | xargs redis-cli -n 0 -p 10009 DEL
@lftbrts
lftbrts / locale.php
Created July 18, 2019 07:52
Change current system locale and reset after doing stuff
<?php
$locale = new Locale();
$currentLocale = $locale->currentLocale();
# do some stuff
\setLocale(\LC_ALL, 'en.US-UTF8');
#
$locale->resetLocale($currentLocale);
@lftbrts
lftbrts / benchmark+go+nginx.md
Created October 16, 2017 09:18 — forked from hgfischer/benchmark+go+nginx.md
Benchmarking Nginx with Go

Benchmarking Nginx with Go

There are a lot of ways to serve a Go HTTP application. The best choices depend on each use case. Currently nginx looks to be the standard web server for every new project even though there are other great web servers as well. However, how much is the overhead of serving a Go application behind an nginx server? Do we need some nginx features (vhosts, load balancing, cache, etc) or can you serve directly from Go? If you need nginx, what is the fastest connection mechanism? This are the kind of questions I'm intended to answer here. The purpose of this benchmark is not to tell that Go is faster or slower than nginx. That would be stupid.

So, these are the different settings we are going to compare:

  • Go HTTP standalone (as the control group)
  • Nginx proxy to Go HTTP
  • Nginx fastcgi to Go TCP FastCGI
  • Nginx fastcgi to Go Unix Socket FastCGI
@lftbrts
lftbrts / gitignore_symlinks.txt
Created May 16, 2017 11:53
git ignore symlinks
@lftbrts
lftbrts / md2mb.py
Created October 23, 2016 12:32
Convert dovecot maildir to mbox format (local or on mailserver)
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Frédéric Grosshans, 19 January 2012
Nathan R. Yergler, 6 June 2010
This file does not contain sufficient creative expression to invoke
assertion of copyright. No warranty is expressed or implied; use at
your own risk.