Homebrew is a great little package manager for OS X. If you haven't already, installing it is pretty easy:
ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"
1033edge.com | |
11mail.com | |
123.com | |
123box.net | |
123india.com | |
123mail.cl | |
123qwe.co.uk | |
150ml.com | |
15meg4free.com | |
163.com |
# /etc/logrotate.d/app.example.com | |
/home/forge/app.example.com/storage/logs/*.log { | |
su forge forge | |
weekly | |
missingok | |
rotate 24 | |
compress | |
notifempty | |
copytruncate | |
create 755 forge forge |
# Mac OS X | |
csvcut -c 1 path/to/file.csv | uniq -c | grep -v '^ *1' | awk '{print $2}' | grep -f /dev/stdin path/to/file.csv |
After automatically updating Postgres to 10.0 via Homebrew, the pg_ctl start command didn't work. | |
The error was "The data directory was initialized by PostgreSQL version 9.6, which is not compatible with this version 10.0." | |
Database files have to be updated before starting the server, here are the steps that had to be followed: | |
# need to have both 9.6.x and latest 10.0 installed, and keep 10.0 as default | |
brew unlink postgresql | |
brew install postgresql@9.6 | |
brew unlink postgresql@9.6 | |
brew link postgresql |
APP_DIR=/home/forge/sub.domain.com | |
RELEASE=$(date +%Y%m%d%H%M%S) | |
RELEASE_DIR=$APP_DIR/releases/$RELEASE | |
ARCHIVE=$RELEASE.tar.gz | |
PHP=php7.1 | |
[ -d $APP_DIR/releases ] || mkdir $APP_DIR/releases | |
cd $APP_DIR/releases | |
mkdir $RELEASE_DIR |
<?php | |
# http://jeffreysambells.com/2012/10/25/human-readable-filesize-php | |
function human_filesize($bytes, $decimals = 2) { | |
$size = array('B','kB','MB','GB','TB','PB','EB','ZB','YB'); | |
$factor = floor((strlen($bytes) - 1) / 3); | |
return sprintf("%.{$decimals}f", $bytes / pow(1024, $factor)) . @$size[$factor]; | |
} | |
echo human_filesize(filesize('example.zip')); |
{ | |
"AL": "Alabama", | |
"AK": "Alaska", | |
"AS": "American Samoa", | |
"AZ": "Arizona", | |
"AR": "Arkansas", | |
"CA": "California", | |
"CO": "Colorado", | |
"CT": "Connecticut", | |
"DE": "Delaware", |
CREATE SEQUENCE next_id_seq; | |
CREATE OR REPLACE FUNCTION next_id(OUT id BIGINT) AS $$ | |
DECLARE | |
shard INT := 1; | |
epoch BIGINT := 1314220021721; | |
sequence BIGINT; | |
miliseconds BIGINT; | |
BEGIN | |
SELECT nextval('next_id_seq') % 1024 INTO sequence; |
https://github.com/fphilipe/psql2csv Run a query in psql and output the result as CSV