Skip to content

Instantly share code, notes, and snippets.

View joshwnj's full-sized avatar

Josh Johnston joshwnj

View GitHub Profile
alias encrypt="openssl enc -aes-256-cbc -a -salt"
alias decrypt="openssl enc -d -aes-256-cbc -a -salt"
@joshwnj
joshwnj / jslint
Last active December 14, 2015 03:19
Options for npm jslint
#!/bin/bash
/usr/local/share/npm/bin/jslint --browser --continue --devel --node --nomen --sloppy --vars --white --es5 false $@
@joshwnj
joshwnj / UrlShortener.php
Created February 14, 2013 09:21
using the bitly api
<?php
class UrlShortener {
const API_URL = 'http://api.bitly.com/v3/shorten';
private $_config;
function __construct ($config) {
$this->_config = $config;
}
####
## path
export PATH='$HOME/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/git/bin:/usr/local/share/npm/bin'
####
## bash
alias ll='ls -halG'
@joshwnj
joshwnj / .osx
Created December 18, 2012 10:07
## source: https://github.com/hij1nx/dotfiles/blob/master/.osx
# Enable the 2D Dock
defaults write com.apple.dock no-glass -bool true
# Automatically hide and show the Dock
defaults write com.apple.dock autohide -bool true
# Make Dock icons of hidden applications translucent
defaults write com.apple.dock showhidden -bool true
@joshwnj
joshwnj / nav.html
Created September 6, 2012 09:04
Create a select element from a bunch of links
<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
<select id="nav-select"></select>
<nav id="nav" class="nav" role="navigation">
;; turn line numbers off by default
(global-linum-mode -1)
(defun goto-line-with-feedback (&optional line)
"Show line numbers temporarily, while prompting for the line number input"
(interactive "P")
(if line
(goto-line line)
(progn
(linum-mode 1)
@joshwnj
joshwnj / files-from-month.sh
Created May 21, 2012 22:17
give me a list of files from the month of May 2011
## give me a list of files from the month of May 2011
ls -laht --color=never | egrep 'May[ ]+[0-9]+[ ]+2011(.*)' | sed 's/.*2011 / /'
## move them to a separate directory
mkdir may-2011; ls -laht --color=never | egrep 'May[ ]+[0-9]+[ ]+2011(.*)' | sed 's/.*2011 / /' | xargs -I {} mv {} may-2011/
@joshwnj
joshwnj / files-to-update.sh
Created March 21, 2012 15:08
get a list of filenames that will be modified when you update
#!/bin/sh
svn st -u | grep '*' | sed -E 's/^.*[\*].*[0-9 ]+//'
@joshwnj
joshwnj / gist:1813347
Created February 13, 2012 03:38
filterstat
#!/bin/bash
# Wrapper for "svn status". Shows only files matching the filter
# Usage: filterstat [?CMAI]
#
# source: http://subversion.tigris.org/faq.html#switch-problems
filter=$1
svn status --no-ignore | grep ^[${filter}] | sed s/^[${filter}]//