Skip to content

Instantly share code, notes, and snippets.

@Spartelfant
Spartelfant / colors.js
Last active September 23, 2024 20:52
Bitburner ns2 script: a quick reference to all colors, printed to the terminal (at https://imgur.com/a/VtebvCM you can view a screenshot of the script in action)
/**
* Updated for game version 2.4.0
*/
/** @param {NS} ns */
export async function main(ns) {
ns.disableLog(`ALL`); // Failures are still logged, this just prevents unnecessary log spam.
ns.tprintf(`\x1b[1;35mUsing colors in script output with \x1b[1;36mtprint\x1b[1;35m & \x1b[36;1mtprintf\x1b[1;35m (terminal) and \x1b[36;1mprint\x1b[1;35m & \x1b[1;36mprintf\x1b[1;35m (log)`);
@dbiesecke
dbiesecke / docker-compose.yml
Last active November 15, 2024 16:42
RClone Docker Compose file - with rcd & additional options
version: '3.5'
networks:
default:
name: rclone
driver: "bridge"
services:
rclone:
@leonjza
leonjza / countips.py
Created August 24, 2022 09:15 — forked from joswr1ght/countips.py
Read a file of network + CIDR masks, one per line; count the number of IP addresses it represents
#!/usr/bin/env python3
#
# original: https://gist.github.com/joswr1ght/595d49d5a7914cf7305b73512f37186a
import sys
def countips(netblock):
v = netblock.split('/')
# nothing?
@dpino
dpino / last-successful-build-to-git-commit.sh
Last active August 9, 2024 13:46
Fetch commit of last successful WebKit build (default: GTK-Linux-64-bit-Release-Ubuntu-LTS-Build)
#!/usr/bin/env bash
# set -x
# Return commit of last successful WebKit build (default: GTK-Linux-64-bit-Release-Ubuntu-LTS-Build).
# Changes:
# 2022-11-16: Reworked script using changes suggested by asutherland to fetch commit number of last successful build directly from build.webkit.org.
BUILDER_NAME=${1:-GTK-Linux-64-bit-Release-Ubuntu-LTS-Build}
@Konijima
Konijima / Project Zomboid - How to mod like a boss.md
Last active June 24, 2025 01:12
Project Zomboid - How to mod like a boss

How to mod like a boss 😎

This tutorial I will show you

  • how file load order works
  • how to think and structure lua mods
  • how to modify vanilla behaviour
  • how to use require with passion
  • and more...

@OleksandrKucherenko
OleksandrKucherenko / logger.sh
Created August 17, 2022 08:06
BASH logger that listen to DEBUG environment variable
#!/usr/bin/env bash
# shellcheck disable=SC2155,SC2034,SC2059
# get script directory
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
#
# Register debug logger functions that are controlled by DEBUG= environment variable
# Examples:
# DEBUG=* - print all logs
@mnemnion
mnemnion / git-move.sh
Created August 15, 2022 11:35
Move files from one git repo to another, following renames
#! /bin/bash
# Usage:
# ./git-move.sh path1/ path2/... path/to/destination/repo
args=("$@")
# All but last argument:
paths=("${args[@]::${#args[@]}-1}")
# Last argument:
dest="${args[${#args[@]}-1]}"
@raspi
raspi / setup_namespace_network.sh
Created August 14, 2022 16:57
Setup Linux namespace network with virtual bridge
#!/bin/bash
# (C) Pekka Järvinen 2022
# Name for bridge which virtual namespaces will use to communicate with each other
BRIDGENAME="gamebr0"
# Prefix for network
NETPREFIX="192.168.255."
# Starting IP (NETPREFIX + this)
let STARTIP=10
@wchargin
wchargin / difmap.sh
Last active April 25, 2024 17:57
difmap: diff files under a Unix filter, like difmap -c 'jq .' f1 f2
#!/bin/sh
set -eu
set -x
usage() {
cat <<'EOF'
difmap: diff two files after mapping them through a shell filter
Examples:
@x42en
x42en / progressBar.sh
Created August 4, 2022 12:52
HTOP like color bar - BASH progress bar
#!/bin/bash
ansi() { printf "\e[${1}m${*:2}\e[0m"; }
bold() { ansi 1 "$@"; }
dgreen() { ansi "1;32" "$@"; }
green() { ansi "1;92" "$@"; }
yellow() { ansi "1;93" "$@"; }
orange() { ansi "38;5;214" "$@"; }
red() { ansi "1;91" "$@"; }
lblue() { ansi "1;96" "$@"; }