Skip to content

Instantly share code, notes, and snippets.

View Suppenterrine's full-sized avatar
🌿
I can't. I have plants tonight.

Lukas Baumert Suppenterrine

🌿
I can't. I have plants tonight.
View GitHub Profile
@Suppenterrine
Suppenterrine / getMonthsAndDays.js
Last active February 18, 2022 23:56
Get MySQL formatted dates and month strings from past months (dynamic)
let diff_dt_now = new Date();
let diff_dt_const = new Date('2020-12-31');
// delta between current month and 2020-12-31 (integer)
let month_diff = (diff_dt_const.getTime() - diff_dt_now.getTime()) / 1000;
month_diff /= (60 * 60 * 24 * 7 * 4);
month_diff = Math.abs(Math.round(month_diff));
class Month {
constructor (range) {
@zeljic
zeljic / build_sqlite3_lib.md
Last active May 12, 2024 04:04
Build SQLite3 .lib file on windows

How to build SQLite3 .lib file on Windows 10

  1. Download source from source

    For example: source https://www.sqlite.org/2023/sqlite-amalgamation-3430100.zip

  2. Download binary from binary

    For example: binary https://www.sqlite.org/2023/sqlite-dll-win64-x64-3430100.zip

  3. Extract both archives to the same directory

@diogocapela
diogocapela / moment-js-timezones.txt
Created September 7, 2018 00:10
List of All Moment.js Timezones
Africa/Abidjan
Africa/Accra
Africa/Addis_Ababa
Africa/Algiers
Africa/Asmara
Africa/Asmera
Africa/Bamako
Africa/Bangui
Africa/Banjul
Africa/Bissau
@cwschroeder
cwschroeder / MQTT Client
Last active October 13, 2023 09:50
Example of a C# MQTT client
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
@xposedbones
xposedbones / map.js
Last active May 1, 2024 11:15
Javascript Map range of number to another range
Number.prototype.map = function (in_min, in_max, out_min, out_max) {
return (this - in_min) * (out_max - out_min) / (in_max - in_min) + out_min;
}
@skinofstars
skinofstars / gist:4207221
Created December 4, 2012 18:29
Whitespace python for loop - for when you don't want to use split( )
entry = input("Enter a Mayan date: ")
i=0 # this is used to track our position in the string
output = "" # start with output set to nothing
while entry[i:]:
# if we hit a space, then we've got to the end of that number
# print it out and reset the output
if entry[i] == " ":
print (output)
@SegFaultAX
SegFaultAX / fib.lua
Created May 23, 2012 00:48
Lua Fibonacci
-- Author: Michael-Keith Bernard
-- Date: May 22, 2012
-- Description: Various implementations of the Fibonacci sequence in Lua. Lua
-- has native support for tail-call elimination which is why `tail_call` and
-- `continuation` run in near constant time. For sufficiently large numbers of n
-- you can start to see linear performace characteristics (particularly for the
-- `continuation` implementation), but ultimately the `tail_call` implementation
-- is an order of magnitude faster than iteration even for values of n as small
-- as 500k.