Skip to content

Instantly share code, notes, and snippets.

@ivanfioravanti
ivanfioravanti / mlx_memory.sh
Created January 4, 2025 16:42
Script to set MLX memory limits
#!/usr/bin/env bash
# Default values for percentages
DEFAULT_WIRED_LIMIT_PERCENT=85
DEFAULT_WIRED_LWM_PERCENT=75
# Read input parameters or use default values
WIRED_LIMIT_PERCENT=${1:-$DEFAULT_WIRED_LIMIT_PERCENT}
WIRED_LWM_PERCENT=${2:-$DEFAULT_WIRED_LWM_PERCENT}
@ptoffy
ptoffy / XCTAssert(Not)Nil
Last active January 4, 2025 23:06
Swift Testing Migration Utilities
replace: XCTAssertNil\((.*)\)
with: #expect($1 == nil)
replace: XCTAssertNotNil\((.*)\)
with: #expect($1 != nil)
@ArmanTaheriGhaleTaki
ArmanTaheriGhaleTaki / automatic_FFMPEG_script
Created July 29, 2022 04:03
this is a bash script that compress MP4 formatted videos in a folder automatically and name the output as [Videoname] _compressed.mp4
#!/bin/bash
VIDEOS=$(ls *.mp4)
for VIDEO in $VIDEOS
do
ffmpeg -i $VIDEO -vcodec libx265 -crf 28 -f mp4 ${VIDEO%%.*}_compressed.mp4
done
@valeryan
valeryan / .dockerignore
Last active January 4, 2025 23:06
Using docker-compose to run a mineos server
minecraft
@MeNiks
MeNiks / JsonExtensions.kt
Last active January 4, 2025 23:03
Add/Update properties of kotlinx.serialization.json.JsonObject
import kotlinx.serialization.json.JsonObject
import kotlinx.serialization.json.jsonObject
fun JsonObject.addUpdateJsoObject(updateJsonObject: JsonObject): JsonObject {
return JsonObject(
toMutableMap()
.apply {
updateJsonObject.forEach { (key, je) ->
put(key, je)
}
@victor-torres
victor-torres / uninstall_shell_integration.sh
Created March 1, 2016 12:51
Uninstalling shell integration from iTerm 2
#!/bin/bash
function die() {
echo "${1}"
exit 1
}
which printf > /dev/null 2>&1 || die "Shell integration requires the printf binary to be in your path."
which sed > /dev/null 2>&1 || die "Shell integration requires the sed binary to be in your path."
@timvisee
timvisee / falsehoods-programming-time-list.md
Last active January 4, 2025 23:02
Falsehoods programmers believe about time, in a single list

Falsehoods programmers believe about time

This is a compiled list of falsehoods programmers tend to believe about working with time.

Don't re-invent a date time library yourself. If you think you understand everything about time, you're probably doing it wrong.

Falsehoods

  • There are always 24 hours in a day.
  • February is always 28 days long.
  • Any 24-hour period will always begin and end in the same day (or week, or month).
@scyto
scyto / proxmox.md
Last active January 4, 2025 23:00
my proxmox cluster

ProxMox Cluster - Soup-to-Nutz

aka what i did to get from nothing to done.

note: these are designed to be primarily a re-install guide for myself (writing things down helps me memorize the knowledge), as such don't take any of this on blind faith - some areas are well tested and the docs are very robust, some items, less so). YMMV

Purpose of Proxmox cluster project

Required Outomces of cluster project

@alexaandru
alexaandru / chi.go
Created February 14, 2024 16:40
Chi-like syntactic sugar layer on top of stdlib http.ServeMux
// Chi-like syntactic sugar layer on top of stdlib http.ServeMux.
package main
import (
"net/http"
"slices"
)
type (
middleware func(http.Handler) http.Handler
@packerdl
packerdl / lxc_plex_intel_quicksync.md
Last active January 4, 2025 22:57
Intel QuickSync passthrough to an unprivileged LXC container running plex.

Running Plex in an Unprivileged LXC with Intel QuickSync Passthrough

First setup an unprivileged Ubuntu container with Plex Media Server installed. Inside the container take note of the id of the plex group.

# Your Plex group's ID may be different
$ getent group plex | cut -d : -f3
998