Skip to content

Instantly share code, notes, and snippets.

View matheus-santos's full-sized avatar
🏠
Working from home

Matheus Santos matheus-santos

🏠
Working from home
View GitHub Profile
@matheus-santos
matheus-santos / symlink_win10.bat
Last active October 21, 2016 20:59
Sym link Windows 10
@matheus-santos
matheus-santos / database_size.sql
Last active August 25, 2016 20:06
Database size in mysql
SELECT table_schema "Data Base Name",
sum( data_length + index_length ) / 1024 / 1024 "Data Base Size in MB",
sum( data_free )/ 1024 / 1024 "Free Space in MB"
FROM information_schema.TABLES
GROUP BY table_schema ;
show variables where variable_name = 'general_log';
set global general_log = 0;
select count(*) from mysql.general_log;
@matheus-santos
matheus-santos / git_url_shortener.md
Created June 1, 2016 14:46
Git.io: GitHub URL Shortener

Do you have a GitHub URL you'd like to shorten? Use Git.io!

$ curl -i https://git.io -F "url=https://github.com/..."
HTTP/1.1 201 Created
Location: https://git.io/abc123

$ curl -i https://git.io/abc123
HTTP/1.1 302 Found
Location: https://github.com/...
@matheus-santos
matheus-santos / banks_BR.json
Created April 13, 2016 15:32
Lista de bancos que operam no Brasil
[
{
"code": "001",
"name": "Banco do Brasil",
"short_name": "BB",
"jurisdiction": "Federal",
"website": "www.bb.com.br"
},
{
"code": "002",
@matheus-santos
matheus-santos / align_with_flexbox.html
Created October 13, 2015 12:31
Aligning items using flexbox
<style type="text/css">
.wrap {
display: flex;
align-items: center;
justify-content: center;
}
.item {
max-width: 50%;
}
@matheus-santos
matheus-santos / timer.py
Created September 21, 2015 03:05
Simple timer class for benchmark python programs
import time
class Timer(object):
verbose = False # Debug mode
start_value = 0 # Start time
msecs = 0 # Diff in milliseconds
def __init__(self, verbose=False):
@matheus-santos
matheus-santos / kill_them_all.sh
Created September 10, 2015 15:19
Script that kill slow processes running into Mysql DB
#!/bin/sh
# Author: Matheus Cesário <mts.cesario@gmail.com>
# Description: Killing all slow queries from bd
# Example: sh kill_them_all.sh -s 100
# Variables
SECONDS=0 # Seconds
USER="" # DB user
PASSWORD="" # DB password
HOST="" # DB host
@matheus-santos
matheus-santos / tar.gz.cheat_sheet
Last active September 24, 2015 17:14
Managing tar files
tar stores relative paths by default. GNU tar even says so if you try to store an absolute path:
# Create .tar file (with gzip)
tar -zcvf foo.tar /home/foo
# Have a look at what's in the tar file:
tar -tvf foo.tar
# Extracting file from tar file
tar -xvf foo.tar home/foo/bar # Note: no leading slash
@matheus-santos
matheus-santos / delete_by_size
Created July 14, 2015 17:08
Delete all files given its size
find -name "*.txt" -size -2k -delete
@matheus-santos
matheus-santos / find_xxl_files
Created June 17, 2015 16:23
Searching large files
# Looking for large files
sudo find / -type f -size +1G -exec ls -lh {} \;