Skip to content

Instantly share code, notes, and snippets.

View mpapierski's full-sized avatar

Michał Papierski mpapierski

View GitHub Profile
@patrikalienus
patrikalienus / orca-find-bambu.py
Last active March 3, 2025 05:49
Make Orca Slicer discover your printer
# My computer is on ethernet and the Bambu printer is on WLAN. These two networks can communicate with
# eachother, but OrcaSlicer is still not able to discover the printer. This will "trick" Orca into
# discovering the printer and connect to its IP. I've tested this extensively and working as expected.
# I have full control over the printer that is in LAN only mode. I have to have it in LAN only mode
# because I don't want to install their coming update which will decrease the usability of the printer
# if you're using Orca - and so many are.
#
# Change the parameters to fit your environment and run it after launching Orca.
import socket
@yorickdowne
yorickdowne / HallOfBlame.md
Last active May 4, 2025 10:18
Great and less great SSDs for Ethereum nodes

Overview

Syncing an Ethereum node is largely reliant on latency and IOPS, I/O Per Second, of the storage. Budget SSDs will struggle to an extent, and some won't be able to sync at all. IOPS can roughly be used as proxy of / predictor for latency. Measuring latency directly is arguably better.

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 is a very conservative choice. The smaller 2TB drive should last an Ethereum full node until at least sometime 2026, with the [pre-merge history expiry](https://hackmd.io/@hBXHLw_9Qq2va4pRt

@jheddings
jheddings / ex-notes.py
Last active September 19, 2024 17:03
Import Apple Notes into Notion.
#!/usr/bin/env python3
# !! NOTE - this script is no longer maintained... please see the repo for further
# updates: https://github.com/jheddings/notes2notion
# this script attempts to migrate from Apple Notes to Notion while retaining as
# much information and formatting as possible. there are limitations to the
# export data from Notes, so we try to preserve the intent of the original note.
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
@htfy96
htfy96 / README.md
Last active July 25, 2022 17:43
Restrict C++ unsafe behaviors in unsafe{} block using clang-query and simple commands

C++ has a lot of dark corners. Unfortunately, sometimes we need to allow inexperienced developers to write some C++ code to meet the deadline. The intersection of the two cases often makes things worse: programmers used to delegate memory management to garbage collection tend to throw off new everywhere in the source, and those stuck with compile error will use every evil hack to get around with it. Code review is a feasible way to ensure code quality in this case, but a better choice is to restrict them into a relatively safe subset of the language.

In this article, I will show how to use clang-query and a simple script to restrict some unsafe behaviors in unsafe block/namespace using simple commands:

#include "common.hpp"

struct X {
    int f: 2; // error: use of bit field without enclosing Unsafe
};
@timvisee
timvisee / falsehoods-programming-time-list.md
Last active May 7, 2025 16:00
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).
anonymous
anonymous / swap_func.cpp
Created February 17, 2017 17:59
Idea.
#include <sys/types.h>
#include <sys/mman.h>
#include <assert.h>
#include <err.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <signal.h>
#include <unistd.h>
/*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
@whistlegraph
whistlegraph / mobile_audio.c
Last active July 26, 2016 14:06
Emscripten SDL2 Mobile Audio
#include <SDL.h>
#include <emscripten/emscripten.h>
int eventFilter(void* userdata, SDL_Event* event){
int audio_started;
(void)(userdata);
switch(event->type){
case SDL_FINGERDOWN:
case SDL_MOUSEBUTTONDOWN:
case SDL_KEYDOWN:
@ric03uec
ric03uec / Vagrantfile
Last active June 26, 2018 09:36
kube cluster setup on 2 nodes
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
# Create a private network, which allows host-only access to the machine
# using a specific IP.
config.vm.define "kube-master" do |master|
@wbsch
wbsch / on-modify.blocks_attr.py
Last active March 20, 2025 03:31
Taskwarrior hook script that adds a "blocks:" pseudo-attribute for adding/modifying tasks.
#!/usr/bin/env python
#
# Adds the ability to add / modify tasks using a "blocks:" attribute,
# the opposite of "depends:".
#
# This script acts as an on-modify, on-add and on-launch hook at the same time.
#
### SETUP
# Save this file as
# ~/.task/hooks/on-modify.blocks_attr.py