Skip to content

Instantly share code, notes, and snippets.

View kmorey's full-sized avatar

Kevin Morey kmorey

View GitHub Profile
@kmorey
kmorey / nginx
Created January 30, 2009 16:36
init.d script to control nginx server. (modified from apache init.d script)
#!/bin/bash
#
# nginx Startup script for nginx server
#
# chkconfig: - 85 15
# description: nginx is a World Wide Web server. It is used to serve \
# HTML files and CGI.
# processname: nginx
# config: /etc/httpd/conf/nginx.conf
# config: /etc/sysconfig/nginx
#!/bin/bash
while [ 1 ]
do
if [ ! -e "$1" ]
then echo "" > $1
fi
sleep 1s
done
update table_name set field_name = replace(field_name, '\\/', '/') where field_name ~ '\\\/';
@kmorey
kmorey / nba_score.js
Last active October 5, 2015 06:48
Update NBA title with score
function update_title() {
var score = [];
jQuery('.jumbo_digit').each(function() {
score.push(this.className.replace(/\s*jumbo_digit\s*/g, '').replace(/none|digit/g, ''));
});
var qtr = jQuery("#quarter_indicator").text();
var time = jQuery("#time_indicator").text();
document.title=score.slice(0, 3).reverse().join('') + '-' + score.slice(3, 6).reverse().join('') +
' ' + qtr + ' (' + time + ')';
:command! -complete=customlist,ListTypes -nargs=1 LP !playbook/playbook.sh <args>
:fun! ListTypes(A,L,P)
python << endpython
import vim
arg = vim.eval("a:A")
result = [x for x in ["debug", "release"] if x.startswith(arg)]
vim.command("return " + str(result))
endpython
:endfun
# TODO: Explain what some of this does..
bindkey -e
bindkey '\ew' kill-region
bindkey -s '\el' "ls\n"
bindkey '^r' history-incremental-search-backward
bindkey "^[[5~" up-line-or-history
bindkey "^[[6~" down-line-or-history
# make search up and down work, so partially type and hit up/down to find relevant stuff
-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: GnuPG v1.4.13 (Darwin)
Comment: GPGTools - http://gpgtools.org
mQENBE3HZzEBCADGc/haz+UJZjNSjW266m5zwdcYchfY6IfL9SE1oOIdOgF8Uz8q
sQV40pwYIhF4BpTPWPjvX8ogxRLvPbDjQPnQtso/dtkm7ecAO1xlyHBPGDstfQpO
bqbxb1eq9YFiWolcX2QS6bVajHS9cjFvr9zo0AY5T4WWSurBGXW9hGZNVkZXWDnl
/FqgNVrsaxqU7T6t3H0DotRoZgWxQP4r05OH+yRJlqM4XN92beoUXFUOBlbaelTv
7Z7wv8bxNgX6oT/q2ukRC2C2yrPgp41VsmNqvKcpMpQZSfuKRBW+aKDBWMsJIxRp
63CcXKV480D6FdTrg04HOS7RJbxyrygr9zfZABEBAAG0I0tldmluIE1vcmV5IDxr
@kmorey
kmorey / Default (OSX).sublime-keymap
Last active August 29, 2015 13:57
Goto Find Results
[
{
"keys": [
"enter"
],
"command": "find_in_files_goto",
"context": [
{
"key": "selector",
"operator": "equal",
# -*- coding: utf-8 -*-
from datetime import datetime
import time
import sublime_plugin
class TimestampCommand(sublime_plugin.EventListener):
"""Expand `isoD`, `now`, `datetime`, `utcnow`, `utcdatetime`,
`date` and `time`
var real_docwrite = document.write,
body = $('body');
(function insertGists(a_tags) {
if (a_tags.length > 0) {
a_tag = a_tags.shift()
document.write = function(stylesheet) {
$('head').append(stylesheet);