Skip to content

Instantly share code, notes, and snippets.

@stesee
stesee / convertMp4ToAudio.sh
Created December 26, 2019 22:26
bash script extracting audio from mp4
#http://askubuntu.com/questions/221026/how-can-i-batch-extract-audio-from-mp4-files-with-ffmpeg-without-decompression#221069
mkdir -p output
# current directory has to contain at least one .mp4 file
for vid in *.mp4; do
codec="$(ffprobe -v error -select_streams a:0 -show_entries stream=codec_name -print_format csv=p=0 "$vid")"
case "$codec" in
mp3 ) filetype=mp3 ;;
vorbis ) filetype=ogg ;;
aac ) filetype=m4a ;;
* ) filetype= ;;
@jedi4ever
jedi4ever / gist:d095656ae0f0eca4a83ebb2b331da367
Last active January 11, 2024 22:01
Chromium build with proprietary codecs
@zduey
zduey / iex.py
Created March 4, 2017 16:04
Simple Real-Time Stock Streaming with Bokeh
import io
import requests
import pandas as pd
from bokeh.models import ColumnDataSource, HoverTool, ResizeTool, SaveTool
from bokeh.models.widgets import TextInput, Button
from bokeh.plotting import figure, curdoc
from bokeh.layouts import row, widgetbox
TICKER = ""
@alexhayes
alexhayes / pyenv+direnv on OSX.md
Last active November 6, 2022 20:17
Awesomely easy virtualenvs on OSX using pyenv and direnv

Awesomely easy virtualenvs on OSX using pyenv and direnv

Never forget to activate that virtualenv or set that environment variable ever again...

Install

  1. Install pyenv

     brew install pyenv
    
@mGalarnyk
mGalarnyk / Fibonacci_Sequence.py
Last active November 14, 2020 13:16
Fibonacci sequence algorithm in Python. 5 different ways for a later blog post at https://medium.com/@GalarnykMichael
# To incorporate and learn from later: http://stackoverflow.com/questions/494594/how-to-write-the-fibonacci-sequence-in-python
##########################################
# Method 1: Simple For Loops
# If you like, you can specify which Python version you are using
# Python 2 Version
# (xrange doesnt exist in Python3)
a, b = 0, 1
for i in xrange(0, 10):
@gwillem
gwillem / ansible-bootstrap-ubuntu-16.04.yml
Created June 16, 2016 21:59
Get Ansible to work on bare Ubuntu 16.04 without python 2.7
# Add this snippet to the top of your playbook.
# It will install python2 if missing (but checks first so no expensive repeated apt updates)
# gwillem@gmail.com
- hosts: all
gather_facts: False
tasks:
- name: install python 2
raw: test -e /usr/bin/python || (apt -y update && apt install -y python-minimal)
@lornajane
lornajane / mac.md
Last active May 9, 2024 01:22
Keyboard Only OS X

Keyboard-only Mac Cheatsheet

Hi, I'm Lorna and I don't use a mouse. I have had RSI issues since a bad workstation setup at work in 2006. I've tried a number of extra hardware modifications but what works best for me is to use the keyboard and only the keyboard, so I'm in a good position and never reaching for anything else (except my coffee cup!). I rather unwisely took a job which required me to use a mac (I've been a linux user until now and also had the ability to choose my tools carefully) so here is my cheatsheet of the apps, tricks and keyboard shortcuts I'm using, mostly for my own reference. Since keyboard-only use is also great for productivity, you may also find some of these ideas useful, in which case at least something good has come of this :)

Apps List

There's more detail on a few of these apps but here is a quick overview of the tools I've installed and found helpful

Tool Link Comments
@bbengfort
bbengfort / Makefile
Created January 10, 2016 19:20
Basic Python Project files - my Makefile and the dependencies that I have in everything.
# Shell to use with Make
SHELL := /bin/bash
# Set important Paths
PROJECT := # Set to your project name
LOCALPATH := $(CURDIR)/$(PROJECT)
PYTHONPATH := $(LOCALPATH)/
PYTHON_BIN := $(VIRTUAL_ENV)/bin
# Export targets not associated with files
@pmbaumgartner
pmbaumgartner / sklearn_custom_scorer_labels.py
Last active August 14, 2018 17:12
Making a custom scorer in sklearn that only looks at certain labels when calculating model metrics. For example: This creates a f1_macro scorer object that only looks at the '-1' and '1' labels of a target variable.
from sklearn.metrics import f1_score, make_scorer
scorer = make_scorer(f1_score, labels=[-1, 1], average='macro')
# use like:
cv = cross_val_score(model, X, Y, scoring=scorer)
@vigosan
vigosan / install_nvim.sh
Last active February 27, 2018 21:51
Build and install neovim for Debian
#!/usr/bin/env bash
# Build and install neovim for Debian
pushd .
mkdir -p ~/src
cd ~/src
# Install cmake 2.8.10
cmake_package="cmake-3.3.1"