Skip to content

Instantly share code, notes, and snippets.

@jamieweavis
jamieweavis / macos-app-icon.md
Last active April 28, 2024 02:04
How to create an .icns macOS app icon
/*
robin verton, dec 2015
implementation of the RC4 algo
*/
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define N 256 // 2^8
extension UIHostingController {
convenience public init(rootView: Content, ignoreSafeArea: Bool) {
self.init(rootView: rootView)
if ignoreSafeArea {
disableSafeArea()
}
}
func disableSafeArea() {
@mschwaig
mschwaig / sway.nix
Last active April 28, 2024 01:51
Configure sway as the window manager for NixOS with gdm as the display manager
{ config, pkgs, lib, ... }:
{
# This sway config is mostly based on https://nixos.wiki/wiki/Sway
# which integrates sway with systemd in the style described here
# https://github.com/swaywm/sway/wiki/Systemd-integration
# and the replies in https://github.com/NixOS/nixpkgs/issues/57602
# with some individual packages added/removed and using sddm as the display manager.
#
# Take care to start the correct target as described by the sway proejct wiki.
@aarav2you
aarav2you / RemoveClutter.theme.css
Last active April 28, 2024 01:57
Modifications for the Discord client to remove the clutter
/*==========
RemoveClutter.theme.css by aarav2you
How to inject: Paste in "Custom CSS" tab in BetterDiscord or download and use as theme
========== */
/* Stickers same size as emojis */
.assetWrapper-3GNt0z {
max-width: 48px;
max-height: 48px;
@steve981cr
steve981cr / How-to-Release-an-Electron-App-on-the-Mac-App-Store.md
Last active April 28, 2024 01:49
Step by step instructions on how to release an Electron app on the Mac App Store. Uses Electron-builder to package the app.
@x-yuri
x-yuri / docker-compose-anonymous.yml
Last active April 28, 2024 01:46
docker: migrate volume data #pg #docker
version: '3'
services:
s1:
image: postgres:12
container_name: ${prefix}_compose_anonymous
ports:
- $pg_port:5432
@nicowilliams
nicowilliams / bisect-rebase.sh
Last active April 28, 2024 01:46
Bisection, but for git rebase, to quickly rebase across thousands of upstream commits
# Viktor Dukhovni's (@vdukhovni) slow rebase, made faster by bisecting, sort of
#
# fastrebase BRANCH_TO_REBASE ONTO
function fastrebase {
typeset b N
if (($# > 0)) && [[ $1 = -h || $1 = --help ]]; then
printf 'Usage: fastrebase BRANCH_TO_REBASE ONTO_HEAD\n'
printf ' fastrebase # to continue after resolving conflicts\n'
printf '\n\tfastrebase is a shell function that uses the following\n'
@jboner
jboner / latency.txt
Last active April 28, 2024 01:46
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers (~2012)
----------------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD