Skip to content

Instantly share code, notes, and snippets.

View balkian's full-sized avatar

J. Fernando Sánchez balkian

View GitHub Profile
@balkian
balkian / gist:3933798
Created October 22, 2012 20:10
Create an ogv bumper for a video
ffmpeg -r 25 -loop 1 -i Uni/PFC/portadavideo.png -b 299k -r 15 -vcodec libschroe
dinger-t 5 bumper.ogv
@balkian
balkian / tar-and-scp.sh
Created December 17, 2012 21:07
Script to copy all the logs with a certain filename (YYY-MM-DD_<name>.log) to a folder for the day, tar.gz the folder and send it to a remote host.
#!/bin/bash
tosend=""
for i in *.log; do
dir=$(echo $i | awk '{split($1,a,"_"); print a[1]}');
if [ ! -d $dir ]; then
mkdir $dir;
fi;
mv $i $dir;
tosend="$tosend\n$dir"
done
# Replace define(ACROREAD, [repeat swallow(acroread) fill :
# acroread -openInNewWindow /a "$fragment" "$file"])
#
# With the following in /etc/mozpluggerrc to have evince as
# an embedded pdf viewer in chromium:
define(ACROREAD, [repeat swallow(evince) fill needs_xembed : evince -f "$file"])
def recursive_add(src, store, dpth=0, key = ''):
""" Recursively adds nested elements."""
tabs = lambda n: ' ' * n * 4 # or 2 or 8 or...
brace = lambda s, n: '%s%s%s' % ('['*n, s, ']'*n)
if isinstance(src, dict):
for key, value in src.iteritems():
thisorg=Org(key,store=store)
thisorg.reload_repos()
thisorg.reload_members()
@balkian
balkian / OpenCalais.sh
Last active December 17, 2015 21:59
Use OpenCalais API
curl -v --data "@bla.txt" -H "x-calais-licenseID: **MYKEY**" -H "content-Type: text/raw" -H "Accept: application/json" 'http://api.opencalais.com/tag/rs/enrich'
<?php
include('Eklekt/Emotion.php');
include('Eklekt/Emotion/AffectWord.php');
include('Eklekt/Emotion/EmotionalState.php');
include('Eklekt/Emotion/Empathyscope.php');
include('Eklekt/Emotion/Utility/Heuristics.php');
include('Eklekt/Emotion/Utility/Lexical.php');
#const NEUTRAL = -1;
curl --data-urlencode ontology@testResults.owl http://owl.cs.manchester.ac.uk/validator/validate
import mechanize, cookielib
from BeautifulSoup import BeautifulSoup
import re, os
from zipfile import ZipFile
def get_image(tag, folder):
if not os.path.isdir(folder):
os.makedirs(folder)
print image
filename = os.path.join(folder+'/'+url.split('/')[-1])
@balkian
balkian / gist:6263617
Last active December 21, 2015 06:19
Badge Mr. X
<style media="all" type="text/css">
#badge{
font-size: 12px;
position: relative;
width: 180px;
height: 210px;
margin: 0 auto;
/*border-bottom: 10px solid black;*/
-webkit-transform:rotate(4deg);
-moz-transform:rotate(4deg);
{% set sheet=f.sheet_by_index(0) %}
{
"@context": {
"@base": "http://demos.gsi.dit.upm.es/eurosentiment/generator#{{ filename }}",
"dc": "http://purl.org/dc/terms/",
"dc:subject": {
"@type": "@id"
},
"emotions": {
"@container": "@list",