Skip to content

Instantly share code, notes, and snippets.

View kcking's full-sized avatar
🦄

Kevin King kcking

🦄
View GitHub Profile
@kcking
kcking / linkedlist.rs
Last active January 9, 2022 06:13
Safe Doubly-Linked List with O(1) remove
#![allow(dead_code)]
use std::cell::RefCell;
use std::rc::{Rc, Weak};
/// LinkedList with O(1) element removal using a handle returned from `push`.
/// Motivation: Learning to build O(1) removal LinkedList in safe rust using
/// interior mutability. Useful in building asymptotically optimal LRU cache.
/// Unfortunately std::collections::LinkedList doesn't allow O(1) removal.
/// Of course this implementation would have to be weighed against more

Keybase proof

I hereby claim:

  • I am kcking on github.
  • I am kkingmux (https://keybase.io/kkingmux) on keybase.
  • I have a public key ASCKX12tpzE45niser6dJUrSeGyD_HQRLJOzkxK0MTPx3wo

To claim this, I am signing this object:

@kcking
kcking / git_config_launchctl.sh
Created July 19, 2017 20:20
Test git config launched from launchctl
#!/bin/sh
rm /tmp/launchctl_gitconfig.log 2> /dev/null
cat > ~/Library/LaunchAgents/gitconfig_test.plist <<EOF
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"\>
<plist version="1.0">
<dict>
<key>Label</key>
<string>git_config_test</string>
<key>ProgramArguments</key>
#!/bin/sh
rm /tmp/launchctl_env.log 2> /dev/null
cat > ~/Library/LaunchAgents/dump_env.plist <<EOF
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"\>
<plist version="1.0">
<dict>
<key>Label</key>
<string>dump_env</string>
<key>ProgramArguments</key>

Keybase proof

I hereby claim:

  • I am kcking on github.
  • I am kevinking (https://keybase.io/kevinking) on keybase.
  • I have a public key whose fingerprint is F7A8 3D5C E65C 4281 7A4A B764 7A10 37F5 EF07 891E

To claim this, I am signing this object: