Skip to content

Instantly share code, notes, and snippets.

@siloam
siloam / code.py
Created May 23, 2022 11:00 — forked from joeycastillo/code.py
LCD clock with ambient conditions on ESP32-S2 Feather
import board
import rtc
import time
import alarm
from adafruit_bme280 import basic as adafruit_bme280
from adafruit_lc709203f import LC709203F, PackSize
from oso_lcd.lcdwing_lite import LCDWingLite, Indicator
display = LCDWingLite(board.I2C())
display.clear_indicator(Indicator.MOON)
@siloam
siloam / blake2.md
Created May 24, 2021 08:15 — forked from sooryan/blake2.md
A quick summary of blake2, a cryptographic hash function

BLAKE2

  • BLAKE2 is an improved version of the SHA-3 finalist BLAKE, and was designed by a team of experts in cryptanalysis, implementation, and cryptographic engineering; namely Jean-Philippe Aumasson, Samuel Neves, Zooko Wilcox-O'Hearn and Christian Winnerlein.

  • BLAKE2s (the one checksum currently uses) computes a message digest that is 256 bits long, and represented as a 64-character hexadecimal number, e.g. 4264cb256d94533b6e152da59256638bc6adfda3efc5550d7607d4e6e45592fc.

Types

  • BLAKE2b (or just BLAKE2) is optimized for 64-bit platforms and produces digests of any size between 1 and 64 bytes.
@siloam
siloam / TileLayer.GeoJSON.js
Created July 30, 2020 05:44 — forked from glenrobertson/TileLayer.GeoJSON.js
Leaflet GeoJSON Tile Layer Example
// Load data tiles from an AJAX data source
L.TileLayer.Ajax = L.TileLayer.extend({
_requests: [],
_addTile: function (tilePoint) {
var tile = { datum: null, processed: false };
this._tiles[tilePoint.x + ':' + tilePoint.y] = tile;
this._loadTile(tile, tilePoint);
},
// XMLHttpRequest handler; closure over the XHR object, the layer, and the tile
_xhrHandler: function (req, layer, tile, tilePoint) {
@siloam
siloam / baseConverter.js
Created July 29, 2020 13:23 — forked from faisalman/baseConverter.js
Convert From/To Binary/Decimal/Hexadecimal in JavaScript
/**
* Convert From/To Binary/Decimal/Hexadecimal in JavaScript
* https://gist.github.com/faisalman
*
* Copyright 2012-2015, Faisalman <[email protected]>
* Licensed under The MIT License
* http://www.opensource.org/licenses/mit-license
*/
(function(){
@siloam
siloam / osm2geo.js
Created July 22, 2020 09:48 — forked from tecoholic/osm2geo.js
OSM2GEO - A JS Converter to convert OSM to GeoJSON
/**************************************************************************
* OSM2GEO - OSM to GeoJSON converter
* OSM to GeoJSON converter takes in a .osm XML file as input and produces
* corresponding GeoJSON object.
*
* AUTHOR: P.Arunmozhi <aruntheguy@gmail.com>
* DATE : 26 / Nov / 2011
* LICENSE : WTFPL - Do What The Fuck You Want To Public License
* LICENSE URL: http://sam.zoy.org/wtfpl/
*
var saveBlob = (function () {
var a = document.createElement("a");
document.body.appendChild(a);
a.style = "display: none";
return function (blob, fileName) {
var url = window.URL.createObjectURL(blob);
a.href = url;
a.download = fileName;
a.click();
window.URL.revokeObjectURL(url);
@siloam
siloam / stream.py
Created November 12, 2018 17:22 — forked from fengsp/stream.py
Streaming data with Python and Flask
"""
stream
~~~~~~
Streaming data with Python and Flask.
:copyright: (c) 2014 by Shipeng Feng.
:license: BSD.
"""
import time
@siloam
siloam / daemon.py
Created November 12, 2018 17:21 — forked from fengsp/daemon.py
A simple daemon in Python
"""
daemon
~~~~~~
A simple daemon.
:copyright: (c) 2015 by Shipeng Feng.
:license: BSD.
"""
import os