Skip to content

Instantly share code, notes, and snippets.

View fabiotatsuo's full-sized avatar

Fabio Tatsuo fabiotatsuo

View GitHub Profile
@fabiotatsuo
fabiotatsuo / gist:8dd898f0b0fa64d185af
Created March 3, 2016 21:01
Mysqldump export 1000 lines from a mysql database
$ mysqldump --opt --where="1 limit 1000" -u root -p yourdatabase > dump.sql
@fabiotatsuo
fabiotatsuo / gist:69b73cb0f9bb407c187a
Created March 3, 2016 21:26
Diagram MySql database
Create a diagram for a mysql db
MySQL Workbench
Menu Database > Reverse Engineer...
@fabiotatsuo
fabiotatsuo / gist:672174ac209ff5160cde
Created March 23, 2016 07:07
Query one to many mysql
use databse;
SELECT
n.id as noticia_id,
n.titulo as post_title,
n.categoria_noticia_id as categoria_noticia_id,
c.nome as tag_name
FROM noticia as n
LEFT JOIN categoria_noticia as c ON c.id = n.categoria_noticia_id
top -b
ps -aux
# partition
gpart show
# ten largest directories / files
du -a /var | sort -n -r | head -n 10
@fabiotatsuo
fabiotatsuo / gist:9eb6fb7c00e00067f7dae4618470630b
Created July 23, 2016 07:19
ERROR 1840 (HY000): @@GLOBAL.GTID_PURGED can only be set when @@GLOBAL.GTID_EXECUTED is empty.
ERROR 1840 (HY000): @@GLOBAL.GTID_PURGED can only be set when @@GLOBAL.GTID_EXECUTED is empty.
delete command from import dump
SET @@GLOBAL.GTID_PURGED='d23dceda-08a4-11e5-85e4-005056a2431f:1-10073';
Swap file
dd if=/dev/zero of=/usr/swap0 bs=1m count=4096
chmod 0600 /usr/swap0
echo "md99 none swap sw,file=/usr/swap0,late 0 0" >> /etc/fstab
swapon -aL
Create superuser
$ createuser -P -s -e username
psswd:
$ psql -U username
List databases
postgres=# \l
\q: Quit/Exit
Neo4j install OS X
$ brew install neo4j
To have launchd start neo4j now and restart at login:
brew services start neo4j
Or, if you don't want/need a background service you can just run:
neo4j start
DB Folder
@fabiotatsuo
fabiotatsuo / gist:dc15e568facb3cc774b2277576b56bc3
Last active July 10, 2022 22:48
Preferences.sublime-settings
{
"bold_folder_labels": false,
// color scheme
// "color_scheme": "Treble Light.sublime-color-scheme",
"dark_color_scheme": "Bass Green.sublime-color-scheme",
"light_color_scheme": "Treble Light.sublime-color-scheme",
"enable_tab_scrolling": true,
"font_size": 11,
"highlight_line": true,
"highlight_modified_tabs": true,
let g:mapleader=' '
syntax on
set clipboard=unnamed
set cursorline
set encoding=utf-8
set guifont= "Menlo:12"
set history=1000 "Store :cmdline history
set laststatus=2
set mouse=a
set number " line numbering