This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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]]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
''' | |
Functions to read the OpenWordnetPT from RDF files and provide | |
access to it. | |
''' | |
import rdflib | |
from six.moves import cPickle |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
import pdb | |
class ForkedPdb(pdb.Pdb): | |
"""A Pdb subclass that may be used | |
from a forked multiprocessing child | |
""" | |
def interaction(self, *args, **kwargs): | |
_stdin = sys.stdin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django_celery_beat.models import PeriodicTask, ClockedSchedule | |
from django.utils.timezone import localtime, timedelta | |
import json | |
now = localtime() | |
clocked, _ = ClockedSchedule.objects.get_or_create( | |
clocked_time=now + timedelta(days=10) | |
) | |
PeriodicTask.objects.create( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
curl -o '.git/hooks/prepare-commit-msg' https://gist.githubusercontent.com/joaorafaelm/4fedbd643fba2804df0117ac2b170da7/raw/prepare-commit-msg && chmod +x .git/hooks/prepare-commit-msg |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
OlderNewer