Magic words:
psql -U postgres
If run with -E
flag, it will describe the underlaying queries of the \
commands (cool for learning!).
Most \d
commands support additional param of __schema__.name__
and accept wildcards like *.*
-- show running queries (pre 9.2) | |
SELECT procpid, age(query_start, clock_timestamp()), 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(query_start, clock_timestamp()), usename, query | |
FROM pg_stat_activity | |
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%' |
NB: The following examples were done on Puppet Enterprise 3.0 running on Centos 6. This should be similar for open source versions, except for some file locations.
The easiest way to snoop around in the actual PuppetDB postgres database is using the command prompt. You have to be the peadmin user though. Couldn't get it working just under root.
[root@master bin]# sudo su - pe-postgres -s /bin/bash
-bash-4.1$ /opt/puppet/bin/psql
psql (9.2.4)
Type "help" for help.
Every so often I have to restore my gpg keys and I'm never sure how best to do it. So, I've spent some time playing around with the various ways to export/import (backup/restore) keys.
cp ~/.gnupg/pubring.gpg /path/to/backups/
cp ~/.gnupg/secring.gpg /path/to/backups/
cp ~/.gnupg/trustdb.gpg /path/to/backups/
#this is a sample .curlrc file | |
# store the trace in curl_trace.txt file. beware that multiple executions of the curl command will overwrite this file | |
--trace curl_trace.txt | |
# store the header info in curl_headers.txt file. beware that multiple executions of the curl command will overwrite this file | |
--dump-header curl_headers.txt | |
#change the below referrer URL or comment it out entirely | |
-e "https://www.google.com" |
#!/usr/bin/env ruby | |
# Generate a DOT file showing links between ActiveMQ brokers using | |
# a list of activemq.xml files passed as ARGV. | |
require 'rexml/document' | |
require 'erb' | |
broker_map = Hash.new |
When [Markdown][markdown] appeared more than 10 years ago, it aimed to make it easier to express ideas in an easy-to-write plain text format. It offers a simple syntax that takes the writer focus away from the formatting, thus giving her time to focus on the actual content.
The market abunds of editors to be used for help with markdown. After a few attempts, I settled to Sublime and its browser preview plugin, which work great for me and have a small memory footprint to accomplish that. To pass the results around to other people, less technical, a markdown file and a bunch of images is not the best approach, so converting it to a more robust format like PDF seems like a much better choice.
[Pandoc][pandoc] is the swiss-army knife of converting documents between various formats. While being able to deal with heavy-weight formats like docx and epub, we will need it for the more lightweight markdown. To be able to generate PDF files, we need LaTeX. On OSX, the s
#!/bin/bash | |
echo "[ build and install vim from source ]" | |
# Create directories... | |
sudo mkdir -p ~/fs/dev; | |
# This script needs "fpm". If you don't have it | |
# install ruby, etc. with: | |
sudo apt-get install ruby ruby-dev build-essential; |
I'm be using DreamCompute as my OpenStack provider, but there are dozens to choose from. I assume you already have Ansible and the OpenStack CLI tools installed.
With the proliferation of OpenStack public clouds offering free and intro tiers, it's becoming very easy to effectively run a simple application for free or nearly free. Also with the emergence of Ansible, you don't need to learn and deploy complicated tools to do configuration management.