Skip to content

Instantly share code, notes, and snippets.

View developer-rakeshpaul's full-sized avatar

Rakesh Paul developer-rakeshpaul

View GitHub Profile
different implementations of the simple counter app... code verbosity vs expressiveness
@developer-rakeshpaul
developer-rakeshpaul / pyenv+virtualenv.md
Created December 25, 2016 16:40 — forked from eliangcs/pyenv+virtualenv.md
Cheatsheet: pyenv, virtualenvwrapper, and pip

Cheatsheet: pyenv, virtualenvwrapper, and pip

Installation (for Mac OS)

Install pyenv with brew

brew update
brew install pyenv
@developer-rakeshpaul
developer-rakeshpaul / start_stop_memcached_script.sh
Created September 29, 2016 09:56 — forked from tinogomes/start_stop_memcached_script.sh
Script sample to start/stop for linux with nohup
#!/bin/bash
#
BASE=/tmp
PID=$BASE/app.pid
LOG=$BASE/app.log
ERROR=$BASE/app-error.log
PORT=11211
LISTEN_IP='0.0.0.0'
MEM_SIZE=4
@developer-rakeshpaul
developer-rakeshpaul / app.py
Created May 7, 2016 06:20 — forked from kacieh80/app.py
Falcon App start up file with Flask like routes
import falcon
import os
from app.db import db_session
from app.utils.exceptions import build_error_response
from app.startup import (autoload, add_routes)
wsgi_app = falcon.API(after=[db_session.remove_session])
autoload("{0}/{1}".format(os.path.dirname(__file__), "handlers"))
@developer-rakeshpaul
developer-rakeshpaul / startup.py
Created May 7, 2016 06:19 — forked from kacieh80/startup.py
Pretty Flask like routes in Falcon python framework
import os
import pkgutil
class route(object):
""" Decorates RequestHandlers and builds a list of routes """
_routes = []
def __init__(self, uri):
@developer-rakeshpaul
developer-rakeshpaul / remove_stop_words.py
Created February 10, 2016 10:26 — forked from glenbot/remove_stop_words.py
Test various ways of removing stop words in python.
"""
Demonstration of ways to implement this API:
sanitize(user_input, stop_words)
Related discussions:
- Modifying a list while looping over it:
- http://stackoverflow.com/questions/1207406/remove-items-from-a-list-while-iterating-in-python
- Remove all occurences of a value in a list:
- http://stackoverflow.com/questions/1157106/remove-all-occurences-of-a-value-from-a-python-list
@developer-rakeshpaul
developer-rakeshpaul / feedly_export_saved_for_later
Last active February 2, 2016 04:22 — forked from bradcrawford/feedly_export_saved_for_later
Simple script that exports a users "Saved For Later" list out of Feedly as a JSON string
// Simple script that exports a users "Saved For Later" list out of Feedly
// as a JSON string.
//
// This was intended for use in the Google Chrome's "Inspector" tool so your
// mileage may vary if used in other contexts.
//
// Format of JSON is as follows:
// [
// {
// title: "Title",
#List unique values in a DataFrame column
pd.unique(df.column_name.ravel())
#Convert Series datatype to numeric, getting rid of any non-numeric values
df['col'] = df['col'].astype(str).convert_objects(convert_numeric=True)
#Grab DataFrame rows where column has certain values
valuelist = ['value1', 'value2', 'value3']
df = df[df.column.isin(value_list)]