Skip to content

Instantly share code, notes, and snippets.

Thomas Mohaupt thomo

Block or report user

Report or block thomo

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View example_multiprocessing.py
import collections
import multiprocessing
import time
startzeit = time.time()
Scientist = collections.namedtuple('Scientist', [
'name',
'born',
])
@thomo
thomo / mkdir-tmpfs
Created Feb 21, 2019
Creates necessary directories in tmpfs mount points
View mkdir-tmpfs
#!/bin/sh
### BEGIN INIT INFO
# Provides: mkdir-tmpfs
# Required-Start: mountall
# Required-Stop:
# Should-Stop:
# X-Start-Before:
# Default-Start: 1 2 3 4 5
# Default-Stop:
@thomo
thomo / jquery.feedToJSON.js
Created Feb 11, 2019
Patch retired Yahoo yql API in MagicMirror v1
View jquery.feedToJSON.js
//jQuery extension to fetch an rss feed and return it as json via YQL
//created by dboz@airshp.com
(function($) {
$.extend({
feedToJson: function(options, callback) {
if ($.isFunction(options)) {
callback = options;
options = null;
}
@thomo
thomo / isDateTimeValid.lua
Created Mar 30, 2018
Small function to verify validity of datetime (to use with https://gist.github.com/thomo/8ac2bceb6400eb8868c651e8897be958)
View isDateTimeValid.lua
function isDateTimeValid(second, minute, hour, day, month, year)
function check(x, xmin, xmax)
return x >= xmin and x <= xmax
end
return check(second, 0, 59) and check(minute, 0, 59) and check(hour, 0, 23) and
check(day, 1, 31) and check(month, 1, 12) and check(year, 0, 99)
end
@thomo
thomo / datetime2epoch.lua
Last active Mar 25, 2018
Convert from human readable date/time to epoch timestamp
View datetime2epoch.lua
-- The MIT License (MIT)
-- Copyright (c) 2018, Thomas Mohaupt <thomas.mohaupt@gmail.com>
function datetime2epoch(second, minute, hour, day, month, year)
local mi2sec = 60
local h2sec = 60 * mi2sec
local d2sec = 24 * h2sec
-- month to second, without leap year
local m2sec = {
0,
View DirectoryCollector.java
public class DirectoryCollector implements Collector {
private final PlainFileFilter fileFilter;
public DirectoryCollector(PlainFileFilter ff) {
fileFilter = ff;
}
@Override
public List<FileData> collect(Path path) {
@thomo
thomo / start.cmd
Created Jan 18, 2017
cscript mit watchdog
View start.cmd
@ECHO off
cd "D:\Daten\Skripte\"
start /min cmd /c watchdog.cmd
c:\Windows\SysWOW64\cscript.exe "D:\Daten\Skripte\Sync.vbs" %*
del watchdog_starttimestamp.ts 2> nul
@thomo
thomo / user.lua
Created Jan 7, 2017
Wifi Scanner with ESP8266 + TFT ST7735B (NodeMCU)
View user.lua
-- setup SPI and connect display
function init_spi_display()
-- Hardware SPI CLK = GPIO14
-- Hardware SPI MOSI = GPIO13
-- Hardware SPI MISO = GPIO12 (not used)
-- Hardware SPI /CS = GPIO15 (not used)
-- CS, D/C, and RES can be assigned freely to available GPIOs
local cs = 8 -- GPIO15, pull-down 10k to GND
local dc = 4 -- GPIO2
local res = 0 -- GPIO16
View gist:d8af6a000525faa104b2e2fd66b15b50
esptool.py --port /dev/tty.wchusbserialfa1* --baud 115200 write_flash 0x00000 nodemcu-master-10-modules-2016-08-21-14-41-09-float.bin 0x3fc000 esp_init_data_default.bin -fm=dio -fs=32m
@thomo
thomo / Sandbox Anleitung.md
Created Apr 25, 2016
Anleitung für die Einrichtung einer "Terraforming Sandbox" entsprechend http://idav.ucdavis.edu/~okreylos/ResDev/SARndbox/
View Sandbox Anleitung.md
  • Terminal Fenster öffnen (Symbol ">_")

  • "./start_sandbox.sh" eingeben -> enter

  • es erscheint ein Fenster "RawKinectViewer"

    • links: "Tiefenbild" der Kinect (eher blau)

    • rechts: Kamarabild der Kinect

    • Ausschnitt des Tiefenbilds vergößern, so dass Sandbox möglichst groß zu sehen ist

You can’t perform that action at this time.