Skip to content

Instantly share code, notes, and snippets.

View kstohr's full-sized avatar

Kate Stohr kstohr

View GitHub Profile

SHORTCUTS

Key/Command Description
Tab Auto-complete files and folder names
Ctrl + A Go to the beginning of the line you are currently typing on
Ctrl + E Go to the end of the line you are currently typing on
Ctrl + U Clear the line before the cursor
Ctrl + K Clear the line after the cursor
Ctrl + W Delete the word before the cursor
Ctrl + T Swap the last two characters before the cursor
@kstohr
kstohr / ydl-download-video-extract-audio
Last active October 16, 2017 23:47
Download video and extract audio using Youtube-DL
class MyLogger(object):
def debug(self, msg):
pass
def warning(self, msg):
pass
def error(self, msg):
#job = get_current_job()
#job.meta['progress'] = msg
@kstohr
kstohr / python_subprocess_output
Created August 1, 2017 10:28
Python subprocess to run a CLI python script in interactive mode
from subprocess import Popen, PIPE
cmd = 'python some_python_script.py'
p = subprocess.Popen(cmd, shell=True, stdin=PIPE, stdout=PIPE, stderr=PIPE)
stdout, stderr = p.communicate()
stdout.splitlines()
@kstohr
kstohr / watson_stt_ws.py
Last active June 15, 2017 07:45
Watson Speech-to-Text Websocket Connection for Python 3.5 (function call)
# coding: utf-8
"""
websocket connection to watson speech-to-text API
adapted from: https://github.com/watson-developer-cloud/speech-to-text-websockets-python
speech recognition using the WebSocket interface to the Watson Speech-to-Text service
This is an updated version of the sample websocket connection created by the IBM Watson team (@daniel-bolanos) and included in their documentation.
Main changes:
@kstohr
kstohr / slackbot_example.py
Created April 13, 2017 22:05
Python Slackbot for sending data to Slack
from slackclient import SlackClient
import json
import requests
# Store your data output/analysis as a variable named 'attachment'
# See: https://api.slack.com/docs/messages
attachment = {"text": "And, here is an attachment"}
# Output to json, if in other format
@kstohr
kstohr / plotly_example.py
Last active April 13, 2017 05:00
How to uses plot.ly to plot inline and save files to imbed on web pages
import os
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import plotly
import plotly.plotly as py
import plotly.graph_objs as go
from plotly.graph_objs import *
from plotly.offline import download_plotlyjs, init_notebook_mode, iplot
import plotly.tools as tls
@kstohr
kstohr / fb_group_page_query.py
Last active December 20, 2021 18:33
Facebook Graph API: Search for pages and groups that match a query list
import os
import traceback
import logging
import facebook
import requests
import pandas as pd
import json
import time
import numpy as np
from pandas.io.json import json_normalize
@kstohr
kstohr / Procfile
Created March 6, 2017 18:12 — forked from woeldiche/Procfile
Share your Framer.js prototypes
web: NODE_ENV=production node server.js
@kstohr
kstohr / README.md
Created May 8, 2016 23:55 — forked from mmattozzi/README.md
Bubble Chart

Bubble charts encode data in the area of circles. Although less perceptually-accurate than bar charts, they can pack hundreds of values into a small space. Implementation based on work by Jeff Heer. Data shows the Flare class hierarchy, also courtesy Jeff Heer.

@kstohr
kstohr / analytic_wfm.py
Created April 25, 2016 17:16 — forked from sixtenbe/analytic_wfm.py
Peak detection in Python
#!/usr/bin/python2
# Copyright (C) 2016 Sixten Bergman
# License WTFPL
#
# This program is free software. It comes without any warranty, to the extent
# permitted by applicable law.
# You can redistribute it and/or modify it under the terms of the Do What The
# Fuck You Want To Public License, Version 2, as published by Sam Hocevar. See