Skip to content

Instantly share code, notes, and snippets.

View cjmcgraw's full-sized avatar

Carl McGraw cjmcgraw

View GitHub Profile
@cjmcgraw
cjmcgraw / vimrc
Created May 11, 2023 18:28
My Current Vimrc File
" Plug configuration
call plug#begin()
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
Plug 'luochen1990/rainbow'
Plug 'flazz/vim-colorschemes'
call plug#end()
" configure rainbow brackets globally
let g:rainbow_active = 1
@cjmcgraw
cjmcgraw / CapsLockCtrlEscape.ahk
Created December 17, 2021 18:28 — forked from sedm0784/CapsLockCtrlEscape.ahk
AutoHotkey script to map Caps Lock to Escape when it's pressed on its own and Ctrl when used in combination with another key, à la Steve Losh. Adapted from one that does something similar with the Ctrl Key on the Vim Tips Wiki (http://vim.wikia.com/wiki/Map_caps_lock_to_escape_in_Windows?oldid=32281). (Plus contribs from @randy909 & @mmikeww.)
g_LastCtrlKeyDownTime := 0
g_AbortSendEsc := false
g_ControlRepeatDetected := false
*CapsLock::
if (g_ControlRepeatDetected)
{
return
}
@cjmcgraw
cjmcgraw / CapsLockCtrlEscape.ahk
Created December 17, 2021 18:27 — forked from sedm0784/CapsLockCtrlEscape.ahk
AutoHotkey script to map Caps Lock to Escape when it's pressed on its own and Ctrl when used in combination with another key, à la Steve Losh. Adapted from one that does something similar with the Ctrl Key on the Vim Tips Wiki (http://vim.wikia.com/wiki/Map_caps_lock_to_escape_in_Windows?oldid=32281). (Plus contribs from @randy909 & @mmikeww.)
g_LastCtrlKeyDownTime := 0
g_AbortSendEsc := false
g_ControlRepeatDetected := false
*CapsLock::
if (g_ControlRepeatDetected)
{
return
}
@cjmcgraw
cjmcgraw / project_cyoa.py
Created June 29, 2021 21:54
Projecting CYOA into a higher dimensional space
import tensorflow as tf
from tensorflow.keras import layers
from tensorflow.keras.layers.experimental.preprocessing import StringLookup
import logging as log
import numpy as np
import sys
log.basicConfig(
level=log.DEBUG,
stream=sys.stdout,
@cjmcgraw
cjmcgraw / calculate_minimum_sample_size.py
Last active June 23, 2021 18:46
A script containing functions to calculate minimum required sample size for experiments:
#! /usr/bin/env python
import math
import statistics
def binomial_required_sample_size(p1, p2, min_diff=5e-4, include_continuity_correct=True, two_sided=True):
"""derived from: https://www.itl.nist.gov/div898/handbook/prc/section2/prc242.htm"""
z_alpha = 1.95
if two_sided:
z_alpha = 2.24
z_beta = 0.89
@cjmcgraw
cjmcgraw / latency.txt
Created April 13, 2021 15:42 — forked from jboner/latency.txt
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
@cjmcgraw
cjmcgraw / smart-caps-lock.md
Created January 6, 2021 00:38 — forked from tanyuan/smart-caps-lock.md
Smart Caps Lock: Remap Caps Lock to Control AND Escape

Smart Caps Lock: Remap to Control AND Escape (Linux, Mac, Windows)

  • Send Escape if you tap Caps Lock alone.
  • Send Control if you press Caps Lock with another key.

For both Vim and Emacs world.

GNU/Linux

@cjmcgraw
cjmcgraw / 0001-anomaly-detection.ipynb
Created September 5, 2019 19:30
Anomaly detection + RecSys
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@cjmcgraw
cjmcgraw / install_virtualenv.zsh
Created April 27, 2018 04:17
virtualenv 101: what is this shit?
# install virtualenv: If its all fucked up. uinstall it, then install it again. OSX is bullshit
pip install virtualenv
# use virtualenv. args are optional
virtualenv --python=python3 ./venv
# activate that shit dawg
source ./venv/bin/activate
# normally changes your prompt. If not, what kinda bullshit shell you using
@cjmcgraw
cjmcgraw / dick_scraper.py
Last active November 10, 2022 15:07
for you know... big data sets of dick pics!
#! /usr/bin/env python
import requests
import argparse
import hashlib
import json
import time
import sys
import os
parser = argparse.ArgumentParser()