Skip to content

Instantly share code, notes, and snippets.

@lentschi
lentschi / replace-emojis.pipe.md
Last active May 1, 2020 10:35
Angular 2+ pipe to replace emoji-mart emojis with an html element displaying their image representation
@lentschi
lentschi / idb-iterator.ts
Last active February 11, 2024 10:30
AsyncIterableIterator for IndexedDB object stores and indexes
/**
* Asyncronous iterable iterator for IndexedDB object stores or indexes
*
* @author Florian Lentsch <office@florian-lentsch.at>
* @license MIT
*
* ____________________________________________________________________________
* REQUIREMENTS: You may have to add "lib": ["esnext.asynciterable"] to
* your tsconfig.json - see https://stackoverflow.com/questions/43694281/ts2318-cannot-find-global-type-asynciterableiterator-async-generator?answertab=votes#tab-top
*
@lentschi
lentschi / xsudo.sh
Last active July 29, 2020 22:32
Run a program requiring xserver as another user by passing on the xauth cookie
#!/bin/bash -e
# Run a program requiring xserver as another user by passing on the xauth cookie
# s. http://askubuntu.com/questions/871092/failed-to-connect-to-mir-failed-to-connect-to-server-socket-no-such-file-or-di?newreg=811c7a1d637341c5b294d8b515e8b6e7
# s. http://serverfault.com/questions/51005/how-to-use-xauth-to-run-graphical-application-via-other-user-on-linux
# AUTHOR: Florian Lentsch <office@florian-lentsch.at>
# TESTED: on Ubuntu 16.04 only
#
# USAGE: xsudo <username> <command>
@lentschi
lentschi / add_docker_host.py
Created November 5, 2016 16:17
alias a docker container's ip to /ect/hosts
#!/usr/bin/env python
# Script to alias a docker container's primary IPv4 address
# with the desired host_name in /ect/hosts
#
# Usage: add_container_to_hosts <container_name> <host_name>
#
# CAVEAT: Currently won't work for IPv6 addresses and will only work
# on platforms, where the hosts file can be found under /etc/hosts
#
@lentschi
lentschi / mdb-dump.sh
Created June 7, 2016 04:54
Dumps schema and data of a Microsoft Access database file to mysql (REQUIRES mdbtools!)
#!/bin/bash
# Dumps schema and data of mdbfile (which can be .accdb too) to mysql
if [ $# -ne 2 ]; then
echo usage: $0 mdbfile mysqlfile
exit 1
fi
mdb-schema $1 mysql > $2