Skip to content

Instantly share code, notes, and snippets.

View StoneLabs's full-sized avatar
:shipit:
Oh hello there

Levy StoneLabs

:shipit:
Oh hello there
View GitHub Profile
@StoneLabs
StoneLabs / non-ascii-line.regex
Last active February 2, 2024 10:13
Fast Non-Ascii-Line regex
^[^\s]*[^\x00-\x7F][^\s]*$\n # Also remove lines with whitespaces
^[^\n\r]*[^\x00-\x7F][^\n\r]*$\n # Lines may include whitespaces
@StoneLabs
StoneLabs / docker-ips.sh
Last active January 11, 2024 17:17
List All Fixed and Current IPs of all containers in macvlan setup
echo ""
docker container ls --all -q |
xargs -n 1 docker inspect --format '{{range .NetworkSettings.Networks}}{{.IPAMConfig.IPv4Address}}{{end}} | {{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}} | {{ .Name }}' |
sort |
sed '1 iCustom IP | Current IP | Container\n||' |
column -t -s "|"
@StoneLabs
StoneLabs / accidents.py
Created September 12, 2023 05:56
Find all accident reports on train accidents in japan
with open("wc.lst", "w") as wordlist:
for year in range(2003, 2024):
for month in range(1,13):
for num in range(1, 20):
wordlist.write(f"RA{year}-{month}-{num}\n")
#gobuster fuzz -w wc.lst -u https://www.mlit.go.jp/jtsb/railway/rep-acci/FUZZ.pdf --excludestatuscodes 404 -o out.lst
@StoneLabs
StoneLabs / backup-script.sh
Created April 13, 2023 06:42
Backup script
#!/bin/zsh
#
# Copies all sources to target host
# =================================
#
# Copies all folders in ./sources to the target.
# These folder entries (seperated by newlines)
# should not end with a slash. If they do, only the
# files inside the folder are backed up, not the
# folder itself. Make sure that there are no
@StoneLabs
StoneLabs / view_all_mounts.sh
Created March 15, 2023 18:23
Docker view all mounts and volumes of all containers
docker ps -a --format '{{ .ID }}' | xargs -I {} docker inspect -f '{{ .Name }}{{ printf "\n" }}{{ range .Mounts }}{{ printf "\n\t" }}{{ .Type }} {{ if eq .Type "bind" }}{{ .Source }}{{ end }}{{ .Name }} => {{ .Destination }}{{ end }}{{ printf "\n" }}' {}
@StoneLabs
StoneLabs / script.ps1
Last active April 13, 2023 20:05
Android storage backup script
echo ""
echo ""
echo "====== FILE PULLER ======"
echo ""
echo ""
$index = 0
if (Test-Path ./status) {
$confirmation = $Host.UI.PromptForChoice("", "It appears the last operation was interrupted. Continue?", @("&Continue", "&Restart", "&Exit"), 0)
if ($confirmation -eq 0) {
@StoneLabs
StoneLabs / 7z update backup
Created December 9, 2021 15:14
backup.sh
7z u old.zip -u- -up0q0x2!new.zip /foler_to_backup/
# https://sevenzip.osdn.jp/chm/cmdline/switches/update.htm
# Flags:
# p0,q0 = dont copy files not existing on disk
# x2 = compress files from disk even if they are newer in the archive
# Inherited by -u:
# r2 = compress files not in archive
@StoneLabs
StoneLabs / renderer.py
Last active September 29, 2021 16:16
Minecraft world renderer using Mineways (snapshot compatible)
import os
import subprocess
import cv2
from jinja2 import Template
from rich.progress import Progress, BarColumn, TimeRemainingColumn, TextColumn, SpinnerColumn
from rich.traceback import install as install_traceback
from rich.console import Console
install_traceback()
print = Console().print
@StoneLabs
StoneLabs / UnitsOverTime.nb
Created September 14, 2021 13:14
Units over time
TextGrid[VALS =
Cases[Apply[
Flatten[{#1, {"StandardYear", "Value",
"StandardUncertainty"} /. #2}] &,
Entity["PhysicalConstant", "GravitationalConstant"][
"ValueAssociation"], {1}], {source_, y_Integer,
rest__} :> {source, DateObject[{y}], rest}],
Sequence[Dividers -> All,
Background -> {Automatic, {{LightBlue, None}}}]]
hvals = Callout[{#2,
@StoneLabs
StoneLabs / SIConstants.nb
Created September 14, 2021 13:13
SI Constants
SIConstants = EntityList[EntityClass["PhysicalConstant", "SIExact"]];
TextGrid[Join[{Thread[
Style[{"constant", "symbol", "new exact value"}, Italic]]},
EntityValue[SIConstants, {"Entity", "Quantity", "Value"}] /.
Quantity[1, Pattern[u, Blank[]]] :> Quantity[None, u]],
Sequence[Dividers -> All,
Background -> {Automatic, {LightYellow, {LightBlue, None}}}]]