Skip to content

Instantly share code, notes, and snippets.

View dobrivoje's full-sized avatar
🎯
Focusing

Dobrivoje dobrivoje

🎯
Focusing
View GitHub Profile
@dobrivoje
dobrivoje / baze.bat
Last active January 29, 2017 07:17
Googlesync Windows batch script
'version 29.1.2017 8:13
'NOTICE :
'Nor files neither folder should contain "space" in their names
'since the script will ommit characters after the first space occurence in it's name
'in "%%~nF.7z"
'7zip execution folder
set comdir=C:\Program Files\7-Zip
@dobrivoje
dobrivoje / nagios.
Created February 24, 2017 14:06
Ubuntu Linux - Nagios Nagios Setup - Part 1
sudo apt-get update
sudo apt-get install build-essential libgd2-xpm-dev openssl libssl-dev xinetd apache2-utils unzip
sudo useradd nagios
sudo groupadd nagcmd
sudo usermod -a -G nagcmd nagios
apt-get update
apt-get install build-essential libgd2-xpm-dev openssl libssl-dev xinetd apache2-utils unzip
cd /tmp/
tar xvf nagios-plugins-2.1.1.tar.gz
@dobrivoje
dobrivoje / pg_restore_single_cpu.sh
Created March 21, 2017 10:25
PostgresSQL Server Database Restore - Single processor
#!/bin/bash
CLIENT=" <description for the client who we make backup for> "
SRC_IP_ADD= <ip_address>
SRC_NAS_BACKUP="/backup-nas"
DST_PG_BACKUP="/tmp/postgres/backuprestore"
NAS_BACKUP_DB="backup-db"
### Operational directory, eg. if we have ssd drive, opinting to it, will
### significally make process faster !
#!/bin/bash
BACKUP_DIR="/backup-nas/backup-db/"
PGHOST="localhost"
PGUSER="postgres"
PGPASSWORD="<enter password here>"
SERVER_IP_ADDRESS=10.100.129.212
BACKUP_LOCATION=/HosDB/backup/on2hour
DATABASE_NAME=retailconnect
### !/bin/bash
CLIENT="Server name"
DBNAME="postgres_database_Name"
POSTGRESAUTH="postgres"
PGPASSWORD="db password"
MODE=full
TO1="[email protected]"
TO2="[email protected]"
SUBJ="$CLIENT, baza: $DBNAME, full vacuum završen"
### We're installing dependencies (certutils commdand)
### based on the fantastic explanation covered here : https://coderwall.com/p/ez1x2w/send-mail-like-a-boss
apt-get install libnss3-tools
mkdir certs
### optional
chown -R root:tomcat certs/
chmod 770 -R certs/
certutil -N -d certs/
@dobrivoje
dobrivoje / gist:f6ead0d9efc91c6d62739d5a91a8e5ca
Last active April 21, 2017 08:59
Linux - Multi cpu compression of (large) postgresql database backup(s)
###########################################################
# fast compression of the big postgresql backup file #
# we'll take advantage of the multi processor machine #
# to speedup compression process ! #
# #
# reqirement : apt-get install pigz (ubuntu/debian like) #
###########################################################
# input parameter1 = <entire folder to compress>
# input parameter2 = $CPU_NO
@dobrivoje
dobrivoje / Netbeans 8.2, Windows10 64-bit - Smooth Work
Created March 19, 2018 12:06
Netbeans 8.2, Windows10 64-bit - Smooth Work
Just to mention that I work on Intel i5 and Windows10-64bit.
I tried literally everything. After one of those system updates, my Netbeans 8.2 influenced a system to be very slow, almost to the point of unresponsiveness. During NB startup or build, system is practically unresponsive.
So, all possible tweaks both Netbeans and Java, couldn't solve a problem.
It seems that Windows update itself trigger off a problem to happen, as updates did changes on low system level, I suppose.
I decided to lower a Netbeans PID, by creating new shortcut like this :
cmd.exe /c start "Netbeans 8.2 LowPrio" /Low "C:\Program Files\NetBeans 8.2\bin\netbeans64.exe"
For now I can work without disruption, and it's far more smoother, than before.
@dobrivoje
dobrivoje / servers-restart.sh
Created December 22, 2018 14:31
Linux Servers Restart Script
#!/bin/bash
SERVER_DESCRIPTION="Nis Test"
LOG_RESTART="/root/scripts/logs/restart.log"
clear
printf "\n\n\n"
printf "Please, choose server to restart.\n
Available servers : \n
[1] Tomcat\n[2] TomcatDM\n[3] PostgresSQL