- https://api.slack.com/apps
- Create New App
- Set App Name and Development Slack Workspace
- Tap App to move Building Apps for Slack
- Add features and functionality
- Select Incoming Webhooks
- Add New Webhook to Workspace
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 shutil | |
import tempfile | |
from app.models import Record | |
# %% | |
%%time | |
with tempfile.NamedTemporaryFile() as tmp: | |
record = Record.objects.first() |
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 python | |
# -*- coding:utf-8 -*- | |
# Viterbi algorithm | |
# http://en.wikipedia.org/wiki/Viterbi_algorithm | |
# | |
# > python viterbi.py | |
# 0 1 2 | |
# Rainy: 0.06000 0.03840 0.01344 | |
# Sunny: 0.24000 0.04320 0.00259 | |
# (0.01344, ['Sunny', 'Rainy', 'Rainy']) |
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 base64 | |
import cv2 | |
from PIL import Image | |
cap = cv2.VideoCapture(0) | |
_, img = cap.read() | |
image_string = cv2.imencode(".png", img)[1].tostring() | |
output = io.BytesIO() | |
Image.fromarray(img).save(output, format='PNG') |
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 shutil | |
import requests | |
def download(url, dst): | |
response = requests.get(url, stream=True) | |
with open(str(dst), 'wb') as out_file: | |
shutil.copyfileobj(response.raw, out_file) | |
del response |
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 python | |
# -*- coding:utf-8 -*- | |
# extract YouTube videoids from html | |
import re | |
import json | |
import urllib2 | |
from BeautifulSoup import BeautifulSoup | |
def get_videoids(url): |
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
(function() { | |
var language_info = { | |
languages_top: [ | |
{ code: "de", name: "Deutsch" }, | |
{ code: "en", name: "English", checked: true }, | |
{ code: "es", name: "español" }, | |
{ code: "es-419", name: "español (Latinoamérica)" }, | |
{ code: "fr", name: "français" }, | |
{ code: "hr", name: "hrvatski" }, | |
{ code: "it", name: "italiano" }, |
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
# install node & npm | |
apt-get install -y nodejs npm apt-transport-https | |
npm cache clean | |
npm install n -g | |
n stable | |
ln -sf /usr/local/bin/node /usr/bin/node | |
ln -sf /usr/local/bin/npm /usr/bin/npm |
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 seaborn as sns | |
colorDict = {} | |
palette = "hls" | |
colorPalette = sns.color_palette(palette, len(allLabels)) | |
for i, label in enumerate(allLabels): | |
colorDict[label] = colorPalette[i] |
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 -*- | |
import gensim | |
from sklearn.feature_extraction.text import CountVectorizer | |
from gensim.corpora.dictionary import Dictionary | |
from gensim.corpora import MmCorpus | |
import numpy as np | |
import lda |