Skip to content

Instantly share code, notes, and snippets.

View mkg20001's full-sized avatar
🌟
rinse and repeat, rise and shine

Maciej Krüger mkg20001

🌟
rinse and repeat, rise and shine
View GitHub Profile
@mkg20001
mkg20001 / cjs-to-esm-helpers.js
Last active August 31, 2021 21:56
Common things from CJS brought to ESM
/*
NOTE:
- The metadata of the current module "module" in ESM is under "import.meta"
- Dynamic import is always async, meaning you need to await it
- Also if you export default it's under .default, no longer returned directly
*/
@mkg20001
mkg20001 / export-chrome-domains.js
Last active July 6, 2021 06:43
Export all Domains from Chrome Browser History
'use strict'
// go to https://takeout.google.com/settings/takeout
// Create new export
// Select chrome
// Download the export
// Extract it and run this script in the folder (you can directly run from node REPL)
const history = require('./Takeout/Chrome/BrowserHistory.json')
@mkg20001
mkg20001 / setup-ubuntu-container.sh
Created June 30, 2021 12:47
Ubuntu LXD container for local development with home folder mounted
#!/usr/bin/env/bash
# launch as "setup-ubuntu-container.sh <container-name>"
# replace "maciej" with your username and you're good to go
# NOTE: this assumes you're UID 1000 on your local system, otherwise this script needs tweaks
set -exuo pipefail
NAME="$1"
@mkg20001
mkg20001 / reticulum-dev-setup.sh
Created April 17, 2021 12:08
Setup a reticulum (hubs) development environment
curl -fsSL https://deb.nodesource.com/setup_14.x | bash -
apt install -y nodejs
apt update
wget https://packages.erlang-solutions.com/erlang-solutions_2.0_all.deb && sudo dpkg -i erlang-solutions_2.0_all.deb
apt update
apt install esl-erlang elixir -y
apt install postgresql -y
@mkg20001
mkg20001 / lotus.nix
Created February 14, 2021 17:30
nix derivation to build filecoin lotus
with (import ./. {});
let
lotusSrc = fetchFromGitHub {
owner = "filecoin-project";
repo = "lotus";
# master (nix-prefetch-github filecoin-project lotus --fetch-submodules --nix)
rev = "95e47cf9982c1c3538f4de8037ca5476cbaedab0";
sha256 = "lZmVYqs6wVzT0om8fvpDrP5pFDIYJZnZmQHM+RsP25I=";
fetchSubmodules = true;

A snippet that allows securly modifying the .htaccess file

Remeber to replace your-plugin with the id of your plugin

@mkg20001
mkg20001 / roxn.js
Created June 10, 2020 04:18
Base Conversion Function
// ib = input base
// ob = output base
// n = number to convert
// r = leftover from division
// o = output number
// x = exponent (base ^ position)
function roxn(ib, ob, n) {
let x = 1
let o = 0

build test

git clone https://gist.github.com/mkg20001/6d8a607a28131176fb6ed3b94c282c71 iso-build
cd iso-build
git clone https://github.com/mkg20001/nixpkgs -b rework-boot ../nixpkgs
bash iso.sh
bash boot-iso.sh
'use strict'
const query = "& (= a 'test') (= b 'test')"
const query2 = "and(equals(a, 'test'), equals(b, 'test'))"
function parseTokens1 (tokens) {
let i = 0
let block = 'exprLeft'
let stack = []
@mkg20001
mkg20001 / README.md
Last active September 26, 2019 15:52
new.css

new.css

Tiny "new" badge for your site

preview

Use with

<new/>