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

AWS Elasticache Memcached connection

https://docs.aws.amazon.com/AmazonElastiCache/latest/mem-ug/accessing-elasticache.html#access-from-outside-aws http://hourlyapps.blogspot.com/2010/06/examples-of-memcached-commands.html Access memcached https://docs.aws.amazon.com/AmazonElastiCache/latest/mem-ug/GettingStarted.AuthorizeAccess.html Zip include hidden file https://stackoverflow.com/questions/12493206/zip-including-hidden-files phpmemcachedadmin ~ phpMyAdmin or phpPgAdmin ... telnet mycachecluster.eaogs8.0001.usw2.cache.amazonaws.com 11211 stats items stats cachedump 27 100 https://docs.aws.amazon.com/AmazonElastiCache/latest/mem-ug/VPCs.EC.html https://lzone.de/cheat-sheet/memcached VPC ID Security Group ID (sg-...) Cluster: The identifier for the cluster memcached1 Creation Time: The time (UTC) when the cluster was created January 9, 2019 at 11:47:16 AM UTC+7 Configuration Endpoint: The configuration endpoint of the cluster memcached1.ahgofe.cfg.usw1.cache.amazonaws.com:11211 St...

Notes Windows 10 Virtualbox config, PHP Storm Japanese, custom PHP, Apache build, Postgresql

 cmd => Ctrl + Shift + Enter mklink "C:\Users\HauNT\Videos\host3" "C:\Windows\System32\drivers\etc\hosts" https://www.quora.com/How-to-create-a-router-in-php https://serverfault.com/questions/225155/virtualbox-how-to-set-up-networking-so-both-host-and-guest-can-access-internet 1 NAT + 1 host only config https://unix.stackexchange.com/questions/115464/how-to-properly-set-up-2-network-interfaces-in-centos-running-in-virtualbox DEVICE=eth0 TYPE=Ethernet #BOOTPROTO=dhcp BOOTPROTO=none #IPADDR=10.9.11.246 #PREFIX=24 #GATEWAY=10.9.11.1 #IPV4_FAILURE_FATAL=yes #HWADDR=08:00:27:CC:AC:AC ONBOOT=yes NAME="System eth0" [root@localhost www]# cat /etc/sysconfig/network-scripts/ifcfg-eth1 # Advanced Micro Devices, Inc. [AMD] 79c970 [PCnet32 LANCE] DEVICE=eth1 IPADDR=192.168.56.28 <= no eff => auto like DHCP #GATEWAY=192.168.56.1 #BOOTPROTO=dhcp BOOTPROTO=static <= no eff ONBOOT=yes HWADDR=08:00:27:b4:20:10 [root@localhost www]# ...

Rocket.Chat DB schema

_raix_push_notifications avatars.chunks avatars.files instances meteor_accounts_loginServiceConfiguration meteor_oauth_pendingCredentials meteor_oauth_pendingRequestTokens migrations rocketchat__trash rocketchat_cron_history rocketchat_custom_emoji rocketchat_custom_sounds rocketchat_import rocketchat_integration_history rocketchat_integrations rocketchat_livechat_custom_field rocketchat_livechat_department rocketchat_livechat_department_agents rocketchat_livechat_external_message rocketchat_livechat_inquiry rocketchat_livechat_office_hour rocketchat_livechat_page_visited rocketchat_livechat_trigger rocketchat_message rocketchat_oauth_apps rocketchat_oembed_cache rocketchat_permissions rocketchat_raw_imports rocketchat_reports rocketchat_roles rocketchat_room rocketchat_settings rocketchat_smarsh_history rocketchat_statistics rocketchat_subscription rocketchat_uploads system.indexes users usersSessions https://rocket.chat/docs/developer-guides/sc...