Skip to content

Instantly share code, notes, and snippets.

@kconner
kconner / macOS Internals.md
Last active May 10, 2024 17:04
macOS Internals

macOS Internals

Understand your Mac and iPhone more deeply by tracing the evolution of Mac OS X from prelease to Swift. John Siracusa delivers the details.

Starting Points

How to use this gist

You've got two main options:

@holyjak
holyjak / http-server.bb
Last active March 19, 2023 04:36
Babashka HTTP server for serving static files, similar to `python -m http.server` but more flexible :)
#!/usr/bin/env bb
#_" -*- mode: clojure; -*-"
;; Based on https://github.com/babashka/babashka/blob/master/examples/image_viewer.clj
(ns http-server
(:require [babashka.fs :as fs]
[clojure.java.browse :as browse]
[clojure.string :as str]
[clojure.tools.cli :refer [parse-opts]]
[org.httpkit.server :as server]
@trisberg
trisberg / local-registry.md
Last active May 9, 2024 13:17
Using a Local Registry with Minikube

Using a Local Registry with Minikube

Install a local Registry

These instructions include running a local registry accessible from Kubernetes as well as from the host development machine at registry.dev.svc.cluster.local:5000.

  1. Use the docker CLI to run the registry:2 container from Docker, listening on port 5000, and persisting images in the ~/.registry/storage directory.
@upperwal
upperwal / a_tree_based_bcast.go
Last active May 2, 2023 08:50
Binary tree based Broadcast
package main
/* Binary tree based Broadcast
* This program demonstrates a tree based broadcast to all the peers in a network.
* Program starts by arranging a set of peers in a tree structure were a node is
* connected to exactly two nodes, it's children. This gives an almost complete binary tree.
*
* One-way flow of information:
* Data can only flow from top to bottom in the graph. So, if the root node initiates
* a broadcast. It will send the message to it's children who will then send it to their
(defun read-journal (path)
(with-temp-buffer
(insert-file-contents (concat "~/notes/journal/" path))
(split-string (buffer-string) "\n" t)))
(defun read-first-three-lines (list)
(cond ((>= (length list) 4) (subseq list 1 3))
((>= (length list) 1) (nthcdr 1 list))
(t list)))
@BusFactor1Inc
BusFactor1Inc / scheme-coin.lisp
Created December 16, 2017 07:28
A Common Lisp Blockchain - Scheme Coin
;;
;; scheme coin - a common lisp blockchain
;;
;; Burton Samograd
;; 2017
(load "~/quicklisp/setup.lisp")
(defconstant *coin-name* "Scheme Coin")
@vivekkr12
vivekkr12 / BouncyCastleCertificateGenerator.java
Last active April 17, 2024 10:03
Generate root X509Certificate, Sign a Certificate from the root certificate by generating a CSR (Certificate Signing Request) and save the certificates to a keystore using BouncyCastle 1.5x
import org.bouncycastle.asn1.ASN1Encodable;
import org.bouncycastle.asn1.DERSequence;
import org.bouncycastle.asn1.x500.X500Name;
import org.bouncycastle.asn1.x509.BasicConstraints;
import org.bouncycastle.asn1.x509.Extension;
import org.bouncycastle.asn1.x509.GeneralName;
import org.bouncycastle.asn1.x509.KeyUsage;
import org.bouncycastle.cert.X509CertificateHolder;
import org.bouncycastle.cert.X509v3CertificateBuilder;
import org.bouncycastle.cert.jcajce.JcaX509CertificateConverter;
@ptaylor
ptaylor / TlsHttpBuilder.groovy
Created April 6, 2017 15:52
Groovy HTTPBuilder supporting TLS 1.2
import groovyx.net.http.HTTPBuilder
import org.apache.http.client.HttpClient
import org.apache.http.impl.client.DefaultHttpClient
import org.apache.http.impl.conn.PoolingClientConnectionManager
import org.apache.http.impl.conn.SchemeRegistryFactory
import org.apache.http.params.HttpParams
import javax.net.ssl.SSLContext
import javax.net.ssl.SSLSocket
import java.security.SecureRandom
@eevee
eevee / perlin.py
Last active March 2, 2024 08:48
Perlin noise in Python
"""Perlin noise implementation."""
# Licensed under ISC
from itertools import product
import math
import random
def smoothstep(t):
"""Smooth curve with a zero derivative at 0 and 1, making it useful for
interpolating.
@0XDE57
0XDE57 / config.md
Last active April 18, 2024 04:36
Firefox about:config privacy settings

ABOUT

about:config settings to harden the Firefox browser. Privacy and performance enhancements.
To change these settings type 'about:config' in the url bar. Then search the setting you would like to change and modify the value. Some settings may break certain websites from functioning and rendering normally. Some settings may also make firefox unstable. I am not liable for any damages/loss of data.

Not all these changes are necessary and will be dependent upon your usage and hardware. Do some research on settings if you don't understand what they do. These settings are best combined with your standard privacy extensions (HTTPS Everywhere No longer required: Enable HTTPS-Only Mode, NoScript/Request Policy, uBlock origin, agent spoofing, Privacy Badger etc), and all plugins set to "Ask To Activate".