Skip to content

Instantly share code, notes, and snippets.

View dctucker's full-sized avatar
🎹
doing stuff using keyboards

Casey Tucker dctucker

🎹
doing stuff using keyboards
View GitHub Profile
@dctucker
dctucker / tabcolor.sh
Last active May 31, 2017 17:17 — forked from wadey/iterm2.zsh
Change iTerm2 tab color when using SSH
# Usage:
# source tabcolor.sh 96 96 192
# iTerm2 window/tab color commands
# Requires iTerm2 >= Build 1.0.0.20110804
# http://code.google.com/p/iterm2/wiki/ProprietaryEscapeCodes
rgb() {
echo -ne "\033]6;1;bg;red;brightness;$1\a"
echo -ne "\033]6;1;bg;green;brightness;$2\a"
echo -ne "\033]6;1;bg;blue;brightness;$3\a"
@dctucker
dctucker / The Technical Interview Cheat Sheet.md
Last active October 20, 2017 20:12 — forked from tsiege/The Technical Interview Cheat Sheet.md
This is my technical interview cheat sheet. Feel free to fork it or do whatever you want with it. PLEASE let me know if there are any errors or if anything crucial is missing. I will add more links soon.

Studying for a Tech Interview Sucks, so Here's a Cheat Sheet to Help

This list is meant to be a both a quick guide and reference for further research into these topics. It's basically a summary of that comp sci course you never took or forgot about, so there's no way it can cover everything in depth. It also will be available as a gist on Github for everyone to edit and add to.

Data Structure Basics

Array

Definition:

  • Stores data elements based on an sequential, most commonly 0 based, index.
  • Based on tuples from set theory.
@dctucker
dctucker / gist:0d3c82c69b806492dc7438c3a1859e49
Created December 15, 2017 18:38
Library/KeyBindings/DefaultKeyBinding.dict
{
"\UF729" = "moveToBeginningOfLine:";
"$\UF729" = "moveToBeginningOfLineAndModifySelection:";
"\UF72B" = "moveToEndOfLine:";
"$\UF72B" = "moveToEndOfLineAndModifySelection:";
"\UF72C" = "pageUp:";
"\UF72D" = "pageDown:";
"\UF739" = ("selectAll:","delete:","selectNone:");
}
@dctucker
dctucker / open_github.vim
Created March 13, 2018 15:54
Vimscript for opening the current file in GitHub for Mac
function! OpenGithub()
" let l:pwd = expand("%:p:h:t")
let l:branch = systemlist("git -C " . expand("%:p:h") . " symbolic-ref --quiet --short HEAD || git rev-parse --short HEAD")[0]
let l:root = systemlist("git -C " . expand("%:p:h") . " rev-parse --show-toplevel")[0]
let l:repo = fnamemodify(l:root, ":t")
let l:fn = substitute(expand("%"), escape(l:root, "/"), "", "g")
exec "!open https://github.com/github/" . l:repo . "/blob/" . l:branch . l:fn
endfunction
command! -nargs=0 GH call OpenGithub()

Keybase proof

I hereby claim:

  • I am dctucker on github.
  • I am dctucker (https://keybase.io/dctucker) on keybase.
  • I have a public key ASBZfm2rC5JytgnqrPa0ulPQ6k1KTpIe0czQHL9TqX8Rqgo

To claim this, I am signing this object:

@dctucker
dctucker / mark_read.sh
Created April 19, 2018 23:13
This uses the GitHub API to mark notifications as read if they meet a certain criteria (closed/merged/OoO/Backport/etc)
#!/bin/bash
mark_read() {
id=$1
curl -H "$CURLH" -s -X PATCH $API/notifications/threads/$id
}
CURLH="Authorization: token $GITHUB_TOKEN"
API=https://api.github.com
@dctucker
dctucker / gist:f1914a3c225743422f17
Last active July 14, 2018 12:59 — forked from bryhal/gist:4129042
MYSQL: Generate Calendar Table
DROP TABLE IF EXISTS calendar;
CREATE TABLE calendar (
id INTEGER PRIMARY KEY, -- year*10000+month*100+day
date DATE NOT NULL,
year INTEGER NOT NULL,
month INTEGER UNSIGNED NOT NULL, -- 1 to 12
day INTEGER UNSIGNED NOT NULL, -- 1 to 31
quarter INTEGER UNSIGNED NOT NULL, -- 1 to 4
week INTEGER UNSIGNED NOT NULL, -- 1 to 52/53
dayofweek INTEGER UNSIGNED NOT NULL, -- 1 to 7
@dctucker
dctucker / 70-ec2-nvme-devices.rules
Created February 14, 2019 22:59 — forked from jalaziz/70-ec2-nvme-devices.rules
AWS EBS NVMe udev rules
# Copyright (C) 2006-2016 Amazon.com, Inc. or its affiliates.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License").
# You may not use this file except in compliance with the License.
# A copy of the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "license" file accompanying this file. This file is
@dctucker
dctucker / lint.sh
Created June 15, 2023 23:52
run clang-format in Docker for DelugeFirmware
#!/bin/bash
cd "$(dirname "$0")"
run_args=(
-it
-v $(pwd):/tree
--rm
--workdir /tree
)
@dctucker
dctucker / FlashStorage-partial.h
Created June 23, 2023 06:11
flash storage settings struct
typedef struct {
uint8_t
firmwareVersion, // 0
reserved_0, // 1
ramSize, // 2
reserved_1[9]; // 3 .. 11
struct {
uint8_t
voltsPerOctave[2], // 12
transpose[2], // 14