- Create
UNLOGGED
table. This reduces the amount of data written to persistent storage by up to 2x. - Set
WITH (autovacuum_enabled=false)
on the table. This saves CPU time and IO bandwidth on useless vacuuming of the table (since we neverDELETE
orUPDATE
the table). - Insert rows with
COPY FROM STDIN
. This is the fastest possible approach to insert rows into table. - Minimize the number of indexes in the table, since they slow down inserts. Usually an index
on
time timestamp with time zone
is enough. - Add
synchronous_commit = off
topostgresql.conf
. - Use table inheritance for fast removal of old data:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
=============================================================================== | |
Crc32 is a JavaScript function for computing the CRC32 of a string | |
............................................................................... | |
Version: 1.2 - 2006/11 - http://noteslog.com/category/javascript/ | |
------------------------------------------------------------------------------- | |
Copyright (c) 2006 Andrea Ercolino | |
http://www.opensource.org/licenses/mit-license.php |
- [dealing with many buffers: ibuffer] (http://emacs-fu.blogspot.com/2010/02/dealing-with-many-buffers-ibuffer.html)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" auto reload nginx & apache | |
function! Reload() | |
let output = system(&ft == 'nginx' ? 'service nginx configtest && service nginx reload' : 'service apache2 reload') | |
if v:shell_error | |
echohl WarningMsg | echo output | |
endif | |
endfunction | |
autocmd! BufWritePost */nginx*conf,*/apache*conf call Reload() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
server { | |
root /home/brook/Public/$host; | |
location / { | |
# default_server | |
if (!-d /home/brook/Public/$host) { | |
proxy_pass http://localhost; | |
break; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Mint | |
# screenlets | |
# Show bandwidth use oneliner | |
while true; do cat /proc/net/dev; sleep 1; done | awk -v dc="date \"+%T\"" '/eth0/{i = $2 - oi; o = $10 - oo; oi = $2; oo = $10; dc|getline d; close(dc); if (a++) printf "%s %8.2f KiB/s in %8.2f KiB/s out\n", d, i/1024, o/1024}' | |
# limit the cpu usage of a process | |
sudo cpulimit -p pid -l 50 | |
# ubuntu root |