Skip to content

Instantly share code, notes, and snippets.

@chilicat
chilicat / idea_template_npe_Check.java
Created January 4, 2011 21:55
NPE check intellij template
if($1$ == null) {
throw new NullPointerException("$1$");
}
@chilicat
chilicat / module
Created January 14, 2011 18:06
module template for intellij
(function() {
$END$
})();
@chilicat
chilicat / fn.js
Created January 14, 2011 18:09
Function template for intellij
,
$1$: function() {
}
@chilicat
chilicat / fn1.js
Created January 14, 2011 18:10
Function with one param
,
$1$: function($2$) {
$END$
}
get$1$: function() {
return this.$2$;
},
set$1$: function($2$) {
this.$2$ = $2$;
}
@chilicat
chilicat / disable-findbugs.gradle
Last active January 18, 2018 20:20
Gradle Findbugs: This gradle script will disable findbugs until "findbugs" task is in the task graph. This allows to skip the findbugs verification for cases it is not needed.
allprojects {
// Marker Task to enable findbugs.
task findbugs(
group: "Verification",
description: """Marker task to enabled findbugs. Findbugs is by default
disabled. E.g. ( ./gradlew findbugs build )"""
)
}
subprojects {
@chilicat
chilicat / service-init
Last active December 22, 2015 12:39
A example rhel service init script.
#!/bin/bash
### BEGIN INIT INFO
# Provides: test
# Required-Start: postgresql networking
# Required-Stop: postgresql networking
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: test
# Description: test
@chilicat
chilicat / scp-ssh.gradle
Last active July 10, 2023 02:53
A simple gradle task to upload a file via SCP to a remote host and to execute a command via SSH on a remote host.
repositories { mavenCentral() }
configurations { sshAntTask }
dependencies { sshAntTask 'org.apache.ant:ant-jsch:1.9.2' }
ant.taskdef(
name: 'scp',
classname: 'org.apache.tools.ant.taskdefs.optional.ssh.Scp',
classpath: configurations.sshAntTask.asPath)
@chilicat
chilicat / simple-command-arguments.sh
Created September 29, 2013 09:14
Simple Bash Shell Option Arguments Commandline Implementation
#!/bin/sh
while true
do
case "$1" in
-n|--name) name=$2; shift 2;;
-d|--debug) debug=1; shift 1;;
--) shift 1; break ;;
*) break ;;
esac
@chilicat
chilicat / ssht
Created October 9, 2013 12:54
Shortcut for ssh without adding host to known hosts and strict host key checking
#!/bin/sh
ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no "$@"