Skip to content

Instantly share code, notes, and snippets.

View fsodogandji's full-sized avatar

Fabrice Sodogandji fsodogandji

View GitHub Profile

Python Number Conversion Chart

From To Expression
app.config field riak.conf variable
-------------------------------------------------------------------------------------------
yokozuna.enabled yokozuna
yokozuna.solr_port yokozuna.solr_port
yokozuna.solr_jmx_port yokozuna.solr_jmx_port
yokozuna.solr_jvm_args yokozuna.solr_jvm_args
yokozuna.yz_dir yokozuna.data_dir
riak_repl.data_root mdc.data_root
riak_core.cluster_mgr mdc.cluster_manager
riak_repl.max_fssource_cluster mdc.max_fssource_cluster
#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)]
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@fsodogandji
fsodogandji / upgrade-postgres-9.3-to-9.4.md
Created December 22, 2015 13:01 — forked from dideler/upgrade-postgres-9.3-to-9.4.md
Upgrading PostgreSQL from 9.3 to 9.4 when upgrading Ubuntu 14.04 to 14.10

TL;DR

sudo pg_dropcluster 9.4 main --stop
sudo pg_upgradecluster 9.3 main
sudo pg_dropcluster 9.3 main

@fsodogandji
fsodogandji / hcmc.py
Created January 11, 2016 13:22 — forked from springcoil/hcmc.py
Hamiltonian Monte Carlo
import numpy,math
import matplotlib.pyplot as plt
import random as random
random.seed(1) # set random seed.
# Draw random samples from Salpeter IMF.
# N ... number of samples.
# alpha ... power-law index.
# M_min ... lower bound of mass interval.
@fsodogandji
fsodogandji / faces_example.py
Created January 18, 2016 10:58 — forked from philipcristiano/faces_example.py
Resize and crop an image based on OpenCV detected faces
import sys
from PIL import Image, ImageDraw
try:
import cv
except ImportError:
print 'Could not import cv, trying opencv'
import opencv.cv as cv
@fsodogandji
fsodogandji / GPU-EC2.sh
Created January 18, 2016 13:59 — forked from soulslicer/GPU-EC2.sh
OpenCL on GPU instance
# This script installs everything you need on an EC2 GPU Instance
# Create an Ubuntu 12.04 GPU Instance with at least 16GB of free space
# Base packages
sudo apt-get update
sudo apt-get install build-essential
sudo apt-get install gcc git cmake
# CUDA/Nvidia installations
wget http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1204/x86_64/cuda-repo-ubuntu1204_6.0-37_amd64.deb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.