Skip to content

Instantly share code, notes, and snippets.

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

Aleksandar Pavić acosonic

💭
I may be slow to respond.
View GitHub Profile
@acosonic
acosonic / sysbench.sh
Last active April 22, 2021 21:40
Sysbench install and automatically create and test mysql database speed (read test) (first install sysbench apt install -y sysbench)
#!/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 February 23, 2021 07:35
Fix Acrobat DC digital sign/protect crashing issue
#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 February 7, 2021 07:52
MySql All databases backup and copy to S3
#!/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 January 17, 2021 11:05
Robots disallow everything must have for development websites
User-agent: *
Disallow: /
@acosonic
acosonic / pdftess.sh
Created January 11, 2021 15:57
Pdf Sandwich and Tesseract OCR Ubuntu 18/20 Install
#!/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 March 22, 2021 06:51
Ubuntu development machine installations
#!/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
@acosonic
acosonic / bloatware.ps
Last active November 29, 2022 10:58
Windows 10 removal of bloatware
Write-Host "Disabling UAC"
Set-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System' -Name EnableLUA -Value 0
Write-Host "Disabling screen off on AC"
powercfg -change -monitor-timeout-ac 0
Write-Host "Disabling auto update"
## Stop Windows Update
Stop-Service -Name wuauserv
@acosonic
acosonic / vmove.sh
Last active August 5, 2020 09:29
Virtualmin quickmove
#!/bin/bash
echo "This script zips everything in home directory and etc"
shopt -s dotglob
read -n 1 -p "Please enter mysql root password:" rootpw
mkdir -p /move/databases
cd /move/databases
mysql -uroot -p$rootpw -N -e 'show databases' | while read dbname; do mysqldump -uroot -p$rootpw --complete-insert --some-other-options "$dbname" > "$dbname".sql; done
tar -zcvf databases.tgz *.sql
rm *.sql
tar -zcvf home.tgz /home/
git pull --rebase --autostash
#upload local keys for key based authorization
cat ~/.ssh/id_rsa.pub | ssh [email protected] 'cat >> .ssh/authorized_keys'
@acosonic
acosonic / default_not_set.sql
Created February 28, 2020 18:43
Determining all field and table names and details from MYSQL database where default value is not set
select * from information_schema.columns
where table_schema = 'my_schema' and COLUMN_DEFAULT IS NULL
order by table_name,ordinal_position