Skip to content

Instantly share code, notes, and snippets.

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

João joaorafaelm

🏠
Working from home
View GitHub Profile
@joaorafaelm
joaorafaelm / Dockerfile
Created January 16, 2024 23:54 — forked from adtac/Dockerfile
#!/usr/bin/env docker run
#!/usr/bin/env -S bash -c "docker run -p 8080:8080 -it --rm \$(docker build --progress plain -f \$0 . 2>&1 | tee /dev/stderr | grep -oP 'sha256:[0-9a-f]*')"
# syntax = docker/dockerfile:1.4.0
FROM node:20
WORKDIR /root
RUN npm install sqlite3
@joaorafaelm
joaorafaelm / LDApredict.py
Created November 22, 2017 19:17 — forked from ululh/LDApredict.py
LDA (Latent Dirichlet Allocation) predicting with python scikit-learn
# derived from http://scikit-learn.org/stable/auto_examples/applications/topics_extraction_with_nmf_lda.html
# explanations are located there : https://www.linkedin.com/pulse/dissociating-training-predicting-latent-dirichlet-lucien-tardres
from sklearn.feature_extraction.text import CountVectorizer
from sklearn.decomposition import LatentDirichletAllocation
import pickle
# create a blank model
lda = LatentDirichletAllocation()
@joaorafaelm
joaorafaelm / openwordnetpt.py
Created October 27, 2017 23:15 — forked from erickrf/openwordnetpt.py
Functions to access the OpenWordnetPT graph
# -*- coding: utf-8 -*-
'''
Functions to read the OpenWordnetPT from RDF files and provide
access to it.
'''
import rdflib
from six.moves import cPickle
from sklearn.feature_extraction.text import TfidfVectorizer, CountVectorizer
from sklearn.datasets import fetch_20newsgroups
from sklearn.decomposition import NMF, LatentDirichletAllocation
def display_topics(model, feature_names, no_top_words):
for topic_idx, topic in enumerate(model.components_):
print "Topic %d:" % (topic_idx)
print " ".join([feature_names[i]
for i in topic.argsort()[:-no_top_words - 1:-1]])
@joaorafaelm
joaorafaelm / activate
Last active September 11, 2016 15:56 — forked from xiongchiamiov/activate
export GOPATH="$(builtin cd "$(dirname "${BASH_SOURCE[0]:-$_}" )" && pwd)"
export OLDPS1=$PS1
export PS1="[go:$(basename $GOPATH)] $PS1"
deactivate() {
export PS1=$OLDPS1
unset GOPATH
unset OLDPS1
unset deactivate
}
@joaorafaelm
joaorafaelm / .bashrc
Last active September 8, 2016 01:53 — forked from vsouza/.bashrc
Golang 1.5 setup in Mac OSX with HomeBrew. Set `GOPATH` and `GOROOT` variables in zshell or bash.
# Set variables in .bashrc file
# don't forget to change your path correctly!
export GOPATH=$HOME/golang
export GOROOT=/usr/local/opt/go/libexec
export PATH=$PATH:$GOPATH/bin
export PATH=$PATH:$GOROOT/bin
@joaorafaelm
joaorafaelm / System Design.md
Created April 18, 2016 12:48 — forked from vasanthk/System Design.md
System Design Cheatsheet

#System Design Cheatsheet

Picking the right architecture = Picking the right battles + Managing trade-offs

##Basic Steps

  1. Clarify and agree on the scope of the system
  • User cases (description of sequences of events that, taken together, lead to a system doing something useful)
    • Who is going to use it?
    • How are they going to use it?
@joaorafaelm
joaorafaelm / goinst.sh
Created October 24, 2015 22:33 — forked from jmervine/goinst.sh
Installing GoLang - Ubuntu 12.04.3 LTS \n \l
#!/usr/bin/env bash
#
# Example usage:
#
# $ VERSION=1.3 sudo ./goinst.sh
if [ "$(id -u)" != "0" ]; then
echo "This script must be run as root" 1>&2
exit 1
fi