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 / select_lines_config
Created February 11, 2015 12:55
Select lines with keyboard Sublime Text 2
/* On Key Bindings - Default/User */
{ "keys": ["shift+alt+up"], "command": "select_lines", "args": {"forward": false} },
{ "keys": ["shift+alt+down"], "command": "select_lines", "args": {"forward": true} }
@matheus-santos
matheus-santos / find
Last active August 29, 2015 14:15
Searching files on Unix terminal
# find $FOLDER -type $DOCUMENT_TYPE -name $ARG
find ~/ -type f -name "wally.txt"
@matheus-santos
matheus-santos / undo
Last active August 29, 2015 14:15
Undo modified file git
# Before commit
git checkout -- $FILE_NAME
@matheus-santos
matheus-santos / mvn-run
Created March 24, 2015 18:48
Building and running assembled Maven Project
# On the Maven project folder
# Compiling current mvn project and assembling it
# into a single .jar file. That way we can execute the
# project without running into 'class not found' errors.
# Ref: http://stackoverflow.com/a/574650/3147039
mvn clean compile assembly:single
# Running java program (generated snapshot from Maven project)
java -jar target/App-0.0.1-SNAPSHOT-jar-with-dependencies.jar
@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 {} \;
@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 / kill_task
Created April 24, 2015 14:35
Kill mysql-workbench task on Linux
# Killing task 'mysql-workbench'
kill $(ps -A | awk '/[m]ysql-workbench/ {print $1}')
@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 / 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 / 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%;
}