DST=/mnt
find /var/lib -type f -size +1G -exec ls -lh {} \; | tee $DST/bigfiles_var_lib_$(date "+%H%M").log
find /var/lib -type f -size +1G -exec ls -lh {} \; | awk '{ print $5 ": " $9 }' | sort -rh > $DST/bigfiles_var_lib_$(date "+%H%M").sorted.log
Researched by Robert Quattlebaum [email protected].
Last updated 2020-02-03.
Export your public key:
keybase pgp export > keybase-public.key
Export your private key:
keybase pgp export --secret > keybase-private.key
This is a quick guide to install PostgreSQL 10 - tested on Ubuntu 16.04 but likely can be used for Ubuntu 14.04 and 17.04 as well, with one minor modification detailed below.
To make life simple, remove all other versions of Postgres. Obviously not required, but again, makes life simple. If you have data in your previous version of postgres that you'd like to retain, then this is not recommended. Instead, you'll have to use pg_upgrade or pg_upgradecluster.
{ | |
"id": "tx_[transaction-id]", | |
"created": "2017-07-24T05:45:49.311Z", | |
"description": "TFL.GOV.UK/CP\\VICTORIA STREET\\TFL TRAVEL CH\\SW1H 0TL GBR", | |
"amount": -770, | |
"currency": "GBP", | |
"merchant": null, | |
"notes": "", | |
"metadata": { | |
"mastercard_clearing_message_id": "mcclearingmsg_[mastercard-clearing-message-id]", |
## Customize database setup | |
database: | |
override: | |
- echo "no database setup" |
#!/bin/sh | |
WORKING_DIR=/var/www/site; | |
GIT_WORK_TREE=$WORKING_DIR git checkout -f; | |
cd $WORKING_DIR && composer update -o; |
#!/bin/sh | |
brew install dnsmasq | |
mkdir -pv $(brew --prefix)/etc/ | |
echo 'address=/.dev/127.0.0.1' > $(brew --prefix)/etc/dnsmasq.conf | |
sudo cp -v $(brew --prefix dnsmasq)/homebrew.mxcl.dnsmasq.plist /Library/LaunchDaemons | |
# sudo launchctl unload -w /Library/LaunchDaemons/homebrew.mxcl.dnsmasq.plist | |
sudo launchctl load -w /Library/LaunchDaemons/homebrew.mxcl.dnsmasq.plist | |
sudo mkdir -v /etc/resolver | |
sudo bash -c 'echo "nameserver 127.0.0.1" > /etc/resolver/dev' |
-- show running queries (pre 9.2) | |
SELECT procpid, age(clock_timestamp(), query_start), usename, current_query | |
FROM pg_stat_activity | |
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%' | |
ORDER BY query_start desc; | |
-- show running queries (9.2) | |
SELECT pid, age(clock_timestamp(), query_start), usename, query | |
FROM pg_stat_activity | |
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%' |
By default, Rails applications build URLs based on the primary key -- the id
column from the database. Imagine we have a Person
model and associated controller. We have a person record for Bob Martin
that has id
number 6
. The URL for his show page would be:
/people/6
But, for aesthetic or SEO purposes, we want Bob's name in the URL. The last segment, the 6
here, is called the "slug". Let's look at a few ways to implement better slugs.