Skip to content

Instantly share code, notes, and snippets.

View mikroskeem's full-sized avatar
👻

Mark Vainomaa mikroskeem

👻
View GitHub Profile
//! A zig builder step that runs "libtool" against a list of libraries
//! in order to create a single combined static library.
const LibtoolStep = @This();
const std = @import("std");
const Step = std.build.Step;
const RunStep = std.build.RunStep;
const FileSource = std.build.FileSource;
pub const Options = struct {
@PedroHLC
PedroHLC / podman-dnsname.nix
Created March 22, 2023 14:58
Returns dnsname-cni to nixpkgs' podman
{ pkgs, ... }:
{
environment.etc."cni/net.d/87-podman-bridge.conflist".source =
let
cfgExtraPlugins = [{
type = "dnsname";
domainName = "dns.podman";
capabilities.aliases = true;
}];
cfgPackage = pkgs.podman;

The ffast and the Furious

This is a small and admittedly contrived demo showing how some weird but safe code could become vulnerable if run in an environment where some shared library has changed the FPU's FTZ/DAZ bits to force denormals to zero.

To run it:

# Create an empty file
$ touch gofast.c      
@pudquick
pudquick / brew.md
Last active June 24, 2024 19:41
Lightly "sandboxed" homebrew on macOS

brew is a bad neighbor

This isn't a guide about locking down homebrew so that it can't touch the rest of your system security-wise.

This guide doesn't fix the inherent security issues of a package management system that will literally yell at you if you try to do something about "huh, maybe it's not great my executables are writeable by my account without requiring authorization first".

But it absolutely is a guide about shoving it into its own little corner so that you can take it or leave it as you see fit, instead of just letting the project do what it likes like completely taking over permissions and ownership of a directory that might be in use by other software on your Mac and stomping all over their contents.

By following this guide you will:

  • Never have to run sudo to forcefully change permissions of some directory to be owned by your account
@yorickdowne
yorickdowne / HallOfBlame.md
Last active July 11, 2024 19:23
Great and less great SSDs for Ethereum nodes

Overview

Syncing an Ethereum node is largely reliant on IOPS, I/O Per Second. Budget SSDs will struggle to an extent, and some won't be able to sync at all.

This document aims to snapshot some known good and known bad models.

The drive lists are ordered by interface and then by capacity and alphabetically by vendor name, not by preference. The lists are not exhaustive at all. @mwpastore linked a filterable spreadsheet in comments that has a far greater variety of drives and their characteristics. Filter it by DRAM yes, NAND Type TLC, Form Factor M.2, and desired capacity.

For size, 4TB comes recommended as of mid 2024. The smaller 2TB drive should last an Ethereum full node until early 2025 or thereabouts, with crystal ball uncertainty. Remy wrote a migration guide to 4TB.

@rougier
rougier / Toolbar.el
Created November 30, 2020 12:05
Emacs SVG Toolbar
;; An experiment for an SVG toolbar using icons from material.io
;;
;; Example usage: (toolbar 48 "black" "white" t t)
;; Material icons freely available (Apache 2 license) from
;; - https://material.io/resources/icons/?style=outline
;; - https://github.com/google/material-design-icons
(require 'xml) (require 'svg)
(defun toobar-item (label icon fg-color bg-color size with-icon with-label)
@Cybermaxke
Cybermaxke / VelocityEventCoroutines.kt
Last active October 27, 2022 18:27
Velocity Event Coroutines - Use kotlin coroutines inside your velocity event handlers.
import com.velocitypowered.api.event.EventTask
import kotlin.coroutines.Continuation
import kotlin.coroutines.CoroutineContext
import kotlin.coroutines.EmptyCoroutineContext
import kotlin.coroutines.startCoroutine
fun suspended(fn: suspend () -> Unit): EventTask {
return EventTask.withContinuation { continuation ->
val completion = object : Continuation<Unit> {
override val context: CoroutineContext
@pesterhazy
pesterhazy / indexeddb-problems.md
Last active May 27, 2024 07:40
The pain and anguish of using IndexedDB: problems, bugs and oddities

This gist lists challenges you run into when building offline-first applications based on IndexedDB, including open-source libraries like Firebase, pouchdb and AWS amplify (more).

Note that some of the following issues affect only Safari. Out of the major browsers, Chrome's IndexedDB implementation is the best.

Backing file on disk (WAL file) keeps growing (Safari)

When this bug occurs, every time you use the indexeddb, the WAL file grows. Garbage collection doesn't seem to be working, so after a while, you end up with gigabytes of data.

Random exceptions when working with a large number of indexeddb databases (Safari)

@Profpatsch
Profpatsch / !nix-build-if-changed.py
Last active July 13, 2023 18:35
build a nix expression, but only if it isn’t already available in substituters; skip downloading the results if that is the case.
#!/usr/bin/env python3
# Small wrapper around nix-instantiate and `nix-store --realize`
# that checks whether the output path is already in a cache
# and if it isn’t, builds it.
#
# The arguments you pass will be given to nix-instantiate,
# not to nix-store --realize
# (This might be a TODO for the future).
@stonar96
stonar96 / Anti-Xray.md
Last active June 6, 2024 12:01
Recommended Paper Anti-Xray settings by stonar96

❗ This has been moved to the official PaperMC docs ❗

Link: https://docs.papermc.io/paper/anti-xray

Help: https://discord.gg/papermc






Recommended Paper Anti-Xray settings by stonar96

General

Anti-Xray can be configured per world in the paper.yml configuration file. To understand how per world configuration works please read this first. Note that after changing any settings for Anti-Xray you have to restart your server. Executing the /reload command (you should never do this) won't apply the settings to worlds that are already loaded.