Sunday, September 30, 2018
Thursday, September 27, 2018
Need sudo in order to save
If you are editing a file without sudo, and you need sudo in order to save, simply use this vim command
:w !sudo tee %
Monday, September 24, 2018
Dumping and importing from/to MySQL in an UTF-8 safe way
Dumping safely
# Do not do this, since it might screw up encoding
mysqldump -uroot -p database > utf8.dump # this is bad
Better do:
mysqldump -uroot -p database -r utf8.dump
Note that when your MySQL server is not set to UTF-8 you need to do
mysqldump --default-character-set=latin1
(!) to get a correctly encoded dump. In that case you will also need to remove the SET NAMES='latin1'
comment at the top of the dump, so the target machine won't change its UTF-8 charset when sourcing.
If you only want to dump the structure without data, use
mysqldump -uroot -p --no-data database -r utf8.dump
Importing a dump safely
# Do not do this, since it might screw up encoding
mysql -u username -p database < dump_file # this is bad
Better do:
mysql -uroot -p --default-character-set=utf8 database
mysql> SET names 'utf8'
mysql> SOURCE utf8.dump
https://makandracards.com/makandra
Saturday, September 22, 2018
Java 8 for ubuntu18.04, Java SE 8 (LTS), Extended Support Until March 2025
sudo apt-get install oracle-java8-installer sudo apt-get install oracle-java8-set-default sudo update-alternatives --config java sudo update-alternatives --config java java -version javac -versionAt the end of this file, add the following line, making sure to replace the highlighted path with your own copied path:
sudo vim /etc/environmentJAVA_HOME="/usr/lib/jvm/java-8-oracle/jre/bin/java/"
echo $JAVA_HOME/usr/lib/jvm/java-8-oracle/jre/bin/java/
Thursday, September 20, 2018
Kill ssh sessions
ps -ef | grep sshd | grep -v root | grep -v 12345 | grep -v grep | awk '{print "sudo kill -9", $2}' |sh
Thursday, September 13, 2018
Search in gz and plain files recursively
reset;\ find -name \*.log -print0 | xargs -0 grep "delete from"; \ find -name \*.gz -print0 | xargs -0 zgrep "delete from";
Subscribe to:
Posts (Atom)
Git get all remote branches
git branch -r \ | grep -v '\->' \ | sed "s,\x1B\[[0-9;]*[a-zA-Z],,g" \ | while read remote; do \ git branc...
-
sh -c 'xfce4-screenshooter --fullscreen --save "$HOME/Pictures/Screenshots/Screenshot_$(date +%Y-%m-%d_%H:%M:%S).png"' s...
-
Known Issues Firefox 3.5 will only support color profiles as specified by ICC v2, later versions will add su...