This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT count(*) AS C, payload->'retweeted_status'->>'id' AS cat, payload->'retweeted_status'->>'text' AS Tweet FROM messages WHERE jsonb_typeof(payload) = 'object' and payload->>'text' not like '%http%' GROUP BY cat, Tweet ORDER BY C DESC; | |
# Works just fine | |
SELECT count(*) AS C, payload->'retweeted_status'->>'id' AS cat, payload->'retweeted_status'->>'text' AS Tweet, payload->'retweeted_status'->'User'->>'screen_name' AS User FROM messages WHERE jsonb_typeof(payload) = 'object' and payload->>'text' not like '%http%' GROUP BY cat, Tweet, User ORDER BY C DESC; | |
# Doesn't work | |
# ------------ | |
# ERROR: column "messages.payload" must appear in the GROUP BY clause or be used in an aggregate function | |
# LINE 1: ...t, payload->'retweeted_status'->>'text' AS Tweet, payload->'... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
# \r is carriage return, writes the following text to the beginning of the line | |
sys.stdout.write('\r<And your message>') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pymongo | |
import logging | |
import sys | |
from sqlalchemy.exc import IntegrityError | |
from pymongo import MongoClient | |
from tweeply.models import TweeplyMessage, Credential, User, Database | |
from tweeply.utils import update_config | |
logging.basicConfig() | |
logger = logging.getLogger(__name__) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [ $# -lt 1 ] | |
then | |
echo "Usage: $0 <ONTO> <FORMAT> <VERSION> <DIR> <NS>" | |
echo "Example: $0 onto owl latest /tmp/Onto http://example.com/ontologies owl" | |
exit | |
else | |
ONTO=$1 | |
fi | |
if [ $# -lt 2 ] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
select distinct ?a ?b where {?a <http://dbpedia.org/ontology/demonym> ?b} LIMIT 100 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% set f = open_file(informat="csv", delimiter='\t') %} | |
{ | |
"@context": [ | |
"http://demos.gsi.dit.upm.es/eurosentiment/static/context.jsonld" | |
], | |
"@id": "GSI-UPM", | |
"analysis": [ | |
{ | |
"prov:wasAssociatedWith": "GSI_UPM", | |
"dc:language": "en", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from selenium import webdriver | |
from selenium.webdriver.support.ui import Select | |
from selenium.webdriver.common.by import By | |
from selenium.webdriver.support import expected_conditions as EC | |
from selenium.webdriver.support.ui import WebDriverWait | |
home = 'https://ifttt.com/recipes'; | |
driver = webdriver.Firefox() | |
#driver.set_window_size(1024, 768) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Quake like console on top | |
-- Similar to: | |
-- http://git.sysphere.org/awesome-configs/tree/scratch/drop.lua | |
-- But uses a different implementation. The main difference is that we | |
-- are able to detect the Quake console from its name | |
-- (QuakeConsoleNeedsUniqueName by default). | |
-- Use: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Run raspbia in qemu | |
qemu-system-arm -kernel kernel-qemu -cpu arm1176 -m 256 -M versatilepb -no-reboot -serial stdio -append "root=/dev/sda2 panic=1" -hda 2015-05-05-raspbian-wheezy.img |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
python -c 'import rdflib; g=rdflib.Graph(); g.parse("prueba.ttl", format="n3"); print(g.serialize(format="n3").str)' |