Skip to content

Instantly share code, notes, and snippets.

View SIMULATAN's full-sized avatar
🐳
dockerized my brain (forgot to expose the ports tho..)

Jakob Hofer SIMULATAN

🐳
dockerized my brain (forgot to expose the ports tho..)
View GitHub Profile
@SIMULATAN
SIMULATAN / Dockerfile
Created October 1, 2024 12:35
Leocloud Docker (Safe)
FROM debian:testing-slim
RUN apt update && apt install -y firefox-esr curl
ARG user=hackmenot
ARG group=hackmenot
ARG uid=1001
ARG gid=1001
RUN groupadd -g ${gid} ${group}
RUN useradd -u ${uid} -g ${group} -s /bin/sh -m ${user}
@SIMULATAN
SIMULATAN / catalog_to_toml.gradle.kts
Last active August 13, 2024 21:37
Print DSL-based Gradle Version Catalog as TOML - useful to migrate from kotlin-defined dependencies to a TOML-based version catalog.
val versionLines = mutableListOf<String>()
val libs = mutableMapOf<String, List<String>>()
val plugs = mutableMapOf<String, List<String>>()
versionCatalogs.forEach { catalog ->
// map of version - alias | needed to guess the aliases used
val versions = catalog.versionAliases.associate { alias ->
val version = catalog.findVersion(alias)
version.get().displayName to alias.replace(".", "-")
}
versionLines += versions.map { (value, key) -> "$key = \"$value\"" }.joinToString("\n").trim('\n')
@SIMULATAN
SIMULATAN / fuck-you-quarkus.md
Last active March 31, 2024 20:16
quarkus sucks, here's why

Introduction

Yes, I know, a lot of these problems may not be caused by quarkus but rather other tools in the stack. However, I still cound them here since quarkus makes it extra hard to fix them.

Problems

reactive everything

Reactive as a concept sounds quite appealing. Yay, performance, am i right? In practice however, this rarely is worth the hassle. Just look at this abomination of a function.

monitor=eDP-1,auto,auto,1
# XDG
env = XDG_SESSION_TYPE,wayland
env = XDG_CURRENT_DESKTOP,Hyprland
env = XDG_SESSION_DESKTOP,Hyprland
# Toolkit Backend
env = SDL_VIDEODRIVER,wayland
env = GDK_BACKEND,wayland,x11
@SIMULATAN
SIMULATAN / cached_store.ts
Created August 6, 2023 19:15
svelte store that has caching or something
import type { Options as BaseOptions } from './persisted_store'
import type {Unsubscriber, Updater, Writable} from "svelte/store";
import {persisted} from "./persisted_store";
export interface Options<T> extends BaseOptions<CachedState<T>>{
/** The time in milliseconds to cache the value for */
cacheTime: number,
/** The value getter function */
getter: () => Promise<T>
}
@SIMULATAN
SIMULATAN / docker-compose.yml
Created March 15, 2023 15:05
Node-Exporter in Docker
services:
node-exporter:
image: prom/node-exporter:latest
command:
- '--path.rootfs=/host'
pid: host
volumes:
- '/:/host:ro,rslave'
@SIMULATAN
SIMULATAN / show-restart-policies.sh
Created February 28, 2023 09:43
Show a list of docker container names and their respective restart policies
docker ps -a --format json | jq -r '.ID' | xargs -I {} 'docker' inspect {} | jq -r '.[] | "\(.Name[1:]): \(.HostConfig.RestartPolicy.Name)"'
@SIMULATAN
SIMULATAN / Dockerfile
Created January 26, 2023 11:16
Dockerized Firefox (shared X-Server)
FROM debian:bullseye-slim
COPY docker-entrypoint.sh .
RUN apt-get update && apt-get install -y firefox-esr xauth
ENTRYPOINT /docker-entrypoint.sh
@SIMULATAN
SIMULATAN / get-open-ports.sh
Created October 19, 2022 14:10
Get all ports you can access from inside of a network to the outside. Useful if ports are blocked by your sysadmin and you need to find out what ports you can put your services on to access them.
#!/bin/bash
function scan() {
# stdin will be parsed by the script
# stderr is just for debugging purposes and to see the process while running the script
curl "http://portquiz.net:$1" &>/dev/null && echo "$i" && echo "$i" >&2
}
function scanAll() {
for i in {0..69420}; do
@SIMULATAN
SIMULATAN / bool.rhai
Last active July 6, 2022 07:21
Dotter Blog Post
# add this to your .dotter/global.toml file:
# [helpers]
# bool = ".dotter/helpers/bool.rhai"
#
# use like this:
# bool my_condition
if params[0] == true || params[0] == "true" {
"true"
}