Skip to content

Instantly share code, notes, and snippets.

Avatar

Aleksandar Pavić acosonic

View GitHub Profile
@acosonic
acosonic / my.sh
Created Sep 1, 2021
Mysql reinstall and delete everything start from scratch
View my.sh
#!/bin/bash
apt-get --yes --force-yes remove --purge mysql*
apt-get --yes --force-yes purge mysql*
apt-get --yes --force-yes autoremove
apt-get --yes --force-yes autoclean
apt-get --yes --force-yes remove dbconfig-mysql
rm -rf /etc/mysql
rm -rf /var/lib/mysql
apt-get --yes --force-yes install mysql-server
@acosonic
acosonic / pythonmysql.sh
Last active May 9, 2021
Installing python2 and python2 pip on Ubuntu 20.04 with mysql support second part of this script is installing requirements for Redmine SVN Authentication
View pythonmysql.sh
#!/bin/bash
apt install python python2-dev default-libmysqlclient-dev build-essential
wget https://bootstrap.pypa.io/pip/2.7/get-pip.py
python2 get-pip.py
wget https://raw.githubusercontent.com/paulfitz/mysql-connector-c/master/include/my_config.h -O /usr/include/mysql/my_config.h
pip2 install MySQL-python
echo 'Installing Redmine SVN Auth (considering mod_dav is already installed'
pip2 install redmine-auth
apt install libapache2-mod-wsgi
@acosonic
acosonic / index.php
Created Apr 28, 2021
Geopattern under construction generic PHP website based on https://github.com/erengy/under-construction meant to be used via wget in public_html folder
View index.php
<html>
<head>
<title><?php echo($_SERVER['HTTP_HOST']);?></title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.2.3/jquery.min.js"></script> <!-- optional -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/geopattern/1.2.3/js/geopattern.min.js"></script>
<style type="text/css">
html, body {
height: 100%;
}
body {
@acosonic
acosonic / renewssl.sh
Created Apr 7, 2021
Virtualmin renew all letsencrypt certificates for hosts having SSL
View renewssl.sh
#!/bin/sh
doms=`virtualmin list-domains --with-feature ssl --name-only`
for dom in $doms; do
virtualmin generate-letsencrypt-cert --domain $dom --renew 2 --web --default-hosts
done
@acosonic
acosonic / sysbench.sh
Last active Apr 22, 2021
Sysbench install and automatically create and test mysql database speed (read test) (first install sysbench apt install -y sysbench)
View sysbench.sh
#!/bin/bash
mysql -u $1 -p$2 -h$3 -e "create database foo"
sysbench --db-driver=mysql --mysql-user=$1 --mysql-password=$2 --mysql-host=$3 --mysql-db=foo --range_size=100 --table_size=10000 --tables=2 --threads=1 --events=0 --time=60 --rand-type=uniform /usr/share/sysbench/oltp_read_only.lua prepare
sysbench --db-driver=mysql --mysql-user=$1 --mysql-password=$2 --mysql-host=$3 --mysql-db=foo --range_size=100 --table_size=10000 --tables=2 --threads=1 --events=0 --time=60 --rand-type=uniform /usr/share/sysbench/oltp_read_only.lua run
@acosonic
acosonic / acro.ps1
Last active Feb 23, 2021
Fix Acrobat DC digital sign/protect crashing issue
View acro.ps1
#app is still in development
$app = Get-WmiObject -Class Win32_Product | Where-Object {
$_.Name -match "Acrobat Reader DC"
}
$app.Uninstall()
Get-ChildItem "C:\Users\*\AppData\Local\Adobe\Acrobat\*" -Directory | Remove-Item -Recurse -Force
Get-ChildItem "C:\Users\*\AppData\LocalLow\Adobe\Acrobat\*" -Directory | Remove-Item -Recurse -Force
@acosonic
acosonic / mysql2s3.sh
Last active Feb 7, 2021
MySql All databases backup and copy to S3
View mysql2s3.sh
#!/bin/bash
# Shell script to backup all MySQL databases and copy to s3
# It also deletes old files. Fill below values for configuration
# Make sure you have AWS CLI installed and configured!!!
# Set these variables
MyUSER="" # DB_USERNAME
MyPASS="" # DB_PASSWORD
MyHOST="" # DB_HOSTNAME
@acosonic
acosonic / robots.txt
Created Jan 17, 2021
Robots disallow everything must have for development websites
View robots.txt
User-agent: *
Disallow: /
@acosonic
acosonic / pdftess.sh
Created Jan 11, 2021
Pdf Sandwich and Tesseract OCR Ubuntu 18/20 Install
View pdftess.sh
#!/bin/bash
apt install tesseract-ocr tesseract-ocr-eng
wget https://pdfsandwich.s3.amazonaws.com/pdfsandwich_0.1.7_amd64.deb
apt-get -fy install ./pdfsandwich_0.1.7_amd64.deb
sed -i 's/rights=\"none\"/rights=\"read\|write\"/g' /etc/ImageMagick-6/policy.xml
@acosonic
acosonic / devmachine.sh
Last active Mar 22, 2021
Ubuntu development machine installations
View devmachine.sh
#!/bin/bash
echo "This script installs some of common software for Ubuntu 20 linux"
echo "Script is intended to be run as sudo or root"
add-apt-repository ppa:atareao/telegram
#wget -O ~/viber.deb https://download.cdn.viber.com/cdn/desktop/Linux/viber.deb
#dpkg -i viber.deb
tee /etc/apt/sources.list.d/pritunl.list << EOF
deb https://repo.pritunl.com/stable/apt focal main
EOF