Skip to content

Instantly share code, notes, and snippets.

@kevinhooke
kevinhooke / gist:fc1a6a49547d55ff9f44
Created December 13, 2015 22:57
bash script - find files matching pattern, grep file content for pattern, pipe results to file
#!/bin/bash
for f in $(find -E . -regex ".*ext1|.*ext2|.*ext3")
do
echo $f $'\n' $(egrep -o 'TextAtStartOfLine:[[:space:]]*[[:digit:]]+' $f) $'\n' >> report"$(date)".txt
done
@kevinhooke
kevinhooke / gist:e1384f8bfe77bb2970b4
Created December 16, 2015 23:31
Jackson Jersey mapping - exclude any unknown properties
@JsonIgnoreProperties(ignoreUnknown = true)
@kevinhooke
kevinhooke / gist:2f7aebbb95305b3c2ec6
Created December 17, 2015 23:46
Jersey client over HTTP using Fiddler - disable SSL cert checking
TrustManager[] trustAllCerts = new TrustManager[]{new X509TrustManager(){
public java.security.cert.X509Certificate[] getAcceptedIssuers(){
return new X509Certificate[0];
}
public void checkClientTrusted(X509Certificate[] certs, String authType){}
public void checkServerTrusted(X509Certificate[] certs, String authType){}
}};
SSLContext sc = null;
try {
@kevinhooke
kevinhooke / gist:275222c06f0c25356a9c
Created December 25, 2015 17:33
Git reset local branch to remote master
git fetch origin
git reset --hard origin/master
@kevinhooke
kevinhooke / gist:25ac39934ee2f903e1cc
Created January 5, 2016 19:57
Sonar branch name
# pass to mvn to store analysis results in Sonar as 'artifactname+sonar.branch'
-Dsonar.branch=branchname
@kevinhooke
kevinhooke / gist:51cbdf2c6a9dc6489ad7
Created January 13, 2016 17:33
Check RHEL or OL distro version
cat /etc/redhat-release
@kevinhooke
kevinhooke / gist:cce1fc78c8bb18518c6e
Created January 13, 2016 21:19
Combining multiple @RunWith using PowerMock runner delegate
@RunWith(PowerMockRunner.class)
// delegate to SpringJUnit4ClassRunner.class
@PowerMockRunnerDelegate(SpringJUnit4ClassRunner.class)
@kevinhooke
kevinhooke / gist:e0bde8694e358534a1f7
Created January 15, 2016 01:14
linux file line count
wc -l file
@kevinhooke
kevinhooke / gist:36833e9586bdf4c1b015
Created January 15, 2016 23:09
Oracle Linux 5.9 guest install on VirtualBox
Enable host io cache on storage controller, otherwise you get an error during the install (disk not writable).
@kevinhooke
kevinhooke / gist:58a0142e6d75e2aacd38
Created January 21, 2016 22:34
Expose Docker container ports on WIndows
#From Docker Quickstart Terminal:
# -i = interactive, -t = capture tty (using winpty on Windows)
# -p expose container port 80 as host port 8888
winpty docker run -it -p 8888:80