Skip to content

Instantly share code, notes, and snippets.

View javaguirre's full-sized avatar

Javier Aguirre javaguirre

View GitHub Profile
@javaguirre
javaguirre / forms.py
Created December 31, 2011 16:59
Changing showed form field in ManyToManyFields, Django
from django import forms
from django.forms import ModelForm
from links.models import Link, Tag
from django.forms.util import ErrorList
def model_to_dict(instance, fields=None, exclude=None):
"""
Returns a dict containing the data in ``instance`` suitable for passing as
@javaguirre
javaguirre / network.service
Created March 3, 2013 21:02
Network service Arch
[Unit]
Description=Network Connectivity
Wants=network.target
Before=network.target
BindsTo=sys-subsystem-net-devices-${interface}.device
After=sys-subsystem-net-devices-${interface}.device
[Service]
Type=oneshot
@javaguirre
javaguirre / config.light.h
Created June 12, 2013 10:02
Solarized light colours for st (simple terminal)
/* See LICENSE file for copyright and license details. */
/*
* appearance
*
* font: see http://freedesktop.org/software/fontconfig/fontconfig-user.html
*/
static char font[] = "Monaco for Powerline:pixelsize=13:antialias=true:autohint=false";
static int borderpx = 2;
static char shell[] = "/bin/sh";
define([
"lib/react/react"
], function(React) {
return function() {
return {
onMessageCallback: null,
init: function(message_callback) {
@javaguirre
javaguirre / sentiment.py
Created April 4, 2017 08:48
Sentiment analysis with Python NLTK and IBM Tone Analyzer
import json
from watson_developer_cloud import ToneAnalyzerV3
from nltk.sentiment.vader import SentimentIntensityAnalyzer
class SentimentService():
def __init__(self):
self.service = SentimentIntensityAnalyzer()
@javaguirre
javaguirre / README.md
Last active September 1, 2017 08:01
Silly and dirty example to test Messenger Facebook templates

Quick and dirty solution to test different kinds of Facebook messenger templates.

pip install -r requirements.txt

You'll need to set the environment variables PAGE_ACCESS_TOKEN and VERIFY_TOKEN.

You'll need something like ngrok to set a public url so you receive Facebook webhook links.

https://ngrok.com/

README consejos uso de terminal

Iniciar el proyecto

Para iniciar el proyecto abrir un terminal y poner los siguientes comandos:

cd Documentos/Github/Ignacio
# CI
build:golang:
image: golang:1.9
script:
- go get -v -u github.com/hyperledger/fabric-sdk-go
- go get -v -u github.com/stretchr/testify/assert
- mkdir -p $GOPATH/src/gitlab.com/kafkian/ngo
- cp -r /builds/kafkian/ngo/chaincode/ngo/* $GOPATH/src/gitlab.com/kafkian/ngo
# Build hyperledger fabric
@javaguirre
javaguirre / Dangerfile
Last active July 2, 2018 14:39
fmartingr Dangerfile for Django
# Sometimes it's a README fix, or something like that - which isn't relevant for
# including in a project's CHANGELOG for example
declared_trivial = github.pr_title.include? '#trivial'
wip = github.pr_title.include? '[WIP]'
added_and_modified_files = git.added_files + git.modified_files
warn('Big PR') if git.lines_of_code > 500
fail("PR not ready for review yet.") if wip
version: '2'
services:
beats:
image: ''
volumes:
- .:/persistence
port:
- '5000:5000'