Skip to content

Instantly share code, notes, and snippets.

View alexander-mart's full-sized avatar
💭
☮️

Alexander Mart alexander-mart

💭
☮️
View GitHub Profile
#!/bin/bash
# Connect to TerminusDB and dump all data (RDF-triplets) to local file
# https://gist.github.com/alexander-mart/ff1c896f55e5cc7774e922e3f977961b
# Access the TerminusDB CLI from the Docker Compose:
# https://terminusdb.com/docs/install-terminusdb-as-a-docker-container/#usingthecli
# TerminusDB dump command:
# https://terminusdb.com/docs/terminusdb-cli-commands/#triplesdump
@ggondim
ggondim / BuildTree.ts
Created January 18, 2022 00:03
Build a object tree (parent/children) given an object array of type T, the object ID key (elementKey) and the object parent key (parentKey)
type TreeItem<T> = T & { children: TreeItem<T>[] };
export default function buildTree<T>(array: T[], elementKey: keyof T, parentKey: keyof T): TreeItem<T>[] {
let tree = [] as TreeItem<T>[];
for (let i = 0; i < array.length; i++) {
if (array[i][parentKey]) {
let parent = array.filter(elem => elem[elementKey] === array[i][parentKey]).pop() as TreeItem<T>;
if (!parent['children']) {
parent.children = [];
}
@qoomon
qoomon / conventional-commits-cheatsheet.md
Last active June 9, 2025 10:18
Conventional Commits Cheatsheet
@RobertFischer
RobertFischer / Description.md
Last active October 14, 2023 16:47
Benchmarking is Hard, Yo.

So, I was reading Why You shouldn’t use lodash anymore and use pure JavaScript instead, because once upon a time, I shifted from Underscore to Lodash, and I'm always on the lookout for the bestest JavaScript stdlib. At the same time, there was recently an interesting conversation on Twitter about how some of React's functionality can be easily implemented in modern vanilla JS. The code that came out of that was elegant and impressive, and so I have taken that as a message to ask if we really need the framework.

Unfortunately, it didn't start out well. After copy-pasting the ~100 lines of code that Lodash executes to perform a find, there was then this shocking claim: Lodash takes 140ms, and native find takes 0ms.

@alejandro-martin
alejandro-martin / multiple-ssh-keys-git.adoc
Last active June 9, 2025 08:33
Configure multiple SSH Keys for Git

Use Multiple SSH Keys for Git host websites (Github, Gitlab)

This is guide about how to configure multiple SSH keys for some Git host websites such as Github, Gitlab, among others.

Creating SSH keys

  1. Create SSH directory:

@SanderTheDragon
SanderTheDragon / postman-deb.sh
Last active May 30, 2025 09:01
A shellscript to create a Postman .deb file, for simple installation on Debian-based Linux distro's. Also creates a .desktop file.
#!/bin/sh
# SPDX-FileCopyrightText: 2017-2024 SanderTheDragon <[email protected]>
#
# SPDX-License-Identifier: MIT
arch=$(dpkg --print-architecture)
echo "Detected architecture: $arch"
case "$arch" in
#!/bin/bash
# remove exited containers:
docker ps --filter status=dead --filter status=exited -aq | xargs -r docker rm -v
# remove unused images:
docker images --no-trunc | grep '<none>' | awk '{ print $3 }' | xargs -r docker rmi
# remove unused volumes:
find '/var/lib/docker/volumes/' -mindepth 1 -maxdepth 1 -type d | grep -vFf <(
@eyecatchup
eyecatchup / hosts
Last active April 24, 2025 12:43
Disable Skype ads: 1.) Add hosts to your hosts file 2.) Flush DNS resolver cache (ipconfig /flushdns)
# Block Skype ads
127.0.0.1 *.msads.net
127.0.0.1 *.msecn.net
127.0.0.1 *.rad.msn.com
127.0.0.1 a.ads2.msads.net
127.0.0.1 ac3.msn.com
127.0.0.1 ad.doubleclick.net
127.0.0.1 adnexus.net
127.0.0.1 adnxs.com
127.0.0.1 ads1.msn.com