Skip to content

Instantly share code, notes, and snippets.

@raghur
raghur / ChargifyStreamDecorator.cs
Last active December 19, 2015 00:29
Handling POST data from Chargify so that MVC model binding works...
/// <summary>
/// Filter that replaces [] with . so that model binding works.
/// </summary>
/// <remarks>
/// simplistic - does a global replace. Also assumes that [, ]
/// are not url encoded in the key names (and this is
/// the case with chargify right now
/// so product name like 'Daily Plan []' is sent as
/// payload[subscription][product][name]=Daily%20Plan%20%5B%5D
/// ie key names square brackets are sent as is, whereas in values they are url encoded.
@raghur
raghur / grephacks.vim
Last active December 20, 2015 05:58
Vim script to easily find in files - some improvements over http://vim.wikia.com/wiki/Find_in_files_within_Vim
let s:grepopts='\ --exclude-dir=packages\ --exclude-dir=.git\ --exclude-dir=.svn\ --exclude-dir=tmp\ --exclude=*.intellisense.js\ --exclude=*-vsdoc.js\ --exclude=*.tmp\ --exclude=*.min.js\ -PHIirn\ $*'
if has('win32')
let s:find=fnamemodify(findfile("find.exe", $GNUWIN."**"), ":p")
let s:grep=fnamemodify(findfile("grep.exe", $GNUWIN."**"), ":p")
endif
execute "set grepprg=" . s:grep ."\\ " . s:grepopts
fun! Get_grep_include_opt(prefix)
@raghur
raghur / OpenWithEditors.bat
Last active January 1, 2016 23:09 — forked from mrchief/LICENSE.md
Edit with context menu options for GVim and SublimeText
@echo off
SET st2Path=E:\Utils\ST3\sublime_text.exe
SET gvimPath=c:\users\raghuramanr\bin\gvi.bat
SET gvimIcoPath=e:\Utils\gvim\gvim.exe
rem add it for all file types
@reg add "HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text" /t REG_SZ /v "" /d "Open with Sublime Text" /f
@reg add "HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text" /t REG_EXPAND_SZ /v "Icon" /d "%st2Path%,0" /f
@reg add "HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text\command" /t REG_SZ /v "" /d "%st2Path% \"%%1\"" /f
@raghur
raghur / tmux.conf
Last active August 29, 2015 13:56 — forked from shinzui/tmux.conf
# ~/.tmux.conf
#
# See the following files:
#
# /opt/local/share/doc/tmux/t-williams.conf
# /opt/local/share/doc/tmux/screen-keys.conf
# /opt/local/share/doc/tmux/vim-keys.conf
#
# URLs to read:
#
@raghur
raghur / .vimrc2
Last active August 29, 2015 13:58
Vundle problem repro
filetype off
set rtp^=~/.vim
set rtp+=~/.vim/bundle/vundle/
call vundle#rc("$HOME/.vim/bundle/")
Plugin 'gmarik/vundle'
Plugin 'kshenoy/vim-signature'
Plugin 'https://git.gitorious.org/vim-gnupg/vim-gnupg'
Plugin 'raghur/vim-helpnav'
Plugin 'vim-scripts/L9'
Plugin 'kien/ctrlp.vim'
@raghur
raghur / sites-enabled-default
Created May 13, 2014 19:00
nginx reverse proxy configuration with SSL offload and basic auth
#/etc/nginx/sites-enabled/default
ssl_certificate /path/to/cert.pem;
ssl_certificate_key /path/to/private.key;
ssl_session_timeout 5m;
ssl_protocols SSLv3 TLSv1;
ssl_ciphers ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv3:+EXP;
ssl_prefer_server_ciphers on;
@raghur
raghur / delete-builds.groovy
Created June 16, 2014 08:35
Delete build logs from Jenkins from the script console
import jenkins.model.*;
import hudson.model.Fingerprint.RangeSet;
def jobName = "Monitors/Monitor-Wadlogs (DevTest)"
def buildRange = "123-2140"
def j = Jenkins.instance.getItemByFullName(jobName);
println j
def r = RangeSet.fromString(buildRange, true);
j.getBuilds(r).each { it.delete() }
@raghur
raghur / gulpfile.js
Created April 22, 2015 16:03
Weird sourcemap behavior
var gulp = require('gulp');
var gutil = require('gulp-util');
var browserify = require('browserify');
var watchify = require('watchify');
var notify = require("gulp-notify");
var buffer = require('vinyl-buffer');
var globby = require('globby');
var source = require('vinyl-source-stream');
var sourcemaps= require('gulp-sourcemaps');
@raghur
raghur / Command line
Last active January 30, 2016 06:11
Generate project dependency graph from csproj files.
gfind -maxdepth 2 -name *.csproj |xargs grep -i "ProjectReference Include"| grep -Pino [a-zA-Z.]+\.csproj| awk -F: -f e:\depgraph.awk > graph.md
mermaid -p graph.md
@raghur
raghur / Bamboo.user.js
Created March 24, 2016 11:10
Greasemonkey script to make Bamboo webUI bearable.
// ==UserScript==
// @name BambooMamboo
// @namespace http://blog.rraghur.in
// @description make Bamboo web ui bearable
// @include https://acsbamboo.honeywell.com/*
// @version 1.0
// ==/UserScript==
this.$ = this.jQuery = jQuery.noConflict(true);
var nodes = $("td.dashboard-operations")