Skip to content

Instantly share code, notes, and snippets.

View peterk87's full-sized avatar

Peter Kruczkiewicz peterk87

  • Canadian Food Inspection Agency
  • Canada
View GitHub Profile
@peterk87
peterk87 / CGF_report_manual.tex
Last active December 16, 2015 15:09
LaTex: CGF report creator manual
\documentclass{article}
\usepackage{lineno}
\usepackage{url}
\usepackage{hyperref}
\usepackage{fancyhdr} % Needed to define custom headers/footers
\usepackage{titlesec}
\usepackage{lastpage} % Used to determine the number of pages in the document (for "Page X of Total")
@peterk87
peterk87 / interpolate_colors.cs
Created April 24, 2013 15:36
C#: Interpolate between 2 colors - 2 different approaches taken from StackOverflow.com
// Interpolate between 2 colors in C#
// Taken from answer by user Jason
// http://stackoverflow.com/questions/1236683/color-interpolation-between-3-colors-in-net
class ColorInterpolator {
delegate byte ComponentSelector(Color color);
static ComponentSelector _redSelector = color => color.R;
static ComponentSelector _greenSelector = color => color.G;
static ComponentSelector _blueSelector = color => color.B;
public static Color InterpolateBetween(
@peterk87
peterk87 / Comments.tmPreferences
Created April 24, 2013 15:33
XML: Sublime Text 2 C# toggle comment/uncomment save in Sublime Text 2/Packages/C#
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>name</key>
<string>Comments</string>
<key>scope</key>
<string>source.cs</string>
<key>settings</key>
<dict>
@peterk87
peterk87 / gist:5453001
Last active December 16, 2015 14:59
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
@peterk87
peterk87 / ipython_notebook_dark.css
Created April 23, 2013 21:15
CSS: IPython custom CSS for dark theme
/*IPython Notebook Dark CSS style*/
/*URLs matching the regexp: .*127.0.0.1:8\d\d\d.* */
body {
background-color: #111 !important;
color: #ccc !important;
}
.dropdown-menu>li>a, li, ul {
color: #ccc !important;
@peterk87
peterk87 / gist:5441280
Last active December 16, 2015 13:19
CSS: MightyText dark theme
/*Dark CSS theme for regex match of .*mightytext.net.* */
textarea, div, span, body, .nav-tabs, div#pinnedContent, .thread-tab {
background-color: rgb(30,30,30) !important;
color: rgb(170,170,170) !important;
}
span {
background-color: transparent !important;
}
a#share-button-main, a#follow-button-main, span#alert-bottom-right-corner {
visibility: hidden !important;
@peterk87
peterk87 / gist:5441268
Last active December 16, 2015 13:19
JSON: Sublime Text 2 user settings
{
"bold_folder_labels": true,
"fade_fold_buttons": false,
"font_size": 9,
"highlight_line": true,
"highlight_modified_tabs": true,
"ignored_packages":
[
"Vintage"
],
@peterk87
peterk87 / gist:5439458
Last active December 16, 2015 13:08
CSS: GMail custom dark theme
.nH, .Bk, .gstt, .gbqfif, .mG, .mD, font, div.im, .amn, .hP, .Ap, .Ar.Au, .editable, .ej, .Bu, .M9, .fN, div#loading, div.nr.tMHS5d, div.ip.adB, .ef, .eh, .dW.E, .cf {
background-color: #161612!important;
color: #D7D8D1!important;
}
.gD, .gK, .gH, .ii a , iw, amt{
color: #97FFFF;
}
a {
color: #D7D8D1!important;
}
@peterk87
peterk87 / get_files_in_dir.py
Created April 22, 2013 16:27
Python: Get list of files containing a specified string/extension and print to stdout
import os
# get a list of files containing a certain string/extension
l = [f for f in os.listdir('.') if '.markers' in f]
lFNA = [f for f in os.listdir('.') if '.fna' in f]
# print the matching files to stdout
# get commandline command for running MIST
print 'MIST.exe -j mist.json -T tmp -t ' + ' -t '.join(l) + ' ' + ' '.join(lFNA)
@peterk87
peterk87 / add_git_bash_sublime_text_to_win7_context_menus.reg
Created April 20, 2013 01:38
Reg: Create Windows 7 file explorer context menu items for ST2 and Git Bash
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\*\shell\Open in Sublime Text 2]
"Icon"="C:\\Program Files\\Sublime Text 2\\sublime_text.exe"
[HKEY_CLASSES_ROOT\*\shell\Open in Sublime Text 2\command]
@="\"C:\\\\Program Files\\\\Sublime Text 2\\\\sublime_text.exe\" \"%1\""
[HKEY_CLASSES_ROOT\Directory\Background\shell\Open in Sublime Text 2\command]
@="\"C:\\\\Program Files\\\\Sublime Text 2\\\\sublime_text.exe\" \"%v\""