Skip to content

Instantly share code, notes, and snippets.

View rgsingh's full-sized avatar

Rai Singh rgsingh

View GitHub Profile
@rgsingh
rgsingh / clob_to_string
Created March 14, 2016 11:09
Java Read Clob to String
Reader reader = clobObject.getCharacterStream();
StringWriter writer = new StringWriter();
IOUtils.copy(reader, writer);
String clobString = writer.toString();
@rgsingh
rgsingh / dot_vimrc
Created March 11, 2016 11:56
.vimrc file
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Maintainer:
" Amir Salihefendic
" http://amix.dk - [email protected]
"
" Version:
" 5.0 - 29/05/12 15:43:36
"
" Blog_post:
" http://amix.dk/blog/post/19691#The-ultimate-Vim-configuration-on-Github
@rgsingh
rgsingh / vim_replace_spaces
Created March 10, 2016 12:18
vim remove spaces from beginning of line
# removes two spaces from beginning of each line
:%s/^\ //g
@rgsingh
rgsingh / JPS
Created January 22, 2016 20:13
List Windows Java processes (requires JDK)
jps -lv
@rgsingh
rgsingh / Decrypter.java
Last active September 11, 2015 19:35 — forked from scotttam/Decrypter.java
encrypt and decrypt with PBKDF2/SHA1 and AES
import javax.crypto.Cipher;
import java.security.spec.KeySpec;
import javax.crypto.spec.PBEKeySpec;
import javax.crypto.SecretKey;
import javax.crypto.spec.SecretKeySpec;
import javax.crypto.SecretKeyFactory;
import java.security.AlgorithmParameters;
import javax.crypto.spec.IvParameterSpec;
public class Decrypter {
@rgsingh
rgsingh / LICENSE
Last active August 29, 2015 14:28 — forked from ourmaninamsterdam/LICENSE
Arrayzing - The JavaScript array cheatsheet
The MIT License (MIT)
Copyright (c) 2015 Justin Perry
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
@rgsingh
rgsingh / fix_last_remote_commit
Created July 28, 2015 02:01
Remove a git commit and re-push corrections
// If a push to the remote origin was already done then do the following
1. git stash // in same directory as previous commit
2. git reset --hard HEAD~1 // reset to the commit before last
3. git stash apply
4. Build if necessary and test
5. Commit whatever is needed
6. git push origin HEAD --force
7. Done
8. Have cake
@rgsingh
rgsingh / vim_tab_space_check
Last active August 29, 2015 14:25
Vim show non-visible characters and look for whitespace or tab
:syntax on
:set syntax=whitespace
... then search for a string
...tab characters will be highlighted in blue
...space characters will be highlighted in red
If comparing more than one file in split windows, switch to that file (Ctrl-W w)
and set the syntax equal to whitespace to enable the color coding effect (:set syntax=whitespace).
@rgsingh
rgsingh / vim_diff_shortcuts
Created July 13, 2015 18:33
Vim diff of two files
#Open two files that need to be diffed
:e file1
Ctrl-w n
:e file2
:windo diffthis
:windo diffoff
Ctrl w t Ctrl w H (horizontal)
Ctrl w t Ctrl w K (vertical)
@rgsingh
rgsingh / PageI.java
Last active August 29, 2015 14:06 — forked from criminy/PageI.java
import java.util.Collection;
import java.util.List;
import java.util.ListIterator;
import org.springframework.data.domain.PageImpl;
import org.springframework.data.domain.Pageable;
/**
* Extension class between spring data commons and java.util.List that is
* required to get MyBatis to use it as a return value.