Skip to content

Instantly share code, notes, and snippets.

View user454322's full-sized avatar
💭
I may be slow to respond.

Javier user454322

💭
I may be slow to respond.
View GitHub Profile
@user454322
user454322 / iwlwifi.conf
Last active December 27, 2015 09:19
/etc/modprobe.d/iwlwifi.confwireless
#13.04
options iwlwifi bt_coex_active=0 11n_disable=1
#14.04
options iwlwifi 11n_disable=8
#11n_disable:disable 11n functionality, bitmap: 1: full, 2: disable agg TX, 4: disable agg RX, 8 enable agg TX (uint)
@user454322
user454322 / tomcat
Created October 30, 2013 09:30
Tomcat script
#!/bin/bash
# description: Tomcat Start Stop Restart
# chkconfig: 345 82 25
export JAVA_HOME="/usr/lib/jvm/java"
export PATH="${JAVA_HOME}/bin:${PATH}"
CATALINA_HOME="/opt/tomcat/tomcat-7.0.47"
case $1 in
start)
/bin/su tomcat -c "${CATALINA_HOME}/bin/startup.sh"
@user454322
user454322 / SSH iptables chain
Created July 25, 2013 02:38
iptables chain to restrict SSH login attempts
#!/bin/sh
#-- Creates a SSH-fal chain
/sbin/iptables -N SSH-fal
#-- Only 3 login attempts can be done from the same IP whithin a minute
/sbin/iptables -A SSH-fal -p tcp --dport 22 -m state --state NEW -m recent --set --name SSH
/sbin/iptables -A SSH-fal -p tcp --dport 22 -m state --state NEW -m recent --update --seconds 60 --hitcount 2 --rttl --name SSH -j LOG --log-prefix "IPTABLES: failed login attempt"
/sbin/iptables -A SSH-fal -p tcp --dport 22 -m state --state NEW -m recent --update --seconds 60 --hitcount 3 --rttl --name SSH -j DROP
#!/bin/sh
policy=${HOME}/.jstatd.all.policy
[ -r ${policy} ] || cat >${policy} <<'POLICY'
grant codebase "file:${java.home}/../lib/tools.jar" {
permission java.security.AllPermission;
};
POLICY
jstatd -J-Djava.security.policy=${policy} &
#!/usr/bin/env bash
set -o nounset
set -o errexit
#
#----Settings
#
readonly DEFAULT_APP_DIR="/tmp/logs_dir"
# DEFAULT_MAX_SIZE in MB. Files bigger than MAX_SIZE are not compressed
readonly DEFAULT_MAX_SIZE="1"
@user454322
user454322 / gist:5610855
Created May 20, 2013 07:29
Monitor the number of PostgreSQL connections
#! /bin/sh
# Configurarion
DBHOST="127.0.0.1"
DBPORT="5432"
DBNAME="as_3_7_5"
PGUSER="postgres"
PGPASSWORD="a"
PGSQL_CMD="/usr/bin/psql"
AS_SERVER="127.0.0.1"
@user454322
user454322 / git-info.sh
Last active April 28, 2016 05:54 — forked from shrwnsan/.profile
git similar to svn info.From stechico
#!/usr/bin/env bash
# author: Duane Johnson
# email: duane.johnson@gmail.com
# date: 2008 Jun 12
# license: MIT
#
# Based on discussion at http://kerneltrap.org/mailarchive/git/2007/11/12/406496
pushd . >/dev/null
bad_names=["threadList","handleSuspend","handleDisturb","handleDisturbAction","handleFollowParent","handleFollowChild","handleDisturbSession","handleResume","handleStatus","setBreakPoint","deleteBreakPoint","handleBreak","handleBreak","handleClear","setCommonBreakPoint","handleCommonBreak","handleContinue","handlePrint","handleExec","handleUp","handleDown","handleUp","handleStep","handleNext","handleReturn","handleWhere"]
bad_names.each{|name|
good = String.new(name)
name.split("").each{|charr|
if(charr =~ /[A-Z]/)
good.gsub!(charr,"_"+charr.downcase)
end
}
@user454322
user454322 / ip_js.html
Created October 20, 2012 21:29
getting IP info with JavaScript
<html>
<head>
<script type="text/javascript">
function getLocalIP(){
var yip2=java.net.InetAddress.getLocalHost();
var yip=yip2.getHostAddress();
document.getElementById("ip_addr").innerHTML=yip;
}
var ipx ="ERROR"
@user454322
user454322 / .vimrc
Created October 12, 2012 19:50
Vim rc November 2012
set sw=4
set sts=4
set et
set autoindent
set smartindent
set incsearch
set ignorecase
set smartcase
set backspace=indent,eol,start
set vb