Skip to content

Instantly share code, notes, and snippets.

View bmvakili's full-sized avatar

Bijan Vakili bmvakili

View GitHub Profile
@bmvakili
bmvakili / java-logging-args.sh
Created May 28, 2018 16:49
Some apache log settings
-Dorg.apache.commons.logging.Log=org.apache.commons.logging.impl.SimpleLog
-Dorg.apache.commons.logging.simplelog.showdatetime=true
-Dorg.apache.commons.logging.simplelog.log.org.apache.http=ERROR
-Dorg.apache.commons.logging.simplelog.log.org.apache.http.wire=ERROR
@bmvakili
bmvakili / crontab
Created February 25, 2019 03:49
Crontab entry to check for bad actors attempting 100+ incorrect password attempts in a day from a given IP address and ban that IP address from trying to connect to the server
# Continuously check for bad actors and ban them!
0 */2 * * * zgrep "Failed password for root from" /var/log/auth.log | sed "s_.*Failed password for root from \([0-9][^ ]*\).*_\1_" | sort | uniq -c | sort -n | while read x ; do export IP=`echo $x | sed 's_^[ ]*[0-9]* \([0-9].*\)_\1_'`; export TEST=`echo $x | sed 's_^[ ]*\([0-9]*\) [0-9].*_\1_'`; test $TEST -gt 100 && (grep -qxF "ALL: $IP" /etc/hosts.deny || sudo bash -c "echo 'ALL: $IP' >> /etc/hosts.deny ") ; done
@bmvakili
bmvakili / README.md
Created March 31, 2019 15:07 — forked from kui/README.md
Eclipse Shortcut for Ubuntu

Eclipse Shortcut for Ubuntu Unity

a shortcut to run Eclipse on Ubuntu Unity and to register Eclipse with the left Launcher

Installation

@bmvakili
bmvakili / Dockerfile
Last active July 13, 2019 07:51
liferay frontend development via docker container
FROM ubuntu
RUN apt-get update && \
apt-get -y install curl software-properties-common && \
curl -sL https://deb.nodesource.com/setup_12.x | bash - && \
apt-get update && \
apt-get -y install nodejs && \
useradd -m -s $(which bash) liferay && \
chown -R liferay:liferay /usr/lib/node_modules
@bmvakili
bmvakili / MyAction.java
Created July 24, 2019 08:43 — forked from rotty3000/MyAction.java
MyAction
package com.liferay.events;
import aQute.bnd.annotation.component.Activate;
import aQute.bnd.annotation.component.Component;
import aQute.bnd.annotation.component.Deactivate;
import com.liferay.portal.kernel.events.ActionException;
import com.liferay.portal.kernel.events.SimpleAction;
/**