Skip to content

Instantly share code, notes, and snippets.

Andrés Aquino andresaquino

View GitHub Profile
@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 && \
@andresaquino
andresaquino / ffmpeg-cmds.sh
Last active May 14, 2020
My ffmpeg favourite commands
View ffmpeg-cmds.sh
#!/usr/bin/env bash
# Reduce size
ffmpeg -i <video.mp4> -vcodec h264 -acodec aac <video-output.mp4>
# Extract a audio fragment from another audio
ffmpeg -ss 00:00:30 -t 00:02:58 -i <input.mp3> -acodec copy <ouput.mp3>
# Extract audio from a video
ffmpeg -i <video.avi> -f mp3 <audio.mp3>
@andresaquino
andresaquino / POSTMORTEM.md
Created Apr 10, 2018 — forked from voxxit/POSTMORTEM.md
Example/outline of a postmortem to be conducted after a site outage/incident
View POSTMORTEM.md

POSTMORTEM: “Event Title Here”

Issue Summary

This should be a short (4-5 sentences) blurb which succinctly describes the event. At the very least, it should include:

  • the duration (with start & end times in the U.S. Pacific time zone):

…which lasted for roughly 10 minutes between 9:02PM and 9:12PM Pacific…

  • the impact to our users:
@andresaquino
andresaquino / RUNBOOK.md
Created Apr 10, 2018 — forked from voxxit/RUNBOOK.md
Example of a solid run book/operations manual
View RUNBOOK.md

Run Book / Operations Manual

  1. Table of Contents
  2. System Overview
    • Service Overview
    • Contributing Applications, Daemons, and Windows Services
    • Hours of Operation
    • Execution Design
    • Infrastructure and Network Design
    • Resilience, Fault Tolerance and High-Availability
@andresaquino
andresaquino / haproxy-db.conf
Created Apr 2, 2018 — forked from aw/haproxy-db.conf
HAProxy configuration for MySQL failover and redundancy
View haproxy-db.conf
# HAProxy configuration - haproxy-db.cfg
##
## FRONTEND ##
##
# Load-balanced IPs for DB writes and reads
#
frontend db_write
bind 172.16.0.50:3306
@andresaquino
andresaquino / headers.vim
Last active May 3, 2018
VIM Plugin para establecer los headers en scripts (bash, ruby, python, perl, vim, php, js, c/c++) de forma automática.
View headers.vim
" Vim File
" vim:si:ai:et:ts=3:sw=3:ft=vim
" (c) 2018, Andres Aquino <inbox@andresaquino.sh>
" This file is licensed under the BSD License version 3 or later.
" See the LICENSE file.
"
" Based on work of Agapo (fpmarias@google.com), /usr/share/vim/vim70/plugin/header.vim
" LastModf: 20180326.034630
You can’t perform that action at this time.