View emacs.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
BG_RED=`tput setaf 1` | |
BG_GREEN=`tput setaf 2` | |
BOLD=`tput bold` | |
RESET=`tput sgr0` | |
EMACS='/Applications/Emacs.app' | |
EMACS_CLIENT='/Applications/Emacs.app/Contents/MacOS/bin/emacsclient' | |
DEFAULT_EVAL='(switch-to-buffer "*scratch*")' |
View qsort.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use std::cmp::Ordering; | |
fn qsort3way<T: Ord + Copy>(sli: &mut [T], lo: usize, hi: usize) { | |
if hi <= lo {return;} | |
let mut lt = lo; | |
let mut i = lt + 1; | |
let mut gt = hi; | |
let v = sli[lo]; | |
while i <= gt { | |
match sli[i].cmp(&v) { |
View vec.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#![feature(ptr_internals, alloc)] | |
use std::ops::{Deref, DerefMut}; | |
use std::ptr::{self, Unique}; | |
use std::{alloc, marker::PhantomData, mem}; | |
struct RawVec<T> { | |
ptr: Unique<T>, | |
cap: usize, | |
} |