I’ve had issues before with docker and wireguard. Solution is to add this iptables entry. iptables -I DOCKER-USER -o wg0 -j ACCEPT
Since Docker unfortunately designed their containers in a way that has added friction to running as a non-root user, I thought it’d be nice to repost this boilerplate I found that should be used in every docker container (mostly for my own convenience). FROM <my-fancy-image> RUN useradd -u 10001 scratchuser FROM scratch COPY --from=0 /etc/passwd /etc/passwd USER scratchuser ENTRYPOINT ["/dosomething"] source: https://medium.com/@lizrice/non-privileged-containers-based-on-the-scratch-image-a80105d6d341 There’s also this tool for finding other containers running as root: - https://github.
Say I’m using nixos to configure nginx and I want to verify the result with my own eyes. Where do I go? Nginx isn’t in /etc/nginx. It’s locked away somewhere in /nix/store/. You can always still verify, even before you apply the changes by running the following: nixos-rebuild build # generate the local `result` directory nix-store -qR result | grep nginx # search the `result` directory for all nginx related files
Recently I’ve noticed that my zsh sessions have become horrendously slow. Here’s how I debugged it. Measuring Overall Startup Time time zsh -i -c exit Finding the Problematic Plugin Add the line zmodload zsh/zprof to the top of your ~/.zshrc and at the bottom append the line zprof. This will run and display the costs of running each startup command making it very easy to determine what’s eating your time.
Lossless Compression of Small Strings I recently became interested in the problem of how to compress small strings (< 100 chars) after a short conversation with a coworker and reading antirez’s Smaz library. Lossy Compression: As the name implies, lossy compression involves compressing data in a way that the original message can never be perfectly recovered: information is lost. This is less of a problem for media data such as audio, images, and video since it’s not the individual bits that matter, but the larger pattern.
Communication between concurrent components can be divided in two categories: Shared Memory Communication Components communicate by altering the contents of shared memory location. Requires a locking mechanism: mutexes, semaphores, or monitors. Advantages: Cheaper to task switch. Lower memory overhead. Disadvantages: Can be prone to deadlocks If A locks R1 until it gets R2, but B locks R2 until it gets R1. Prone to race conditions If depending on shared state.
So at work recently, I’ve been looking into doing some much needed optimizations of our testing libraries. I wasn’t too familiar with the basics of how Python’s threading and multiprocessing machinery works (and I only had a vague idea of this global interpreter lock thing) so with nothing better to do on a Saturday night, I thought I’d spend a few hours digging in a little. Some Prerequisite Concurrency Concepts Before discussing Python’s concurrency model, we need to first cover a few general concurrency concepts.
Thus far, I’ve found that every text editor I’ve encountered falls into one of the following three use case oriented categories. Light-Weight Editors Categorical Features: Launches instantly. Can ideally be used in a terminal over ssh. Ubiquitous. Examples: vi/vim nano ed notepad.exe Medium-Weight Editors Categorical Features: Good package/plugin management. Vast package/plugin ecosystem. Some IDE features like linting and highlighting, but not so much that performance suffers.
There’s “cyberspace” and “cybersecurity”, but what do they really mean? The following are my notes after some spontaneous late night research. Intro Definition - Cybernetics is the study of using feedback to achieve goals. Etymology - Comes from the word “kybernetiki” meaning “art of steering”. Formalized by Ross Ashby who wrote “Introduction to Cybernetics” Cybernetics deals with all forms of behavior in so far as they are regular, or determinate, or reproducible.
Courtesy of Holger Krekel’s lecture Recently, I had the privilege to attend a multi-day lecture with the author of pytest. While I’ve read the docs several times over now, I still picked up on a few new features and tricks. Here are some cool tips whose existence I’d like to stress. Pytest Tricks & Tips You can wrap pytest markers: def skip_non_mac(func): pytest.mark.skipif(sys.platform != 'darwin', return="Skipping because test only applies to OSX.