require 'bigdecimal' | |
require 'json' | |
require 'mqtt' | |
require 'prometheus_exporter' | |
require 'prometheus_exporter/server' | |
class MetricsServer | |
def initialize(broker) | |
@broker = broker |
Postgres is usually run automatically on my laptop. I also have a weekly cronjob that does brew update
and brew upgrade
which sometimes bumps the version of portgres that I'm running. Newer versions of the postgres server software aren't necessarily compatible with the older version's data directory structure, and so you need to "upgrade" your database to see all of your old data in the upgraded postgres server.
Trying to start the database manually with
pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start
Which gives an error message and tells me where to look (note that I passed in the log directory when I ran the command)
waiting for server to start.... stopped waiting
pg_ctl: could not start server
var sendString = (function(rfb, force, sendDelay) { | |
sendDelay = sendDelay || 25; | |
var _q = []; | |
var _qStart = function() { | |
var chr = _q.shift(); | |
if (chr) { | |
rfb.sendKey(chr); | |
setTimeout(_qStart, sendDelay); | |
} | |
}; |
A list of the most common functionalities in Jekyll (Liquid). You can use Jekyll with GitHub Pages, just make sure you are using the proper version.
Running a local server for testing purposes:
requests.post("https://api.mailgun.net/v2/DOMAIN/messages", | |
auth=("api", "key-SECRET"), | |
files={ | |
"attachment[0]": ("FileName1.ext", open(FILE_PATH_1, 'rb')), | |
"attachment[1]": ("FileName2.ext", open(FILE_PATH_2, 'rb')) | |
}, | |
data={"from": "FROM_EMAIL", | |
"to": [TO_EMAIL], | |
"subject": SUBJECT, | |
"html": HTML_CONTENT |
Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.
$ python -m SimpleHTTPServer 8000
-- 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%' |
{ | |
"AL": "Alabama", | |
"AK": "Alaska", | |
"AS": "American Samoa", | |
"AZ": "Arizona", | |
"AR": "Arkansas", | |
"CA": "California", | |
"CO": "Colorado", | |
"CT": "Connecticut", | |
"DE": "Delaware", |