Skip to content

Instantly share code, notes, and snippets.

View makeittotop's full-sized avatar

abhishek pareek makeittotop

  • Canada
  • 23:06 (UTC -07:00)
View GitHub Profile
@makeittotop
makeittotop / jq to filter by value.md
Created May 19, 2020 01:53 — forked from ipbastola/jq to filter by value.md
JQ to filter JSON by value

JQ to filter JSON by value

Syntax: cat <filename> | jq -c '.[] | select( .<key> | contains("<value>"))'

Example: To get json record having _id equal 611

cat my.json | jq -c '.[] | select( ._id | contains(611))'

Remember: if JSON value has no double quotes (eg. for numeric) to do not supply in filter i.e. in contains(611)

@makeittotop
makeittotop / change_definer.sh
Created December 2, 2020 23:45 — forked from cedricmagne/change_definer.sh
Change TRIGGERS DEFINER in MySQL
##
## Create mysql triggers dump
## We add DROP TRIGGER IF EXISTS with option --add-drop-trigger
## This option is supported only by mysqldump as supplied with MySQL Cluster. It is not available when using MySQL Server 5.5.
## If you don't need password dont use -p option.
##
mysqldump -u <USERNANME> -p --routines --add-drop-trigger --no-create-info --no-data --no-create-db --skip-opt <database> > outputfile.sql
##
## Change old DEFINER with sed command