Skip to content

Instantly share code, notes, and snippets.

@nyxcalamity
nyxcalamity / socket-monitoring.sh
Created Apr 22, 2015
Socket monitoring script
View socket-monitoring.sh
##!/bin/bash
#Performs socket monitoring for specific port and outputs the result to a file.
#
#Parameters:
#1st: log file (default:socket-monitoring.sh.csv)
#2nd: number of checks per 1 sec (default:2)
#3rd: port (default:61622)
#
#Example:
# socket-monitoring.sh /media/ws/rhel-socket-monitoring.log 2 61622
@nyxcalamity
nyxcalamity / smtp-mail-check.py
Last active Aug 29, 2015
A simple mail checker script.
View smtp-mail-check.py
#!/usr/bin/env python
"""
Copyright 2014 CRX Markets S.A.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
@nyxcalamity
nyxcalamity / gf-local-cleanup.sh
Last active Nov 14, 2017
Utility scripts to clean up glassfish domain folders to avoid permgen exception
View gf-local-cleanup.sh
#!/bin/bash
#Cleans up glassfish domain folders so that the maven deployment with cargo doesn't hang.
#---------------------------------------------------------------------------------------------------
# CUSTOMIZATION SECTION START
#---------------------------------------------------------------------------------------------------
export GF_DIR=/home/nyxcalamity/ws/appservers/glassfish
#---------------------------------------------------------------------------------------------------
# CUSTOMIZATION SECTION END
#---------------------------------------------------------------------------------------------------
export OK="$(tput setaf 2) DONE$(tput sgr0)"
@nyxcalamity
nyxcalamity / backup.sh
Created Dec 21, 2013
script for complete system and data backup
View backup.sh
#!/bin/bash
#Performs a recursive directory backup by copying it to a specified location in a raw format.
#Usefull rsync shortcuts:
#-a, --archive archive mode; equals -rlptgoD (no -H,-A,-X)
#-n, --dry-run perform a trial run with no changes made
#-h, --human-readable output numbers in a human-readable format
#-W, --whole-file copy files whole (w/o delta-xfer algorithm)
#--del an alias for --delete-during
#--delete-during receiver deletes during xfer, not before
#--log-file=FILE log what we're doing to the specified FILE
@nyxcalamity
nyxcalamity / jar-libs-modifier.sh
Last active Dec 31, 2015
Removes old libs from a jar and adds new libs to it. Perfect for adding new eclipselink to glassfish-3.1.2.2-embedded jar.
View jar-libs-modifier.sh
#!/bin/bash
#DESCRIPTION:
#Generates a new jar in which:
#-Classes from all jars in $OLD_LIBS are removed
#-Files fron all jars in $NEW_LIBS are added (except META-INF dir, *.html, anything with "LICENCE")
#
#REQUIRES:
#-Installed jar and/or keytool
#
#HOW TO USE:
@nyxcalamity
nyxcalamity / pmd.xml
Created Dec 6, 2013
pmd config file.
View pmd.xml
<?xml version="1.0" encoding="UTF-8"?>
<ruleset>
<description>QP Backend</description>
<rule ref="rulesets/strictexception.xml/AvoidThrowingNewInstanceOfSameException">
<priority>4</priority>
</rule>
<rule ref="rulesets/basic.xml/EmptyInitializer">
<priority>4</priority>
</rule>
<rule ref="rulesets/strings.xml/AvoidStringBufferField">
@nyxcalamity
nyxcalamity / findbugs.xml
Created Dec 6, 2013
FindBugs config file.
View findbugs.xml
<?xml version="1.0" encoding="UTF-8"?>
<FindBugsFilter>
<Match>
<Bug pattern="BC_IMPOSSIBLE_DOWNCAST"/>
</Match>
<Match>
<Bug pattern="BC_IMPOSSIBLE_DOWNCAST_OF_TOARRAY"/>
</Match>
<Match>
<Bug pattern="EC_INCOMPATIBLE_ARRAY_COMPARE"/>
@nyxcalamity
nyxcalamity / checkstyle.xml
Last active Dec 30, 2015
checkstyle config file for crxmarkets
View checkstyle.xml
<?xml version="1.0"?>
<!DOCTYPE module PUBLIC
"-//Puppy Crawl//DTD Check Configuration 1.2//EN"
"http://www.puppycrawl.com/dtds/configuration_1_2.dtd">
<!-- NOTE: Change formatting of PackageName if you need a generic config. -->
<module name="Checker">
<!-- Checks that property files contain the same keys. -->
<module name="Translation"/>
@nyxcalamity
nyxcalamity / xvfb
Last active Apr 25, 2016
/etc/init.d/xvfb service script
View xvfb
XVFB=/usr/bin/Xvfb
XVFB_ARGS=":1 -ac -screen 1 1600x1200x24"
XVFB_LOG=/var/log/xvfb
case "$1" in
start)
echo -n "Starting Xvfb: "
$XVFB $XVFB_ARGS 1>&2 2> $XVFB_LOG &
echo "OK"
;;