Window Manager Script for KDE Plasma! - Krohnkite
On KDE Ubuntu 20.04
Install vie Kwin Script in Settings > Window Management
Enable User configation
mkdir -p ~/.local/share/kservices5/
ln -s ~/.local/share/kwin/scripts/krohnkite/metadata.desktop ~/.local/share/kservices5/krohnkite.desktop
Postman set access token in Test
pm.test("Status test", function () {
var jsonBody = pm.response.jsonBody
pm.environment.set('access_token', jsonBody.access_token)
});
cron job for mysql db backup
#!/bin/bash
PASS="$(cat /root/etc/mysqlpass)"
$DBNMAE="website_db"
mysqldump -u root -p$PASS $DBNMAE | gzip > "/home/ubuntu/db_backup/website_db_`date '+%Y-%m-%d'`.sql.gz"
Wordpress `wp-config.php` comman conf
error_reporting(E_ERROR);
define('WP_ENV', 'production');
define('WP_SITEURL', 'http://website.com/');
define('WP_HOME', 'http://website.com/');
define('WP_DEBUG', true);
define('WP_DEBUG_LOG', true);
define('WP_DEBUG_DISPLAY', false);
wp config create --dbname=wp_db --dbuser=root --dbpass=root
wp core download
wp config create --dbname=wp_db --dbuser=root --dbpass=root
wp core install --url=http://website.com/ --title="Website on WP" --admin_user=admin --admin_password="admin" --admin_email="admin@website.com"
wp theme a...
Common Ubuntu 20.04 LEMP stack setup commands
Install required packages
sudo add-apt-repository universe
sudo apt update && sudo apt dist-upgrade && sudo apt autoremove
sudo apt-get install -y build-essential nginx git redis-server wget htop apache2-utils unzip mysql-server nginx mysql-client certbot
sudo apt-get install -y php7.4-fpm php7.4-curl php7.4-intl php7.4-mysql php7.4-opcache php7.4-xml php7.4-zip php7.4-common php7.4-cli php7.4-dev php7.4-mbstring php7.4-json php7.4-readline php7.4-soap php7.4-sqlite3 php7.4-gd php7.4-cli
sudo apt-get install -y php-redis php-memcac...
Ubutnu 20.04 - Update mysql 8 root password
from bash terminal login as root user
sudo su
mysql
From MySQL cli change password
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'your_password_here';
flush privileges;
bashrc mininal with git, android studio, yarn, nvm
export PATH=~/.local/bin:$PATH
export PATH=~/bin:$PATH
function parse_git_branch () {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}
RED="\[\033[0;31m\]"
YELLOW="\[\033[0;33m\]"
GREEN="\[\033[0;32m\]"
NO_COLOR="\[\033[0m\]"
PS1="\n$GREEN$NO_COLOR\w$YELLOW\n\$(parse_git_branch)$NO_COLOR\$ "
#export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
export JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64
export JAVA_OPTS='-Djavax.net.ssl.trustStore=/usr/lib/jvm/java-11-openjdk-amd64/jre/lib/security/cacerts -Djav...
Ssh Tunnel
To open up a SOCKS proxy on port 8080, run
ssh -C2qTnN -D 8080 your-user@example.com
To configure Firefox to use the proxy go to Edit → Preferences → Advanced → Network → Settings and enable ‘Manual proxy configuration’
https://possiblelossofprecision.net/?p=2111
Ubuntu Gnome Linux set primary monitor using command line
xrandr --output VGA1 --primary --left-of LVDS1
here VGA1 is monitor and LVDS1 is laptop screen
List all ips address from apache access log
grep Apr/2014 /var/log/apache2/access.log | awk '{ print $1 }' | sort -n | uniq -c | sort -rn
Show current git branch in bash prompt
## show current git branch in bash prompt
export PS1='\[\033[01;32m\]\h\[\033[01;34m\] \w\[\033[31m\]$(__git_ps1 "(%s)") \[\033[01;34m\]$\[\033[00m\] '
add above code in ~/.bashrc at your home folder
Awesome PHP
A list of amazingly awesome PHP libraries, resources and shiny things.
https://gist.github.com/ziadoz/1677679
Good Jokes
http://imgs.xkcd.com/comics/excessive_quotation.png
@ xkcd.com
Add empty directory in git
create file name .gitignore in directory and add following code
# Ignore everything in this directory
*
# Except this file
!.gitignore
Disable event tag as doctrine.event_subscriber from Symfony 2
In controller
$em = $this->getDoctrine()->getManager();
$evm = $em->getEventManager();
$evm->removeEventSubscriber($this->get('service.taged.as.doctrine.event_subscriber '));
Symfony2 Kickstart
Symfony 2 Kickstart
Install symfony2 with composer.phar
composer.phar create-project symfony/framework-standard-edition demoproject
HOW TO SHUTDOWN WITHOUT SUDO PASSWORD (ubuntu, debian)
in /etc/sudoer add following line
username ALL = NOPASSWD: /sbin/shutdown
also to allow at group level
%admin ALL = NOPASSWD: /sbin/shutdown
now one can use shutdown command without sudo password, but shutdown command still needs sudo command like
sudo shutdown -h now
How to use rsync
rsync --verbose --links --delete-excluded -ae ssh /var/www/myfolder/* user@ipaddress:/var/www/myfolder
copies only new files according to date/time
symbolic links are not followed
Git : Pretty Good
git config --global color.ui true
git config --global alias.br branch
git config --global alias.co checkout
git config --global alias.st status
git config credential.helper 'cache'
git config credential.helper 'cache --timeout=31536000'
// to unset
git config --unset credential.helper
More
SSH Key Fingerprint on Linux
open terminal and fire this command
ssh-keygen -lf ~/.ssh/id_rsa.pub
output
2048 a3:2e:72:c3:2d:b4:55:97:6e:7c:27:9f:97:75:3d:e7 /home/username/.ssh/id_rsa.pub (RSA)
Mysql Dump
mysqldump -u username -p -v olddatabase > olddbdump.sql
mysqladmin -u username -p create newdatabase
mysql -u username -p newdatabase < olddbdump.sql