Skip to content

Instantly share code, notes, and snippets.

View balkian's full-sized avatar
🏠
Working from home

J. Fernando Sánchez balkian

🏠
Working from home
View GitHub Profile
@balkian
balkian / serializable.py
Last active October 30, 2021 10:53
Add properties to serializable
cls = self.__class__
property_names=[]
for p in dir(cls):
if isinstance(getattr(cls, p), property):
property_names.append(p)
logging.debug('property names: {}'.format(property_names))
for p in property_names:
ser['@%s' % p] = getattr(cls, p).fget(self)
@balkian
balkian / glob.py
Created September 27, 2016 09:19
Rec
import glob
import json
def process_file(f):
print(json.load(f.read())
for f in glob.glob('semeval/*.json'):
""" Find every file in the semeval folder that matches **.json
"""
- hosts: all
name: "Let's encrypt"
tasks:
- name: Add certbot to crontab
cron: name="Letsencrypt certificates" month="*/2" minute=5 hour=0
cron_file="letsencrypt-autoupdate"
user="root"
job="/usr/bin/docker run -t --rm --name certbot \
-v '/etc/letsencrypt/:/etc/letsencrypt' \
-v '/var/lib/letsencrypt:/var/lib/letsencrypt' \
@balkian
balkian / octo.sh
Last active December 28, 2016 01:36
Simple script to control octoprint
begin
button = KEY_5
prog = irexec
config = /home/balkian/octo.sh home
repeat = 0
delay = 3
end
begin
button = KEY_1
prog = irexec
import json
from senpy import Client
client = Client('http://senpy.cluster.gsi.dit.upm.es')
with open('madrid.json', 'r') as f:
for line in f:
tweet = json.loads(line.strip())
results = client.analyse(input=tweet['text'], algorithm='sentiText')
tweet['sentiment'] = results.entries[0].sentiments[0]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
from selenium import webdriver
from selenium.webdriver.support.ui import Select
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
#import selenium.webdriver.firefox.webdriver as fwb
import selenium.webdriver.chrome as cwd
from selenium.webdriver.support import expected_conditions as EC
import time
import os
@balkian
balkian / 4_4.ipynb
Last active April 20, 2017 11:20
SITC Classification
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@balkian
balkian / example.tex
Created May 4, 2017 07:36
Rotated headers in latex tables
\usepackage{adjustbox}
\usepackage{array}
\newcolumntype{R}[2]{%
>{\adjustbox{angle=#1,lap=\width-(#2)}\bgroup}%
l%
<{\egroup}%
}
\newcommand*\rot{\multicolumn{1}{R{45}{1em}}}% no optional argument here, please!
@balkian
balkian / Demo.ipynb
Created May 5, 2017 09:50
Demo gsitk
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.