Skip to content

Instantly share code, notes, and snippets.

@gachet
gachet / word2vec_tweets_preprocessor.py
Created June 13, 2017 10:45 — forked from ravyg/word2vec_tweets_preprocessor.py
Clean tweets json for tensorflow or gensim based word2vec plain text
# -*- coding: utf-8 -*-
import json
import re
import os
import nltk
input_file = open('<JSON FILE To INPUT>','r').readlines()
for line in input_file:
try:
tweet = json.loads(line)
@gachet
gachet / gensim_word2vec_demo.py
Created June 13, 2017 10:52 — forked from bhaettasch/gensim_word2vec_demo.py
Use gensim to load a word2vec model pretrained on google news and perform some simple actions with the word vectors.
from gensim.models import Word2Vec
# Load pretrained model (since intermediate data is not included, the model cannot be refined with additional data)
model = Word2Vec.load_word2vec_format('GoogleNews-vectors-negative300.bin', binary=True, norm_only=True)
dog = model['dog']
print(dog.shape)
print(dog[:10])
# Deal with an out of dictionary word: Михаил (Michail)
@gachet
gachet / annoytutorial-text8.ipynb
Created September 11, 2017 10:00 — forked from pmbaumgartner/annoytutorial-text8.ipynb
Annoy Tutorial - Text8 Changes
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@gachet
gachet / Ubidots_PubSubClient_Example.ino
Created March 3, 2018 15:02 — forked from jotathebest/Ubidots_PubSubClient_Example.ino
This script is a basic example for sending data to Ubidots using the PubSubClient library. It is useful for developers that want to make their own libraries to connect their devices.
/****************************************
* Include Libraries
****************************************/
#include <PubSubClient.h>
#include <ESP8266WiFi.h>
#include <ESP8266WiFiMulti.h>
#include <stdio.h>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@gachet
gachet / producer_consumer.py
Last active December 10, 2019 21:27 — forked from cristipufu/producer_consumer.py
Producer-consumer problem in python
import sys
import random
import time
from threading import *
class Producer(Thread):
def __init__(self, items, can_produce, can_consume):
Thread.__init__(self)
self.items = items
self.can_produce = can_produce
import dash
import dash_core_components as dcc
import dash_html_components as html
import plotly.graph_objs as go
import pandas as pd
app = dash.Dash()
df = pd.read_csv(
'https://gist.githubusercontent.com/chriddyp/'
import dash
from dash.dependencies import Input, Output
import dash_core_components as dcc
import dash_html_components as html
from pandas_datareader import data as web
from datetime import datetime as dt
app = dash.Dash('Hello World')
@gachet
gachet / Assignment2 (1).ipynb
Created November 21, 2018 12:42 — forked from GeorgyGol/Assignment2 (1).ipynb
Assignment 2 for Week 2 of Applied Plotting, Charting and Data Representation in Python Coursera course
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@gachet
gachet / README.md
Created July 4, 2023 22:07 — forked from 101arrowz/README.md
Download a McGraw Hill Education eTextbook

Download a McGraw Hill Education eTextbook

If you purchase a textbook from McGraw Hill, the website to view it is clunky and only works on some devices. You can't go to specific page numbers, the search is super slow, etc. That's why I wrote this script to download the textbook as an ePub file for your own viewing.

Using this script is 100% legal. McGraw Hill publicly hosts their ebooks online in order for their web client to download it. Moreover, to use it, you must already have purchased the book you would like to download, so it is legally yours to use as you please. However, it IS illegal to use this for piracy purposes. DO NOT DISTRIBUTE ANY TEXTBOOKS YOU DOWNLOAD USING THIS SCRIPT.