Skip to content

Instantly share code, notes, and snippets.

View scharfmn's full-sized avatar

Michael Scharf scharfmn

  • New York, NY
View GitHub Profile
@scharfmn
scharfmn / my-gentoo.zsh-theme
Created June 1, 2021 12:16
Slight alt of the gentoo zsh theme with virtualenv info moved
autoload -Uz colors && colors
autoload -Uz vcs_info
zstyle ':vcs_info:*' check-for-changes true
zstyle ':vcs_info:*' unstagedstr '%F{red}*' # display this when there are unstaged changes
zstyle ':vcs_info:*' stagedstr '%F{yellow}+' # display this when there are staged changes
zstyle ':vcs_info:*' actionformats '%F{5}(%F{2}%b%F{3}|%F{1}%a%c%u%m%F{5})%f '
zstyle ':vcs_info:*' formats '%F{5}(%F{2}%b%c%u%m%F{5})%f '
zstyle ':vcs_info:(sv[nk]|bzr):*' branchformat '%b%F{1}:%F{3}%r'
zstyle ':vcs_info:*' enable git cvs svn
PROMPT='%(!.%B%F{red}.%B%F{green}%n@)%m %F{blue}%(!.%1~.%~) %{$fg[cyan]%}$(virtualenv_prompt_info) %{$reset_color%}% ${vcs_info_msg_0_}%(!.#.$)%{$reset_color%} '
@scharfmn
scharfmn / gist:898a023f9dce1d0af5b0504238408e9a
Last active July 13, 2020 11:29
add jupyter notebook and ipython kernel with pyenv
pyenv activate your_env
pip install jupyter
python -m ipykernel install --user
pyenv deactivate
# by Henrique Bastos
@scharfmn
scharfmn / start-redis.txt
Created February 22, 2019 09:28
start redis
redis-server /usr/local/etc/redis.conf
@scharfmn
scharfmn / 00-detect-virtualenv-sitepackages.py
Created December 28, 2017 03:28 — forked from henriquebastos/00-detect-virtualenv-sitepackages.py
IPython startup script to detect and inject VIRTUAL_ENV's site-packages dirs.
"""IPython startup script to detect and inject VIRTUAL_ENV's site-packages dirs.
IPython can detect virtualenv's path and injects it's site-packages dirs into sys.path.
But it can go wrong if IPython's python version differs from VIRTUAL_ENV's.
This module fixes it looking for the actual directories. We use only old stdlib
resources so it can work with as many Python versions as possible.
References:
http://stackoverflow.com/a/30650831/443564
@scharfmn
scharfmn / do-debian8-locale-issues.md
Created July 4, 2016 08:25 — forked from 5car1z/do-debian8-locale-issues.md
Debian 8 DO Locale Issues Fix

#Debian 8 DO Locale Issues Fix

##Problem

"Locale problems" in both the 32-bit & 64-bit versions of Debian 8 droplets

Create a new Debian 8 droplet and login as root:

@scharfmn
scharfmn / df-write-xlsx-writer.py
Last active August 29, 2015 14:22
Write from pandas DataFrame to Excel .xlsx file using XlsxWriter
##############################################################################
#
# An example of converting a Pandas dataframe with datetimes to an xlsx file
# with a default datetime and date format using Pandas and XlsxWriter.
#
# Copyright 2013-2015, John McNamara, jmcnamara@cpan.org
#
# http://xlsxwriter.readthedocs.org/example_pandas_datetime.html#ex-pandas-datetime
#
import pandas as pd
@scharfmn
scharfmn / jsConsoleErrors.js
Last active August 29, 2015 14:17
Log js console errors
// https://danlimerick.wordpress.com/2014/01/18/how-to-catch-javascript-errors-with-window-onerror-even-on-chrome-and-firefox/
window.onerror = function (errorMsg, url, lineNumber, column, errorObj) {
alert('Error: ' + errorMsg + ' Script: ' + url + ' Line: ' + lineNumber
+ ' Column: ' + column + ' StackTrace: ' + errorObj);
}
@scharfmn
scharfmn / gist:9a93301b4bf6ecddaf34
Last active August 29, 2015 14:15
Adaptation of nltk wrapper for Stanford POS tagger to batch-process tweets (or other non-sentential units)
# -*- coding: utf-8 -*-
# Natural Language Toolkit: Interface to the Stanford NER-tagger
#
# Copyright (C) 2001-2014 NLTK Project
# Author: Nitin Madnani <nmadnani@ets.org>
# Rami Al-Rfou' <ralrfou@cs.stonybrook.edu>
# URL: <http://nltk.org/>
# For license information, see LICENSE.TXT
"""