Skip to content

Instantly share code, notes, and snippets.

Andrés Aquino andresaquino

Block or report user

Report or block andresaquino

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@andresaquino
andresaquino / iconresize.sh
Last active Jan 27, 2019
Resize icon using imagemagick or ffmpeg
View iconresize.sh
#!/usr/bin/env bash
#
# Install:
# cp iconresize.sh ~/bin/iconresize
# chmod 0700 ~/bin/iconresize
#
# How to use:
# iconresize <filename:icon.png> <directory:android> <tool:im|ff>
#
View imageedition-cmds.sh
Image edition
# convert white color to transparency
convert <image.png> -fuzz 5% -transparent white <new-image.png>
# resize image to 24, 48, 64, 96 & 128 preserving ratio (width)
for isize in 24 48 64 96 128
do
ffmpeg -i <original-img.png> -vf scale=${isize}:-1 <image_${isize}.png>
done
View mysql.md

Size DB

ALL

mysql> SELECT sum( data_length + index_length ) / (1024 * 1024)  "Size in MB" FROM information_schema.TABLES;

By DB

SELECT table_schema "Data Base Name", sum( data_length + index_length ) / (1024 * 1024) as Size FROM information_schema.TABLES GROUP BY table_schema;
View mysql.md
  • Finalement, je me rends compte qu'il n'y a pas grand chose à faire pour un poste de dev à partir du moment où je ne laisse pas mon poste allumé tout le temps.
  • A savoir que la plupart des variables sont à mettre dans [mysqld] pour qu'elles soient prises en compte.
  • https://www.askapache.com/mysql/mysql-performance-tuning/
  • Il faut un MySQL allumé et utilisé depuis longtemps pour avoir des recommandations pertinentes
  • Ceci dit, quelques améliorations demandé par mysqltuner :
# sudo vim /etc/mysql/conf.d/perso.cnf
[mysqld]
key_buffer_size = 128M
query_cache_limit = 2048M
@andresaquino
andresaquino / mysql_cheetsheet.md
Created Dec 20, 2018 — forked from weblogix/mysql_cheetsheet.md
[MySQL Cheetsheet] #mysql #mariadb
View mysql_cheetsheet.md

Exporting a Compressed MySQL Dump

mysqldump -u {user} -p {database} | gzip > {database}.sql.gz

Importing a Compressed MySQL Dump

gzip -dc < {database}.sql.gz | mysql -u {user} -p {database}
@andresaquino
andresaquino / mysql-queries1.md
Created Dec 20, 2018 — forked from sanjaypanditc/mysql-queries1.md
[MySQL Queries] Mysql queries #mysql #query
View mysql-queries1.md
  • Convert DateTime in UnixTimeStamp
    SELECT *,from_unixtime(date_added) FROM TABLE_NAME order by date_added desc

  • Space consume by a table
    SELECT table_schema "Data Base Name",sum( data_length + index_length ) / 1024 / 1024 /1024 "Used GB" FROM information_schema.TABLES GROUP BY table_schema ;

  • Character Set utf8mb4_unicode_ci

  • Set a login path using terminal/putty

@andresaquino
andresaquino / MySQL-Guide.txt
Created Dec 20, 2018 — forked from i-stos/MySQL-Guide.txt
MySQL: Basic MySQL Guide
View MySQL-Guide.txt
==========================================================================================================
MySQL Guide - Basics
==========================================================================================================
Connect/Disconnect from MySQL Server
----------------------------------------------------------------------------------------------------------
:~ sudo mysqld_safe //Turns on MySQL server
:~ mysql -h host -u root -p //Connects to MySQL server: "no need to specify host on local"
mysql> quit; //Disconnects from MySQL
:~ mysqladmin -u root -p shutdown //Shuts down MySQL server
----------------------------------------------------------------------------------------------------------
@andresaquino
andresaquino / query_finder.sql
Created Dec 20, 2018 — forked from mezis/query_finder.sql
Finding long-running queries in MySQL
View query_finder.sql
SELECT id,state,command,time,left(replace(info,'\n','<lf>'),120)
FROM information_schema.processlist
WHERE command <> 'Sleep'
AND info NOT LIKE '%PROCESSLIST%'
ORDER BY time DESC LIMIT 50;
@andresaquino
andresaquino / shell-cmds.sh
Last active Nov 26, 2018
My shell favourite commands
View shell-cmds.sh
#!/usr/bin/env bash
# $> brew info mpgtx
# mpgtx: stable 1.3.1 (bottled)
# Toolbox to manipulate MPEG files
# Up{date|grade} && cleanup
brew update && \
brew upgrade && \
brew cask upgrade && \
You can’t perform that action at this time.