Skip to content

Instantly share code, notes, and snippets.

View floydpink's full-sized avatar

Hari Pachuveetil floydpink

View GitHub Profile
PATH=$HOME/bin:$ADDPATH:$PATH
SSH_ENV="$HOME/.ssh/environment"
# start the ssh-agent
function start_agent {
echo "Initializing new SSH agent..."
# spawn ssh-agent
ssh-agent | sed 's/^echo/#echo/' > "$SSH_ENV"
echo succeeded
chmod 600 "$SSH_ENV"
@floydpink
floydpink / deployment.sh
Last active December 10, 2015 18:08
Octopress blog on a custom domain site hosted on GitHub Pages - 2
# set up Octopress site to publish to your projects gh-pages repository
rake setup_github_pages # enter the URL to the repository whose gh-pages hosts example.com
# make below changes to to enable deployment to a gh-pages subdirectory named 'blogs'
# _config.yml
destination: public/blogs
url: http://example.com/blogs
subscribe_rss: /blogs/atom.xml
root: /blogs
# config.rb - for Compass & Sass
@floydpink
floydpink / setup.sh
Created January 7, 2013 04:05
Octopress blog on a custom domain site hosted on GitHub Pages - 1
# clone Octopress
git clone git://github.com/imathis/octopress.git my-site-blog
cd my-site-blog
# install dependencies
gem install bundler
bundle install
# install the default Octopress theme
rake install
@floydpink
floydpink / invocation_method.cs
Created December 17, 2012 04:03
The main method that does the AOP magic
public void Intercept(IInvocation invocation)
{
if (Log.IsDebugEnabled) Log.Debug(CreateInvocationLogString("Called", invocation));
try
{
invocation.Proceed();
if (Log.IsDebugEnabled)
if (invocation.Method.ReturnType != typeof(void))
Log.Debug("Returning with: " + invocation.ReturnValue);
}
@floydpink
floydpink / remote_branch.sh
Created December 11, 2012 15:24
Create and delete remote branches
# create new remote branch on push
git push origin mybranch
# delete existing remote branch on push
git push origin :mybranch
@floydpink
floydpink / lzwCompress_usage.js
Created December 7, 2012 03:17
lzwCompress.js
// To compress anything from within JS
var compressed = lzwCompress.pack(humongousObj);
// And to decompress it
var original = lzwCompress.unpack(compressed);
@floydpink
floydpink / gist:4225250
Created December 6, 2012 15:21
Get git log graphically with all tags/branches
git log --all --decorate --oneline --graph
@floydpink
floydpink / compare.sh
Created December 6, 2012 14:56
Compare master to experiment
git log --graph --left-right --cherry-pick --oneline master...experiment
@floydpink
floydpink / JSONKeyMinify.js
Created December 5, 2012 20:00
JSON Minification
var JSONKeyMinify = function (Array, JSON, undefined) {
"use strict";
// http://stackoverflow.com/questions/1988349/array-push-if-does-not-exist
// http://stackoverflow.com/questions/4433402/replace-keys-json-in-javascript
Array.prototype.inArray = function (comparer) {
for (var i = 0; i < this.length; i++) {
if (comparer(this[i])) return true;
}
return false;
};
@floydpink
floydpink / bulk-resize-by-percent.bat
Last active October 13, 2015 15:48
Convert all JPGs in a folder to PDFs with same file name
gm mogrify -output-directory low-res -resize 60% *.png