Skip to content

Instantly share code, notes, and snippets.

View millerjp's full-sized avatar

Johnny Miller millerjp

View GitHub Profile
@millerjp
millerjp / gist:d943ae9e570212776ca9
Created May 23, 2014 07:57
Newtab OSX terminal utility script
# Opens a new tab in the current Terminal window and optionally executes a command.
# When invoked via a function named 'newwin', opens a new Terminal *window* instead.
newtab() {
# If this function was invoked directly by a function named 'newwin', we open a new *window* instead
# of a new tab in the existing window.
local funcName=$FUNCNAME
local targetType='tab'
local targetDesc='new tab in the active Terminal window'
local makeTab=1
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAAgQDExDUp8u4PsYOZPNcG4JZdl9BsdrnEO5oihr/OecqZlkdTAr/yq9w9EJjVrTgygeybveLI4pJZYeeVwsFRFFQdaJtEcFBfwrIi+Lwv5g6fewi1Ung2kF9U3pyD8QvM80G+Hvzzu3Fu2e9djvhyM6btHd8EN5oiZwdLzd510mhkuQ== johnny@jpm-macbook.local
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCY71NBkMacD4iWj659MJGLlXNwQSh0cphqRTVDT15q2P/L0tPpsb1CW0WyBC43UqVDHq0ndULglJCuRzw4HiGdpT9kQrxXPh2sXHBpQ1DWaZiWIE0a+Sw8u5BebCvZggjzvxxScIPqdf9JEy/EpjhMsjn8DGNjeJ8kCfeGME6c5AS7TDoAuLIkAK6RBNtyuRFN7ppHEpCfgpE8LgcO6lU7FIiZjfYvFvndpOH/GMgbJ0ag6uapS1J4TpbdIrQK1GmkaM69kIGtZWRnIM70wv/Fkb4zfGmAdS9DLtoeGV2xgHLRP4389BXoYfR+OWBrRvM3lK+A0N47lhDPcsMjwXnR johnny@jpm
@millerjp
millerjp / gist:58495a4b0f09890ec273
Last active August 29, 2015 14:22
After replacing trackpad on W540, add this to /usr/share/X11/xorg.conf.d/20-thinkpad.conf on Mint 17.1 to get middle button scrolling working
Section "InputClass"
Identifier "Touchpad/TrackPoint"
MatchProduct "PS/2 Generic Mouse"
MatchDriver "evdev"
Option "EmulateWheel" "1"
Option "EmulateWheelButton" "2"
Option "Emulate3Buttons" "0"
Option "XAxisMapping" "6 7"
Option "YAxisMapping" "4 5"
EndSection
@millerjp
millerjp / disk-setup.sh
Last active September 15, 2015 08:54 — forked from tobert/disk-setup.sh
#!/bin/bash
# DANGER: ALL DATA WILL BE DELETED
# assumes disk order is consistent
# atobey@datastax.com 2015-05-09
export PATH=/bin:/sbin:/usr/sbin:/usr/bin:/usr/local/bin:/usr/local/sbin
die () { echo "FATAL: $*"; exit 1; }
#!/bin/bash
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# Get command-line help.
newtab -h
# Simpy open new tab.
newtab
# Open new tab and execute command (quoted parameters are supported).
newtab ls -l "$Home/Library/Application Support"
# Open a new tab with a given working directory and execute a command;
# Double-quote the command passed to `eval` and use backslash-escaping inside.
newtab eval "cd ~/Library/Application\ Support; ls"
# Open new tab, execute commands, close tab.
CREATE KEYSPACE bookmarks WITH replication = {'class': 'SimpleStrategy', 'replication_factor':'1'};
USE bookmarks;
CREATE TABLE bookmark_by_user_video (
user_id text,
tvshow_id text,
season int,
continue_watching boolean,
video_id text,
created timestamp,
time_in_video int,
PRIMARY KEY ((user_id, video_id))
);
SELECT video_id, created, time_in_video FROM bookmark_by_user_video WHERE user_id = 'johnny' AND video_id = '666QAZ';
video_id | created | time_in_video
----------+--------------------------+---------------
666QAZ | 2013-12-25 15:12:51+0100 | 20