Skip to main content

Common Command

Mysql: Create database with default character set, encoding:
create database DB_NAME default character set utf8 default collate  utf8_general_ci;
import
mysql -u root -p DB_NAME < dump.sql

mysql -u root -p DB_NAME < dump.sql
/Application/MAMP/Library/bin/mysql

/Application/MAMP/Library/bin/mysqlimport
MAMP (MAC OSX + Apache + Mysql + PHP) PostgreSQL Others Export:
mysqldump -u root -p Tutorials > 
tut_backup.sql
Dump a table in DB:
$ mysqldump -u root -p Tutorials php_tutorials asp_tutorials > tut_backup.sql

Link stackoverflow how-do-you-mysqldump-specific-tables

Dump many DB :
mysqldump -u root -p --databases Tutorials Articles Comments > 
content_backup.sql
mysql> GRANT ALL PRIVILEGES ON *.* TO 'monty'@'localhost'

 ->     IDENTIFIED BY 'some_pass' WITH GRANT OPTION;

mysql> GRANT ALL PRIVILEGES ON *.* TO 'monty'@'%'

 ->     IDENTIFIED BY 'some_pass' WITH GRANT OPTION;

mysql> GRANT RELOAD,PROCESS ON *.* TO 'admin'@'localhost';

mysql> GRANT USAGE ON *.* TO 'dummy'@'localhost';

mysql> SHOW GRANTS FOR 'admin'@'localhost';


https://dev.mysql.com/doc/refman/4.1/en/adding-users.html

mysql-adding-users

------------------------------ BASH -----------------------------------
for i in *.JPG; do convert $i -resize 10% $(basename $i .JPG).jpg; done
ffmpeg -i video.mkv -map 0:1 -acodec pcm_s16le -ac 2 audio.wav

Comments

  1. for a in *.png*; do mv -i $a ${a%\.png*}`identify -format '%w' $a`.png; done
    Rename image base on dimension.
    Doi ten anh theo size.

    ReplyDelete
  2. pdftk in.pdf burst
    split a multi-page PDF into separate files

    ReplyDelete
  3. gs -dBATCH -dNOPAUSE -sDEVICE=pdfwrite -dFirstPage=2 -dLastPage=2 -sOutputFile=page2.pdf multipageinputfile.pdf

    ReplyDelete
  4. for file in *.jpg; do echo $file; done ....

    ReplyDelete
  5. for i in *.JPG; do convert $i -resize 10% $(basename $i .JPG).jpg; done
    ffmpeg -i video.mkv -map 0:1 -acodec pcm_s16le -ac 2 audio.wav

    ReplyDelete
  6. killall -u pu -m .
    where pu is my userid. Watch the dot at the end of the command.
    Get user id:
    id -u 'zend' (zend is example)

    ReplyDelete
  7. #!/bin/bash
    FEATURE_FRONT_BRANCH="feature/"
    FEATURE_FRONT_BRANCH+="$1"
    git checkout $FEATURE_FRONT_BRANCH

    ReplyDelete
  8. ffmpeg -i music_loud.wav -c:a libvorbis -qscale:a 5 music_loud.ogg

    ogg nhẹ hơn wav nhiều nhưng kn chất lượng giảm (cần test xem giảm bn).

    Volume ko rõ có bị a/h.
    Thử cho -acodec copy xem.
    good luck.

    ReplyDelete
  9. alias cl='clear && ls'
    alias chm7='chmod -R 777 '

    ReplyDelete
  10. git rm $(git ls-files --deleted)

    ReplyDelete
  11. :%s/<\/message>/\,/gc
    or
    :%s/<\/message>/\,/g

    replace with ,

    ReplyDelete
  12. sudo apt-get install linux-headers-$(uname -r)
    uname -r lấy ra bản kernel linux đang dùng

    ReplyDelete
  13. find . -type f -perm 664 -print -exec chmod 644 {} \;

    ReplyDelete
  14. http://www.cyberciti.biz/tips/how-do-i-enable-remote-access-to-mysql-database-server.html
    Mysql create User, enable Ip ...

    ReplyDelete
  15. http://khoanguyen.me/xoa-tat-ca-cac-table-mysql/

    ReplyDelete
  16. chown nobody:nogroup /opt/lampp/logs/query.log

    ReplyDelete
  17. Mix variable in loop (cool in command line)
    $for file in *.mp4 i=0; do echo $file; echo $((i++)) ; done

    ReplyDelete
  18. i=0 && for file in *.mp4; do ffmpeg -i $file -filter:v "crop=852:480:0:0" -strict -2; rm $file; done;
    i=0 && for reset i variable.
    If you type i=0 => Enter. then you echo $i it will display 0 in your bash session as a variable.
    So you need reset it to 0, otherwise it will increase over and over.
    $(basename $file.mp4) is DIFFERENT with $(basename "$filename")
    $(basename $file.mp4) only return basename (not extension) and not FULL NAME, ie. LOL_one (001).mp4 will return ONLY LOL_one.
    Instead $(basename "$file") will return full name of your file: ie. LOL_one (001).mp4, no extension can be extract this way.

    -strict -2 : some older ffmpeg version need this to avoid some error.

    ReplyDelete
    Replies
    1. ffmpeg missing output name $(basename $file.mp4)_cropped.mp4

      Delete
  19. i=0 && for file in cute_[0-9].png; do mv $file cute_00$((i++)).png; done
    i=10 && for file in cute_[0-9][0-9].png; do mv $file cute_0$((i++)).png;

    ReplyDelete
  20. http://www.itforeveryone.co.uk/image-to-video.html

    ReplyDelete
  21. http://superuser.com/questions/533695/how-can-i-convert-a-series-of-png-images-to-a-video-for-youtube

    ReplyDelete

Post a Comment

Popular posts from this blog

Rand mm 10

https://stackoverflow.com/questions/2447791/define-vs-const Oh const vs define, many time I got unexpected interview question. As this one, I do not know much or try to study this. My work flow, and I believe of many programmer is that search topic only when we have task or job to tackle. We ignore many 'basic', 'fundamental' documents, RTFM is boring. So I think it is a trade off between the two way of study language. And I think there are a bridge or balanced way to extract both advantage of two method. There are some huge issue with programmer like me that prevent we master some technique that take only little time if doing properly. For example, some Red Hat certificate program, lesson, course that I have learned during Collage gave our exceptional useful when it cover almost all topic while working with Linux. I remember it called something like RHEL (RedHat Enterprise Linux) Certificate... I think there are many tons of documents, guide n books about Linux bu

Martin Fowler - Software Architecture - Making Architecture matter

  https://martinfowler.com/architecture/ One can appreciate the point of this presentation when one's sense of code smell is trained, functional and utilized. Those controlling the budget as well as developer leads should understand the design stamina hypothesis, so that the appropriate focus and priority is given to internal quality - otherwise pay a high price soon. Andrew Farrell 8 months ago I love that he was able to give an important lesson on the “How?” of software architecture at the very end: delegate decisions to those with the time to focus on them. Very nice and straight-forward talk about the value of software architecture For me, architecture is the distribution of complexity in a system. And also, how subsystems communicate with each other. A battle between craftmanship and the economics and economics always win... https://hackernoon.com/applying-clean-architecture-on-web-application-with-modular-pattern-7b11f1b89011 1. Independent of Frameworks 2. Testable 3. Indepe