Skip to content

Instantly share code, notes, and snippets.

View makadev's full-sized avatar

Matthias Karbe makadev

  • Germany
View GitHub Profile
#!/bin/bash
REPO_STORE=/home/git/repo-mirror
REPO_POS=${REPO_STORE}/${GL_REPO}.git
# change umask such that anyone can read the repositories (read/search for all, rw/search for owner)
umask 022;
# uncomment for local side information on push
#echo "**UPDATE MIRROR** @" ${REPO_POS}
@makadev
makadev / realmdb.swift
Last active March 7, 2021 16:39
Swift 3 Realm (realm.io) Database Helper Singleton with exclusive queue and lightweight configuration
import Foundation
import RealmSwift
class RealmDB {
//MARK:- Migration Information
static let currentSchema: UInt64 = 1;
/**
@makadev
makadev / batch_resize.sh
Created January 27, 2017 11:05
Bash batch resizing script using lanczos with imagemagicks convert
#!/bin/bash
#### setup
print_error() {
echo "$*"
echo ""
echo "Usage: $0 <Format> <Target Directory> <Files>"
echo ""
echo "Format: check out http://www.imagemagick.org/Usage/resize/#resize, f.e. 512x512"
extension Dictionary {
/**
Check that given Order List is a consistent Order List for given Table:
1. Order and Table have the same amount of Entries
2. All Keys in Order List are Key in Table and there is no Duplicate
*/
public static func OrderTableSanityCheck(forTable table: [Key:Value], withOrder order: [Key]) -> Bool {
// sanitize check 1: both need to have the same amount of element
@makadev
makadev / Debouncer.js
Last active May 24, 2017 10:33
Generic Event Debouncer (f.e. for resize event)
"use strict";
function Debouncer() {
var deb_record = {
exists: false,
fn: null,
delay: 0,
registered: 0,
invoke: false,
handler: null
@makadev
makadev / scan_new.sh
Created July 6, 2017 12:57
Bash script for searching (and creating) a list of files that where modified since the last run.
#!/bin/bash
############
## CONFIG ##
############
# SET SN_NAMESPACE - will be used to create filenames and reduce possible collusions
# SET SN_DIR - directory to scan
# (OPTIONAL) SET SN_DB_FILE - will be used to create the db file which holds the last updated files
# (OPTIONAL) SET SN_GUARD_FILE - will be used to create the run guard/lock file to stop multiple instances of this script
@makadev
makadev / makefile
Last active September 13, 2021 20:17
GNU Make Makefile for generating scaled iOS (iPhone) and Android App Icons using Imagemagick
## imagemagick convert
CONVERT=`which convert`
## Normal, should be at least 1024x1024
SRC_NAME=app_icon.png
## Rounded (as used by newer Android), should be at least 1024x1024
SRC_RNAME=app_icon.png
## Dest Image Path
DEST=app_icons
@makadev
makadev / looper.ts
Last active July 29, 2022 13:23
Simple endless loop (Looper) for NodeJS/TS (or ts-node)
/**
* Loop Handler Type
*/
type LoopHandler = () => void | never | boolean | Promise<void> | Promise<boolean>;
/**
* Shutdown Handler Type
*/
type ShutdownHandler = () => void;
@makadev
makadev / renew-gpgkey.md
Created March 29, 2023 12:00 — forked from krisleech/renew-gpgkey.md
Renew Expired GPG key

Renew GPG key

Given that your key has expired.

$ gpg --list-keys
$ gpg --edit-key KEYID

Use the expire command to set a new expire date: