Skip to content

Instantly share code, notes, and snippets.

View michelp's full-sized avatar

Michel Pelletier michelp

  • Portland, OR
View GitHub Profile
#!/bin/bash
tmux new-session -d -n 'Master' -s citus "psql"
while ((i++)); IFS=' ' read host port
do
if [ $i -eq 1 ]
then
tmux new-window -n 'Workers' "psql -h $host -p $port"
else
tmux splitw "psql -h $host -p $port"
postgres=# select count(*) from asset_view_events ;
WARNING: could not establish asynchronous connection after 4000 ms
WARNING: could not establish asynchronous connection after 4000 ms
WARNING: could not establish asynchronous connection after 4000 ms
WARNING: could not establish asynchronous connection after 4000 ms
WARNING: could not establish asynchronous connection after 4000 ms
WARNING: could not establish asynchronous connection after 4000 ms
WARNING: could not establish asynchronous connection after 4000 ms
WARNING: could not establish asynchronous connection after 4000 ms
WARNING: could not establish asynchronous connection after 4000 ms
Topics in NMF model:
Topic #0:
don just people think like know good time right ve say did make really way want going new year ll
Topic #1:
windows thanks file card does dos mail files know program use advance hi window help software looking ftp video pc
Topic #2:
drive scsi ide drives disk controller hard floppy bus hd cd boot mac cable card isa rom motherboard mb internal
Topic #3:
key chip encryption clipper keys escrow government algorithm security secure encrypted public nsa des enforcement law privacy bit use secret
Topic #4:
worker_processes 1;
user nobody nogroup;
pid /tmp/nginx.pid;
error_log /tmp/nginx.error.log;
events {
worker_connections 1024; # increase if you have lots of clients
accept_mutex off; # "on" if nginx worker_processes > 1
politips=# select * from pats.relate(sbj => '%sanders%', vrb_head => 'be') limit 10;
sbj | vrb | obj | sentences
------------------------------------+-------------------------+----------------+-----------
sanders | is qualified to be | president | 16
bernie sanders | is | its antithesis | 3
sanders | is | nothing | 3
sanders | was | mayor | 3
say that bernie sanders | was not qualified to be | president | 2
sanders | was qualified to be | president | 2
bernie sanders | is | a democrat | 2
politips=# select sbj, vrb, obj, lpad(string, 180) from pats.relate ('obama', 'tell') limit 10;
sbj | vrb | obj | lpad
----------------------------------------+------+-------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
a senior obama administration official | told | lawmakers tuesday | WASHINGTON ( AP ) - A senior Obama administration official told lawmakers Tuesday that Iran will not be given access to the U.S. financial system as part of the sanctions relief g
CREATE OR REPLACE FUNCTION test.get_test(environ jsonb, apath jsonb, args jsonb)
RETURNS TABLE(environ jsonb, apath jsonb, args jsonb)
LANGUAGE sql
AS $function$
select environ, apath, args;
$function$
import os
import re
import psycopg2
import logging
from json import dumps, loads
from werkzeug.wrappers import Request, Response
from werkzeug.wsgi import SharedDataMiddleware, DispatcherMiddleware
from werkzeug.exceptions import NotFound
from newsie.pgrpc import DB
politips=#
select a.data->>'title', s.*, now() - a.created from news.article a, sentiment(data->>'cleaned_text') s where data->>'cleaned_text' is not null and s.polarity > 0.2 order by created desc limit 10;
?column? | polarity | subjectivity | ?column?
---------------------------------------------------------------------------------------------------------------------------------+-------------------+-------------------+-----------------
Cruz wins most delegates at stake Saturday in Wyoming | 0.433333333333333 | 0.3 | 00:05:57.679898
Jeanette Rubio personally thanks volunteers in Orlando | 0.219773783127442 | 0.51091120261852 | 00:08:33.568056
California hoping to use science to battle drought
select a.data->>'title', s.* from news.article a, sentiment(data->>'cleaned_text') s where data->>'cleaned_text' is not null and s.polarity < -0.2 order by created limit 10;
?column? | polarity | subjectivity
--------------------------------------------------------------------+--------------------+-------------------
What the Battle of Waterloo means to us | -0.266666666666667 | 0.8
Dallas police headquarters shooting suspect had violent history | -0.2625 | 0.4625
Behind the biggest break-in of the 1970's - Video | -0.4 | 0.7
United passengers forced to sleep in military barracks | -0.266666666666667 | 0.4
Perry releases bizarre Hillary cartoon ad | -0.223333333333333 | 0.346666666666667
Connecticut probes school response to kinderg