Skip to content

Instantly share code, notes, and snippets.

View girishsalaskar's full-sized avatar
🏡
Learning python and investment automation

Girish Salaskar girishsalaskar

🏡
Learning python and investment automation
View GitHub Profile
@girishsalaskar
girishsalaskar / shellScript.sh
Last active February 5, 2020 10:53
Import multiple db files from folder into mysql db (Details : https://codewander.blogspot.com/2020/02/import-multiple-db-files-from-folder.html)
for fileName in `ls /path/to/db/files/dir`;
do
echo "Importing - $fileName";
mysql --user=root --password --host=127.0.0.1 --port=3306 dbName < /path/to/db/files/dir/$fileName;
done;
@girishsalaskar
girishsalaskar / MyClass.java
Last active February 5, 2020 10:55
The final object demonstration (Description is here : https://codewander.blogspot.com/2020/01/the-final-keyword-in-java.html)
import java.awt.Point;
public class MyClass {
static final Point p = new Point(0,0);
public static void main(String args[]) {
p.x = 10; //Will run successful
System.out.println(p);
p = new Point(10,0); // Will give compile time error
}
}
for T in `mysql -h <host>-P 3306 -uroot -p -N -B -e 'show tables from YOURDBNAME'`
do
echo "Backing up - $T"
mysqldump --skip-comments --compact -h 127.0.0.1 -P 3306 -uroot -p YOURDBNAME $T > /path/to/destination/folder/$T.sql
done;
@girishsalaskar
girishsalaskar / update.sql
Last active December 14, 2019 03:34
Messed up varchar after/before importing into mysql db (See more here : https://codewander.blogspot.com/2019/12/recover-messed-uplost-utf-8-characters.html )
UPDATE tblName set varcharCol = CONVERT(CAST(varcharCol AS BINARY) USING utf8) where pid=1;