Skip to content

Instantly share code, notes, and snippets.

@z-m-k
z-m-k / LICENSE
Last active October 30, 2016 22:37
A Python class that allows to incorporate d3js and Python (IPython notebook mainly). See at: http://nbviewer.ipython.org/4484816/ipyD3sample.ipynb
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. {http://fsf.org/}
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license for
#!/usr/bin/env bash
#Code adapted from https://gist.github.com/yangj1e/3641843c758201ebbc6c (Modified to Python3.5)
cd ~
#wget https://3230d63b5fc54e62148e-c95ac804525aac4b6dba79b00b39d1d3.ssl.cf1.rackcdn.com/Anaconda2-2.4.0-Linux-x86_64.sh
wget https://3230d63b5fc54e62148e-c95ac804525aac4b6dba79b00b39d1d3.ssl.cf1.rackcdn.com/Anaconda3-2.4.1-Linux-x86_64.sh
bash Anaconda3-2.4.1-Linux-x86_64.sh -b
echo 'PATH="/home/ubuntu/anaconda3/bin:$PATH"' >> .bashrc
. .bashrc
@swayson
swayson / netrw quick reference.md
Created April 25, 2017 10:48 — forked from t-mart/netrw quick reference.md
A quick reference for Vim's built-in netrw file selector.
Map Action
<F1> Causes Netrw to issue help
<cr> Netrw will enter the directory or read the file
<del> Netrw will attempt to remove the file/directory
- Makes Netrw go up one directory
a Toggles between normal display, hiding (suppress display of files matching g:netrw_list_hide) showing (display only files which match g:netrw_list_hide)
c Make browsing directory the current directory
C Setting the editing window
d Make a directory
@napjon
napjon / from_sklearn.py
Last active September 12, 2017 21:49
Method to convert docs using sklearn to pyLDAVis
def from_sklearn(docs,vect,lda,**kwargs):
"""Create Prepared Data from sklearn's vectorizer and Latent Dirichlet
Application
Parameters
----------
docs : Pandas Series.
Documents to be passed as an input.
vect : Scikit-Learn Vectorizer (CountVectorizer,TfIdfVectorizer).

This hit #rstats today:

Has anyone made a dumbbell dot plot in #rstats, or better yet exported to @plotlygraphs using the API? https://t.co/rWUSpH1rRl

— Ken Davis (@ken_mke) October 23, 2015
<script async src="//platform.twitter.com/widgets.js" charset="utf-8"></script>

So, I figured it was worth a cpl mins to reproduce.

While the US gov did give the data behind the chart it was all the data and a pain to work with so I used WebPlotDigitizer to transcribe the points and then some data wrangling in R to clean it up and make it work well with ggplot2.

It is possible to make the top "dumbbell" legend in ggplot2 (but not by using a guide) and color the "All Metro A

@meefen
meefen / lsa_mds.R
Last active September 30, 2019 20:17
Analyze Text Similarity in R: Latent Semantic Analysis and Multidimentional Scaling
# load required libraries
library(tm)
library(ggplot2)
library(lsa)
# 1. Prepare mock data
text <- c("transporting food by cars will cause global warming. so we should go local.",
"we should try to convince our parents to stop using cars because it will cause global warming.",
"some food, such as mongo, requires a warm weather to grow. so they have to be transported to canada.",
"a typical electronic circuit can be built with a battery, a bulb, and a switch.",
@jakevdp
jakevdp / Altair-Code-Gen.ipynb
Created August 10, 2016 02:43
Simple example of code generation with Altair
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@vshvedov
vshvedov / gist:1370650
Created November 16, 2011 17:00
Sublime Text Edit 2 for Debian (from PPA)
wget http://blog.anantshri.info/content/uploads/2010/09/add-apt-repository.sh.txt
sudo mv add-apt-repository.sh.txt /usr/sbin/add-apt-repository
sudo chmod o+x /usr/sbin/add-apt-repository
sudo chown root:root /usr/sbin/add-apt-repository
sudo add-apt-repository ppa:webupd8team/sublime-text-2
@rpietro
rpietro / lsa_hack.r
Created September 3, 2013 23:03
playing with lsa based on post from http://goo.gl/ds2c4p
# script stolen from http://goo.gl/YbQyAQ
# install.packages("tm")
# install.packages("ggplot2")
# install.packages("lsa")
# install.packages("scatterplot3d")
#install.packages("SnowballC")
#if !(require('SnowballC')) then install.packages("SnowballC")
library(tm)
library(ggplot2)
@jzempel
jzempel / application:__init__.py
Created July 29, 2012 20:37
Flask with Celery 3.0
from blueprint import example
from extensions import mail
from flask import Flask
import settings
def create_app(settings=settings):
ret_val = Flask(__name__)
ret_val.config.from_object(settings)
# initialize extensions...