Skip to content

Instantly share code, notes, and snippets.

View aeinbu's full-sized avatar

Arjan Einbu aeinbu

View GitHub Profile

Different ways to search a git repo

git log -S "..."
git log -S "..." --pickaxe-regex
git log -G "..."
git log --grep="..."

See docs for

@aeinbu
aeinbu / .zshrc
Last active November 8, 2023 19:54
`la` and `mkcd` commands
alias la="ls -a"
mkcd() {
mkdir $1 && cd $1
}
@aeinbu
aeinbu / adhoc.js
Last active January 8, 2023 10:48
Quick queries over json files...
const {
chain,
filter,
count,
groupBy,
map
} = require("./chaining")
const transforms = [
public abstract record StronglyTypedId<TValue>(TValue Value)
where TValue : notnull
{
public override sealed string ToString() => $"{Value}";
}
function round(value, precision) {
return Number(Math.round(value + "e" + precision) + "e-" + precision)
}
function strictCompare(left, right) {
console.log(`strictCompare(${left}, ${right})`);
return left === right;
}
function Deferred() {
this.resolve = null;
this.reject = null;
this.promise = new Promise((resolve, reject) => {
this.resolve = resolve;
this.reject = reject;
});
}
@aeinbu
aeinbu / wrapInDebugModeProxy.tests.ts
Created May 8, 2020 07:01
Makes new object that guards against executing methods and changing properties when not in debug mode
import { wrapInDisablerProxyFactory } from "./wrapInDebugModeProxy"
describe("Enable/disable functions", () => {
const obj = {
flipTheFlag(target) {
target.flag = true
},
inner: {
anotherFlipTheFlag(target) {

Linux users/groups/permissions cheatsheet

Add user

sudo useradd -m peter
sudo passwd peter

groupadd myAppUsers

sudo usermod -a -G peter myAppUsers

How to add a new disk in Linux

This post takes you through creating a partition, formatting it and finally mount it in the filesystem.

These procedures where tested on Linux Mint 19

List disks and partitions

$ sudo fdisk -l

The result will vary depending on the number of disk you have. On my computer I got these three entries:

Running docker images cheatsheet

Download a docker image

Download the image called debian:

docker pull debian

Create a container (and start it)

The container in the samples will be named "debby"