Skip to content

Instantly share code, notes, and snippets.

@sureshnath
sureshnath / hgpu.cmd
Created April 22, 2013 17:29
mercurial recursive update
@echo off
call:PullOrRecurse
echo.&pause&goto:eof
:PullOrRecurse - if .hg found do pull update or recursive through the folders
if exist .hg call:doPull
if not exist .hg FOR /d %%G in (*) DO call:doChangeDirectory %%G
goto:eof
@sureshnath
sureshnath / hg-helper.sh
Last active December 16, 2015 21:59
mercurial multiple repositories clone/pull-update
#!/bin/bash
#### pre-requisite curl
#### assumption 1. hg web access requires user/password and values in ~/.hg-web-access.properties
#### assumption 2. hg repo access url - ssh://hg@hg
#### sample use -
#### hgUpdateOrClone https://hg/orgname/teamrepo targetfolder '/exclude-repo1/d\;/exclude-repo1/d\;'
source ~/.hg-web-access.properties
@sureshnath
sureshnath / bash.cmd
Created May 3, 2013 12:00
bash cygwin
c:\cygwin\bin\bash -c "export CHERE_INVOKING=1; exec /bin/bash --login -i;"
#!/bin/bash
PID=$(top -n1 | grep -m1 java | perl -pe 's/\e\[?.*?[\@-~] ?//g' | cut -f1 -d' ')
NID=$(printf '%x' $(top -n1 -H | grep -m1 java | perl -pe 's/\e\[?.*?[\@-~] ?//g' | cut -f1 -d' '))
jstack $PID | grep -A500 $NID | grep -m1 '^$' -B 500
@sureshnath
sureshnath / regex.txt
Last active December 17, 2015 15:09
Regexp for equals and toString
get methods
------------
(.*)(get|is)([^(]*)(.*) ----------> \2\3\(\)
toString
-----------
(get|is)([^(]*)(.*) -----> .add\("\2", \1\2\3\)
equals
-----------
@sureshnath
sureshnath / find-short-names.cmd
Last active December 21, 2015 08:38
windows 7 find short file names
@rem - original answer from - http://stackoverflow.com/a/10227715
@cmd /c for %A in ("c:\Program Files (x86)\Internet Explorer\iexplore.exe") do @echo %~sA
@sureshnath
sureshnath / file-time.sh
Last active December 22, 2015 04:08
well formatted file modified time stamp
find filename -printf "%TY-%Tm-%Td %TH:%TM:%TS\n"
date +%F.%T.%N
@sureshnath
sureshnath / mssql-foreign-key-cols.sql
Created September 20, 2013 08:52
MSSQL list foreign key columns
declare @COL_NM_PATTERN varchar(30)
declare @TAB_NM_PATTERN varchar(30)
declare @DATATYPE_PATTERN varchar(30)
declare @ESC varchar(1)
select @TAB_NM_PATTERN = '%%', @COL_NM_PATTERN = '%%', @DATATYPE_PATTERN = '%%', @ESC = '@'
-- list parent tables
SELECT
object_name(constraint_object_id) ConstraintName
, object_name(referenced_object_id) ParentTable
@sureshnath
sureshnath / unix-tail.sh
Created January 28, 2014 11:01
tail from nth line
#http://stackoverflow.com/a/314352
# tail from 21st line
tail -n +21 myfile.txt
@sureshnath
sureshnath / sticky-on-top.cmd
Created February 21, 2014 19:27
sticky on top
@C:\Software\nircmd\nircmd.exe win settopmost class Sticky_Notes_Top_Window 1