Skip to content

Instantly share code, notes, and snippets.

nateinaction / additional-nodes configuration.nix
Created August 23, 2021 07:54
Raspberry Pi 4 NixOS Kubernetes cluster config
{ config, pkgs, lib, ... }:
user = "YOUR_USER";
password = "YOUR_PASSWORD";
hostname = "HOSTNAME_FOR_YOUR_PI";
k8sApiServerAddr = "https://IP_FOR_YOUR_CONTROL_NODE:6443";
Shourai / Mount SD Cards within VirtualBox on Mac OS X
Created November 2, 2018 11:00
Mount SD Cards within VirtualBox on Mac OS X
Mount SD Cards within VirtualBox on Mac OS X
Sometimes you need to mount your SD cards inside a VirtualBox machine to work with the files on the card. Working with the Raspberry Pi SD card on Mac OS X is an example for this.
My Raspberry Pi runs on Linux with some version of the EXT file system. While there is some support for this on Mac OS X, the available solutions have a lot of limitations, especially when it comes to write support on EXT file systems. As I do not have an USB keyboard, I sometimes need to mount the filesystem on another system to fix a startup problem when some of my experiments go wrong.
VirtualBox in theory allows for passing the internal card reader of the MacBooks to the virtual machine. Unfortunately, this does not work for me (and it seems for many other people).
Mahedi-61 / cuda_11.8_installation_on_Ubuntu_22.04
Last active June 12, 2024 10:40
Instructions for CUDA v11.8 and cuDNN 8.9.7 installation on Ubuntu 22.04 for PyTorch 2.1.2
### steps ####
# Verify the system has a cuda-capable gpu
# Download and install the nvidia cuda toolkit and cudnn
# Setup environmental variables
# Verify the installation
### to verify your gpu is cuda enable check
0xced /
Created August 30, 2017 14:50
Extract certificate + public key + pin from a TLS server
#!/usr/bin/env bash -e
# For file naming, see
# For HTTP Public Key Pinning (HPKP), see
lattner /
Last active April 21, 2024 09:43 — forked from oleganza/
Concrete proposal for async semantics in Swift

Async/Await for Swift


Modern Cocoa development involves a lot of asynchronous programming using closures and completion handlers, but these APIs are hard to use. This gets particularly problematic when many asynchronous operations are used, error handling is required, or control flow between asynchronous calls gets complicated. This proposal describes a language extension to make this a lot more natural and less error prone.

This paper introduces a first class Coroutine model to Swift. Functions can opt into to being async, allowing the programmer to compose complex logic involving asynchronous operations, leaving the compiler in charge of producing the necessary closures and state machines to implement that logic.

sjoerdvisscher / minimal.swift
Created June 28, 2017 14:42
Using Decodable to generate a minimal value
struct MinimalDecoder : Decoder {
var codingPath = [CodingKey?]()
var userInfo = [CodingUserInfoKey : Any]()
public func container<Key>(keyedBy type: Key.Type) throws -> KeyedDecodingContainer<Key> {
return KeyedDecodingContainer(MinimalKeyedDecodingContainer<Key>(decoder: self))
public func unkeyedContainer() throws -> UnkeyedDecodingContainer {
return DecodingContainer(decoder: self)
Catfish-Man / lockcachecontention.m
Last active July 5, 2017 07:00
Benchmark showing how locks sharing a cache line will contend with each other
#import <Foundation/Foundation.h>
#import <time.h>
#import <os/lock.h>
#define ITERS 2000
#define NSEC_PER_ITER(time) (((double)time * (double)NSEC_PER_SEC) / (double)ITERS)
#define TEST(body, name) do {\
start = [NSDate date];\
for (int i = 0; i < ITERS; i++) {\
alfredkrohmer /
Created November 23, 2016 21:52
XBox One Wireless Controller Protocol

Physical layer

The dongle itself is sending out data using 802.11a (5 GHz WiFi) with OFDM and 6 Mbit/s data rate:

Radiotap Header v0, Length 38
    Header revision: 0
    Header pad: 0
    Header length: 38
    Present flags
Nihisil / jail.local
Last active September 5, 2023 06:20
Send notifications to the Slack from fail2ban
action_with_slack_notification = %(banaction)s[name=%(__name__)s, port="%(port)$
action = %(action_with_slack_notification)s
apolloclark / Twitter API with Curl
Last active November 10, 2023 11:36
Twitter API with Curl
# create an account, create an app
# @see
# retrieve the access tokens
# @see
# create the file ~/twitter_api
nano ~/twitter_api
Authorization: OAuth oauth_consumer_key="XXXXXX", oauth_nonce="11111111", oauth_signature="XXXXXX", oauth_signature_method="HMAC-SHA1", oauth_timestamp="1450728725", oauth_token="99999-XXXXXX", oauth_version="1.0"