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
# Usage: | |
# source iterm2.zsh | |
# iTerm2 tab color commands | |
# https://iterm2.com/documentation-escape-codes.html | |
if [[ -n "$ITERM_SESSION_ID" ]]; then | |
tab-color() { | |
echo -ne "\033]6;1;bg;red;brightness;$1\a" | |
echo -ne "\033]6;1;bg;green;brightness;$2\a" |
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
Latency Comparison Numbers | |
-------------------------- | |
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 |
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
// | |
// Numerical Integration | |
// | |
// NUMS = Number of divisions | |
// NUMT = Number of threads | |
// These parameters should be passed in from an external driver program | |
// Performance = NUMS*NUMS/t | |
// t = Runtime of program in microseconds | |
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
import os | |
voices = ['Agnes', 'Kathy', 'Princess', 'Vicki', 'Victoria', | |
'Alex', 'Bruce', 'Fred', 'Junior', 'Ralph', 'Albert', | |
'Bad News', 'Bahh', 'Bells', 'Boing', 'Bubbles', 'Cellos', 'Deranged', | |
'Good News', 'Hysterical', 'Pipe Organ', 'Trinoids', 'Whisper', 'Zarvox'] | |
for voice in voices: | |
os.system('say -v %s "Oregon State University" '%(voice,)) |
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
#coding: utf-8 | |
from cStringIO import StringIO | |
from email.mime.multipart import MIMEMultipart | |
from email.mime.text import MIMEText | |
from email.header import Header | |
from email import Charset | |
from email.generator import Generator | |
import smtplib | |
# Example address data |
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
def sendgrid(from_email, to_email, subject, message): | |
msg = MIMEText(message) | |
msg['Subject'] = subject | |
msg['From'] = from_email | |
msg['To'] = to_email | |
# Login credentials to sendgrid | |
username = '**********' | |
password = "**********" | |