Skip to content

Instantly share code, notes, and snippets.

View kdabir's full-sized avatar
👨‍💻
go git it

Kunal Dabir kdabir

👨‍💻
go git it
View GitHub Profile
@kdabir
kdabir / unique_commands.sh
Created February 22, 2012 15:52
Extract unique commands and store them #shell
#!/bin/sh
## extract uniq commands and store them
sort .bash_history uniqhistory.txt | uniq > uniqhistory.txt
@kdabir
kdabir / md5_all.sh
Created February 22, 2012 15:54
Find md5 sum of all files in current directory #shell
## find md5 sum of all files in current directory
find . -type f -print0 | xargs -0 md5sum | sort > out.txt
@kdabir
kdabir / DecimalFormatExample.java
Created February 23, 2012 05:45
Using DecimalFormat in java/groovy
import java.text.DecimalFormat;
...
DecimalFormat df = new DecimalFormat("###,##0.00");
df.format(number);
// in the format string,
// # -> shows Digit if present else blank
// 0 -> shows Digit if present else 0
// details at : http://docs.oracle.com/javase/6/docs/api/java/text/DecimalFormat.html
@kdabir
kdabir / content_template.html
Created February 23, 2012 07:17
Html Template page with Lorem ipsum text content
<!doctype html>
<html>
<head>
<title>Test Page</title>
</head>
<body>
<h1>Lorem ipsum dolor</h1>
<p>
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut
labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris
@kdabir
kdabir / hyperlink_hover.css
Created February 23, 2012 07:18
Changing hyperlink background on hover
@kdabir
kdabir / hsqldb.cmd
Created February 23, 2012 07:38
Windows cmd script to run HSQLDB server and client GUI
@echo off
REM set these variables
SET HSQLDB_HOME=c:\path\to\hsqldb
SET DB_NAME=mydb
REM start the server in new window ( prompt visible, so that you can CTRL+C )
REM database files are created in current directory/data
start java -cp %HSQLDB_HOME%\lib\hsqldb.jar org.hsqldb.server.Server --database.0 file:data/%DB_NAME% --dbname.0 %DB_NAME%
REM start the client GUI and connect to server ( no new cmd window opens because of javaw )
@kdabir
kdabir / .bash_profile
Last active October 1, 2015 01:58
Setting prompt in shell
export PS1="\n[\w]\n\u@\h $ "
# a more fancier and colored one
#export PS1="\n[\[\e[0;32m\]\w\[\e[0m\]]\n\u@\h $ "
@kdabir
kdabir / date_subtract.groovy
Created February 27, 2012 10:55
Date Diff in groovy
​def today = new Date()
def three_days_old = today - 3
println three_days_old
@kdabir
kdabir / split_delimited.groovy
Created February 27, 2012 10:56
Split delimited String in groovy
println "something|delimited".split("[|]")
println "something,delimited".split("[,]")
println "something#delimited".split("[#]")
@kdabir
kdabir / ls.cmd
Created March 4, 2012 14:47
enable ls on windows cmd
@echo off
REM include this cmd file in PATH
dir %1 %2 %3