Skip to content

Instantly share code, notes, and snippets.

View postspectacular's full-sized avatar
🎉
Celebrating 24 years of building open source tools

Karsten Schmidt postspectacular

🎉
Celebrating 24 years of building open source tools
View GitHub Profile
@ServerlessBot
ServerlessBot / IAMCredentials.json
Last active February 24, 2025 15:51
Minimum credential set for Serverless Framework
{
"Statement": [
{
"Action": [
"apigateway:*",
"cloudformation:CancelUpdateStack",
"cloudformation:ContinueUpdateRollback",
"cloudformation:CreateChangeSet",
"cloudformation:CreateStack",
"cloudformation:CreateUploadBucket",
@spacechase0
spacechase0 / NodeGraph.cpp
Last active August 24, 2024 16:06
ImGui node graph
#include <any>
#include <cmath>
#include <imgui.h>
#include <imgui_internal.h>
#include "NodeGraph.hpp"
namespace
{
@fnky
fnky / ANSI.md
Last active April 16, 2025 03:12
ANSI Escape Codes

ANSI Escape Sequences

Standard escape codes are prefixed with Escape:

  • Ctrl-Key: ^[
  • Octal: \033
  • Unicode: \u001b
  • Hexadecimal: \x1B
  • Decimal: 27
(require '[thi.ng.color.core :as col]))
(defn cosine-coeficients
"amp = (R1-R2) / 2; dc offset = R1-amp; freq = -0.5"
([h1 h2]
(let [coerce #(col/as-rgba (col/hex->int %))
colors (->> [(coerce h1) (coerce h2)]
(map #(select-keys % [:r :g :b])))
[c1 _] colors
@anthonytxie
anthonytxie / hodl20.py
Created March 24, 2018 21:01
Hodl 20 Rebalancing Algorithm
def calc_allocations(self, date, quantity, cap):
"""Figure out ideal allocations for a given date"""
# {
# coin_name: (percent_allocation, data)
# }
top_market = self.get_top_market(date, quantity)
total_cap = sum([coin.market_cap for coin in top_market])
allocations = [{
@ChemistAion
ChemistAion / Nodes.cpp
Created January 25, 2018 15:02
Prototype of standalone node graph editor for ImGui
// Prototype of standalone node graph editor for ImGui
// Thread: https://github.com/ocornut/imgui/issues/306
//
// This is based on code by:
// @emoon https://gist.github.com/emoon/b8ff4b4ce4f1b43e79f2
// @ocornut https://gist.github.com/ocornut/7e9b3ec566a333d725d4
// @flix01 https://github.com/Flix01/imgui/blob/b248df2df98af13d4b7dbb70c92430afc47a038a/addons/imguinodegrapheditor/imguinodegrapheditor.cpp#L432
#include "Nodes.h"
@cecilemuller
cecilemuller / launch.json
Last active April 4, 2025 13:08
Run ts-node in VSCode Debugger
{
"version": "0.2.0",
"configurations": [
{
"name": "Example",
"type": "node",
"request": "launch",
"runtimeExecutable": "node",
"runtimeArgs": ["--nolazy", "-r", "ts-node/register/transpile-only"],
@gboudreau
gboudreau / AuthyToOtherAuthenticator.md
Last active April 16, 2025 07:17 — forked from Ingramz/AuthyToOtherAuthenticator.md
Export TOTP tokens from Authy

Exporting your 2FA tokens from Authy to transfer them into another 2FA application

IMPORTANT - Update regarding deprecation of Authy desktop apps

Past August 2024, Authy stopped supported the desktop version of their apps:
See Authy is shutting down its desktop app | The 2FA app Authy will only be available on Android and iOS starting in August for details.

And indeed, after a while, Authy changed something in their backend which now prevents the old desktop app from logging in. If you are already logged in, then you are in luck, and you can follow the instructions below to export your tokens.

If you are not logged in anymore, but can find a backup of the necessary files, then restore those files, and re-install Authy 2.2.3 following the instructions below, and it should work as expected.

@beshanoe
beshanoe / aem1k_symmetry.js
Last active February 20, 2018 01:36
aem1k symmetry explanation
// I've passed the original symmetrical code through the Prettier
// Most of the lines do nothing but make code look symmetrical
// Still it's amazing :)
{
0.0 - {} - 0
}
xXXx = wYYw = // 'alert(xXXx)'
([] + !!+[])[0 ** 0.0] + // 'a'
[[]] + // ''
@paniq
paniq / fractional_arithmetic.md
Last active February 16, 2017 20:31
fractional_arithmetic.md

Fractional Arithmetic

When we represent numbers as fractions of integer numerator and denominator, we can perform arithmetic on these fractions. This is useful for situations where we wish to work with fractional values, but need lossless results, something that floating point encoding can not always guarantee.

We represent a fractional number as a tuple of two integer values, separated by a slash: