Skip to content

Instantly share code, notes, and snippets.

View khozzy's full-sized avatar

Norbert khozzy

View GitHub Profile
@khozzy
khozzy / s1.py
Created February 10, 2016 09:55
Docker forward matplotlib graphics
import json
from pandas import DataFrame, Series
import pandas as pd
import matplotlib
matplotlib.use('TkAgg')
import matplotlib.pyplot as plt
#!/usr/bin/env bash
TOMCAT_HOME=/Users/khozzy/Apache/apache-tomcat-8.0.30
echo "[**] deploy locally"
echo "[**] stopping tomcat"
sh $TOMCAT_HOME/bin/shutdown.sh
echo "[**] copy war"
@khozzy
khozzy / pp-ht-c1.py
Last active February 19, 2016 07:57
PP_Hypothesis_Testing_Case_1
from scipy.stats import binom
X = binom(15, 0.9)
p_val = X.cdf(11)
print("p_value: {}".format(p_val))
@khozzy
khozzy / Projects.vue
Created June 14, 2016 12:33
Vue.js auto transitions
<template>
<div class="container tiles" role="main">
<div class="row" v-for="projectGroup in chunkedProjects">
<div class="col-lg-4" v-for="project in projectGroup">
<div class="flip">
<div class="card" :class="{'flipped':project.flipped}">
<div class="face front">Front</div>
<div class="face back">Back</div>
@khozzy
khozzy / nltk1.py
Last active November 2, 2017 14:15
import nltk, string
def untokenize(tokens):
return "".join([" "+i if not i.startswith("'") and i not in string.punctuation else i for i in tokens]).strip()
snippet = """
When the Apple Watch first came out last year, Engadget published not one but two reviews. There was the \"official\" review, which provided an overview of the device's features and, more important, attempted to explain who, if anyone, should buy it. Then there was a piece I wrote, focusing specifically on the watch's capabilities (actually, drawbacks) as a running watch. Although we knew that many readers would be interested in that aspect of the device, we were wary of derailing the review by geeking out about marathoning.
This year, we needn't worry about that. With the new Apple Watch Series 2, the company is explicitly positioning the device as a sports watch. In particular, the second generation brings a built-in GPS radio for more accurate distance tracking on runs, walks, hikes, bike rides and swims. Yes, swims: It's also waterproof this time, safe for submersion in up to 50 meters of water.
Beyond that, the other changes are performance-related, including a faster chip, longer batte
from nltk.tokenize import RegexpTokenizer
snippet = snippet.lower()
tokens = RegexpTokenizer(r'\w+').tokenize(snippet)
untokenize(tokens)
from nltk.stem.snowball import SnowballStemmer
snowball = nltk.SnowballStemmer("english")
snowball_stemmed = [snowball.stem(token) for token in tokens]
untokenize(snowball_stemmed)
from nltk.stem.porter import PorterStemmer
porter = PorterStemmer()
porter_stemmed = [porter.stem(token) for token in tokens]
untokenize(porter_stemmed)
from nltk.stem.lancaster import LancasterStemmer
lancaster = LancasterStemmer()
lancaster_stemmed = [lancaster.stem(token) for token in tokens]
untokenize(lancaster_stemmed)