Skip to content

Instantly share code, notes, and snippets.

Marcel Stör marcelstoer

Block or report user

Report or block marcelstoer

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 website-hosting-with-git.sh
# see https://frightanic.com/web-authoring/website-hosting-with-git-a-tutorial/ for the full picture
#
# create remote repository
ssh user@host.com
mkdir repos
cd repos
mkdir example.git
cd example.git
git --bare init
# create local clone on development machine
@marcelstoer
marcelstoer / init.lua
Created Jun 3, 2018
NodeMCU Lua initializer with DNS & internet connectivity testing
View init.lua
WIFI_SSID = "--your-value-here--"
WIFI_PASSWORD = "--your-value-here--"
wifi_got_ip_event = function(T)
local site = "wikipedia.org"
-- Note: Having an IP address does not mean there is internet access!
-- Internet connectivity can be determined with net.dns.resolve().
print("WiFi connection is established! IP address is: " .. T.IP)
print("DNS server 1: " .. net.dns.getdnsserver(0))
print("DNS server 2: " .. net.dns.getdnsserver(1))
View Arduino-uint64ToString.c
// source: https://github.com/markszabo/IRremoteESP8266/blob/master/src/IRutils.cpp#L48
String uint64ToString(uint64_t input) {
String result = "";
uint8_t base = 10;
do {
char c = input % base;
input /= base;
if (c < 10)
@marcelstoer
marcelstoer / HtmlPopupTransientWindow.py
Created Sep 19, 2017
wxPython transient window with HTML support, selectable text and clickable links
View HtmlPopupTransientWindow.py
# coding=utf-8
import wx
import wx.html
import webbrowser
class HtmlPopupTransientWindow(wx.PopupTransientWindow):
def __init__(self, parent, style, html_body_content, bgcolor, size):
@marcelstoer
marcelstoer / publish-bme280-data-from-raspberry_pi-to-thingspeak.py
Last active Sep 9, 2017
Publish BME280 data from Raspberry Pi to ThingSpeak
View publish-bme280-data-from-raspberry_pi-to-thingspeak.py
import thingspeak # from https://thingspeak.readthedocs.io/en/latest/
import bme280 # from https://www.raspberrypi-spy.co.uk/2016/07/using-bme280-i2c-temperature-pressure-sensor-in-python/
# return the Pi CPU/GPU temperature in degree Celcius; it's a SoC and thus there's no need to read both, see
# https://www.cyberciti.biz/faq/linux-find-out-raspberry-pi-gpu-and-arm-cpu-temperature-command/#comment-796904
def get_temp():
with open('/sys/class/thermal/thermal_zone0/temp', 'r') as infile:
return float(infile.read()) * 1e-3
ch = thingspeak.Channel(275145, "*********", "*********")
@marcelstoer
marcelstoer / nodemcu-execution-time.lua
Created Apr 15, 2017
How to measure the execution time of a NodeMCU Lua function
View nodemcu-execution-time.lua
-- all credits go to http://www.esp8266.com/viewtopic.php?p=64968#p64968
function profile(name)
local start = tmr.now()
_G[name]()
local delta = tmr.now() - start
print(name .. " needs " .. (delta / 1000) .. " ms")
end
function longTime()
local sum = 0
View so-38990950.lua
someint = 5
a = 1
srv:listen(8080,function(conn)
conn:on("receive", function(client,request)
client:send(someint);
client:close(); -- btw, you should wait for 'sent' event before closing, see http://nodemcu.readthedocs.io/en/latest/en/modules/net/#example_6
end)
end)
@marcelstoer
marcelstoer / rotate-8x8-matrix-char_convert-while-rotating-no-matrix.lua
Created Jun 16, 2016
http://wp.me/pzoQb-sN shows how to draw to MAX7219 8x8 matrix displays, this gist shows how the convert the numbers while rotating without the use of a 0|1 matrix
View rotate-8x8-matrix-char_convert-while-rotating-no-matrix.lua
local rotate = function(char, rotateleft)
local tab = {}
local newTable = {}
local numberToString = function(number, base, minLen)
local s = ""
repeat
local remainder = number % base
s = remainder .. s
number = (number - remainder) / base
@marcelstoer
marcelstoer / rotate-8x8-matrix-char_convert-while-rotating.lua
Created Jun 16, 2016
http://wp.me/pzoQb-sN shows how to draw to MAX7219 8x8 matrix displays, this gist shows how the convert the numbers while rotating
View rotate-8x8-matrix-char_convert-while-rotating.lua
local numberToTable = function(number, base, minLen)
local t = {}
repeat
local remainder = number % base
table.insert(t, 1, remainder)
number = (number - remainder) / base
until number == 0
if #t < minLen then
-- "pad" table with 0s
for i = 1, minLen - #t do table.insert(t, 1, 0) end
@marcelstoer
marcelstoer / rotate-8x8-matrix-char_traditional.lua
Last active Jun 16, 2016
http://wp.me/pzoQb-sN shows how to draw to MAX7219 8x8 matrix displays, this gist shows the maybe "traditional" way of rotating characters
View rotate-8x8-matrix-char_traditional.lua
local numberToTable = function(number, base, minLen)
local t = {}
repeat
local remainder = number % base
table.insert(t, 1, remainder)
number = (number - remainder) / base
until number == 0
if #t < minLen then
-- "pad" table with 0s
for i = 1, minLen - #t do table.insert(t, 1, 0) end
You can’t perform that action at this time.