Skip to content

Instantly share code, notes, and snippets.

View luisfredgs's full-sized avatar
🎯
Focusing

Luís Gonçalves luisfredgs

🎯
Focusing
View GitHub Profile
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
from ekphrasis.classes.preprocessor import TextPreProcessor
from ekphrasis.classes.tokenizer import SocialTokenizer
from ekphrasis.dicts.emoticons import emoticons
import numpy as np
import re
import io
label2emotion = {0: "others", 1: "happy", 2: "sad", 3: "angry"}
emotion2label = {"others": 0, "happy": 1, "sad": 2, "angry": 3}
@luisfredgs
luisfredgs / latex2png_win.md
Created July 30, 2019 13:28 — forked from retorillo/latex2png_win.md
LaTeX to PNG on Windows

LaTeX to PNG on Windows

Prerequisite

  • Windows System (Tested on Windows 10)
  • pdflatex TexLive (/w standalone package)
  • magick Image Magick
    • choco install imagemagick
  • gswin32c Ghost Script (x86)
@luisfredgs
luisfredgs / kcca.py
Created January 4, 2019 12:55 — forked from yuyay/kcca.py
kernel canonical correlation analysis in python
#! encoding=UTF-8
"""
kernel canonical correlation analysis
"""
import numpy as np
from scipy.linalg import svd
from sklearn.metrics.pairwise import pairwise_kernels, euclidean_distances
class KCCA(object):
@luisfredgs
luisfredgs / AttentionWithContext.py
Created September 9, 2018 20:27 — forked from rmdort/AttentionWithContext.py
Keras Layer that implements an Attention mechanism, with a context/query vector, for temporal data. Supports Masking. Follows the work of Yang et al. [https://www.cs.cmu.edu/~diyiy/docs/naacl16.pdf] "Hierarchical Attention Networks for Document Classification"
class AttentionWithContext(Layer):
"""
Attention operation, with a context/query vector, for temporal data.
Supports Masking.
Follows the work of Yang et al. [https://www.cs.cmu.edu/~diyiy/docs/naacl16.pdf]
"Hierarchical Attention Networks for Document Classification"
by using a context vector to assist the attention
# Input shape
3D tensor with shape: `(samples, steps, features)`.
# Output shape
@luisfredgs
luisfredgs / gist:8cb3dbcc4ba0f82e3c488c2f662f943c
Created April 24, 2017 15:10 — forked from Atem18/gist:4696071
Tutorial to seting up a django website in production.

Set up Django, Nginx and Gunicorn in a Virtualenv controled by Supervisor

Steps with explanations to set up a server using:

  • Virtualenv
  • Virtualenvwrapper
  • Django
  • Gunicorn
@luisfredgs
luisfredgs / README
Created October 3, 2016 19:49 — forked from larsmans/README
Sentiment analysis with scikit-learn
Sentiment analysis experiment using scikit-learn
================================================
The script sentiment.py reproduces the sentiment analysis approach from Pang,
Lee and Vaithyanathan (2002), who tried to classify movie reviews as positive
or negative, with three differences:
* tf-idf weighting is applied to terms
* the three-fold cross validation split is different
* regularization is tuned by cross validation
@luisfredgs
luisfredgs / Contact.java
Last active May 19, 2016 02:55 — forked from rogerhu/Contact.java
Endless scrolling with RecyclerVIew
package codepath.com.recyclerviewfun;
import java.util.ArrayList;
import java.util.List;
public class Contact {
private String mName;
private boolean mOnline;
public Contact(String name, boolean online) {
@luisfredgs
luisfredgs / imagick-3.4.0-PHP7-forge.sh
Created May 5, 2016 17:34 — forked from pascalbaljet/imagick-3.4.0-PHP7-forge.sh
Install Imagick 3.4.0 on PHP 7.0 server (Laravel Forge)
#!/bin/bash
if [ "$EUID" -ne 0 ]
then echo "Please run as root"
exit
fi
apt-get install pkg-config libmagickwand-dev -y
cd /tmp
wget https://pecl.php.net/get/imagick-3.4.0.tgz
tar xvzf imagick-3.4.0.tgz
@luisfredgs
luisfredgs / UrlImageParser.java
Last active May 5, 2016 13:20 — forked from Antarix/UrlImageParser.java
Parser para carregar imagens presentes em conteúdo HTML <img/> em TextView no android.
package br.com.toptarget.topvagas.helper;
import android.content.Context;
import android.graphics.drawable.Drawable;
import android.os.AsyncTask;
import android.text.Html;
import android.util.Log;
import android.view.View;
import org.apache.http.HttpResponse;