Skip to content

Instantly share code, notes, and snippets.

# script to duplicate and edit the smartcard logon certificate template for easy testing
$certca = @"
using System;
using System.Runtime.InteropServices;
public class CertCA
{
public const uint CA_FLAG_ENUM_ALL_TYPES = 0x00000004;
public const uint CT_FIND_LOCAL_SYSTEM = 0x00000002;
@guywaldman
guywaldman / pre-commit
Last active August 9, 2022 20:37
git pre-commit hooks to forbid DNC messages, as seen on https://guywaldman.com/blog/git-hooks
#!/usr/bin/env bash
# Forbidden phrases.
FORBIDDEN_PHRASES=("DNC" "DO NOT COMMIT" "TODO(PR)")
# ANSI color codes.
CLEAR="\033[0m"
RED="\033[00;31m"
BLUE="\033[00;34m"
@davidteren
davidteren / nerd_fonts.md
Last active April 27, 2025 13:47
Install Nerd Fonts via Homebrew [updated & fixed]
# (c) 2020 Humu
# MIT License
from typing import Any
import github
AUTOMERGE_LABEL_NAME = 'automerge'
@laggardkernel
laggardkernel / trigger-chpwd-hook-on-startup.md
Last active September 17, 2024 15:29
Trigger chpwd Hook on Startup #zsh #hook #direnv

By default, ZSH hook chpwd is not triggered on shell startup. The tutorial here provides some ideas to fix this.

Trigger all chpwd_functions on startup

We can use a trick to define a function run only once on precmd and destruct itself automatically.

function _self_destruct_hook {
  local f
  for f in ${chpwd_functions}; do
    "$f"
@ganapativs
ganapativs / iTerm2 + oh-my-zsh + Pure theme + zsh plugins setup.md
Last active April 13, 2025 06:31
iTerm2 + oh-my-zsh + Pure theme + zsh plugins setup
@RobertFischer
RobertFischer / Description.md
Last active October 14, 2023 16:47
Benchmarking is Hard, Yo.

So, I was reading Why You shouldn’t use lodash anymore and use pure JavaScript instead, because once upon a time, I shifted from Underscore to Lodash, and I'm always on the lookout for the bestest JavaScript stdlib. At the same time, there was recently an interesting conversation on Twitter about how some of React's functionality can be easily implemented in modern vanilla JS. The code that came out of that was elegant and impressive, and so I have taken that as a message to ask if we really need the framework.

Unfortunately, it didn't start out well. After copy-pasting the ~100 lines of code that Lodash executes to perform a find, there was then this shocking claim: Lodash takes 140ms, and native find takes 0ms.

@acdlite
acdlite / coordinating-async-react.md
Last active June 17, 2024 11:56
Demo: Coordinating async React with non-React views

Demo: Coordinating async React with non-React views

tl;dr I built a demo illustrating what it might look like to add async rendering to Facebook's commenting interface, while ensuring it appears on the screen simultaneous to the server-rendered story.

A key benefit of async rendering is that large updates don't block the main thread; instead, the work is spread out and performed during idle periods using cooperative scheduling.

But once you make something async, you introduce the possibility that things may appear on the screen at separate times. Especially when you're dealing with multiple UI frameworks, as is often the case at Facebook.

How do we solve this with React?

@PeterRincker
PeterRincker / prismo.vim
Last active September 10, 2017 07:37
vim-prismo with a twist
"Prismo.vim
" version of vim-prismo I took a crack at reimplimenting
" https://github.com/guywald1/vim-prismo
"
" Options:
" 'commentstring' - See :h 'commentstring'. Can use b:commentstring to override
" g:prismo_dash - padding character defaults to dash
" g:prismo_toupper - transform the title to uppercase (default to 1)
" b:prismo_width - width of header default to 'textwidth' or 80 if 'textwidth' is 0
"
@blaix
blaix / whatversionoftmuxamirunning.txt
Created August 18, 2017 17:44
I just wanted to know what version of tmux I'm running...
$ tmux --version
tmux: illegal option -- -
usage: tmux [-2CluvV] [-c shell-command] [-f file] [-L socket-name]
[-S socket-path] [command [flags]]
$ tmux --help
tmux: illegal option -- -
usage: tmux [-2CluvV] [-c shell-command] [-f file] [-L socket-name]
[-S socket-path] [command [flags]]