Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am patrick-russell on github.
  • I am patrickrussell (https://keybase.io/patrickrussell) on keybase.
  • I have a public key ASB9sMXazvNVtcPIjJ_VVQw70rsDFTAMRSNgynHe-r0kxAo

To claim this, I am signing this object:

@patrick-russell
patrick-russell / sublime-mac.textile
Created February 3, 2018 23:47 — forked from paulovera/sublime-mac.textile
SUBLIME TEXT MAC- Keyboard's Shortcuts Cheat Sheet

Sublime Text 2 – Useful Shortcuts (Mac OS X)

General

⌘T go to file
⌘⌃P go to project
⌘R go to methods
⌃G go to line
⌘KB toggle side bar
⌘⇧P command prompt
### MATPLOTLIBRC FORMAT
# This is a sample matplotlib configuration file - you can find a copy
# of it on your system in
# site-packages/matplotlib/mpl-data/matplotlibrc. If you edit it
# there, please note that it will be overridden in your next install.
# If you want to keep a permanent local copy that will not be
# over-written, place it in HOME/.matplotlib/matplotlibrc (unix/linux
# like systems) and C:\Documents and Settings\yourname\.matplotlib
# (win32 systems).
@patrick-russell
patrick-russell / file_stats.sh
Created May 29, 2014 22:09
Quick row column and size for delimited files b/c opening them up in excel or something sucks.
#!/bin/bash
if [ -z $1 ]
then echo Need a file name
exit 1
fi
file="$1"
if [ -z $2 ]
@patrick-russell
patrick-russell / LCTHW-Windows-Setup
Created December 23, 2012 17:37
Steps to get Ubuntu running on a virtual machine for the purpose of working through Learn C the Hardway.
Zedshaw’s Learn C the Hardway Windows Setup
===========================================
If you are a fan of Zedshaw’s `Learn the Hardway books`_ and have
checked out the C book, you may have noticed that the Windows setup is a
TODO. So here are steps to get Ubuntu working on a virtual machine on
Windows 7 or Vista. Whole process takes about 20-30 minutes.
What You Need
-------------
@patrick-russell
patrick-russell / Handy MySQL functions
Created December 12, 2012 05:13
Handy mysql functions
-- ROUTINE Init cap
DELIMITER $$
CREATE DEFINER=`user`@`%` FUNCTION `initcap`(cap char(50)) RETURNS char(50) CHARSET utf8
BEGIN
SET @str='';
SET @l_str='';
WHILE cap REGEXP ' ' DO
SELECT SUBSTRING_INDEX(cap, ' ', 1) INTO @l_str;
@patrick-russell
patrick-russell / mysql insert from csv
Created December 12, 2012 00:36
Simply takes a csv file and converts it into mysql insert statements. Run with -p to get prompts, otherwise pass the source file and destination table in command line. Expects a header in the csv. Uses the header to create the insert into column list.
import csv
from sys import argv
from sys import exit
import re
if argv[1] == '-p':
sfile = raw_input("\nWelcome to csv to mysql import!\nPlease enter your csv source file, including path> ")
table = raw_input("\nWhat table are you inserting into?> ")
elif argv[1] == '-np':
@patrick-russell
patrick-russell / gist:4251389
Created December 10, 2012 15:51
Sublime Text 2 - Useful Shortcuts

Sublime Text 2 – Useful Shortcuts (PC)

Loosely ordered with the commands I use most towards the top. Sublime also offer full documentation.

Editing

Ctrl+C copy current line (if no selection)
Ctrl+X cut current line (if no selection)
Ctrl+⇧+K delete line
Ctrl+↩ insert line after