Skip to content

Instantly share code, notes, and snippets.

#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)]
@houssemFat
houssemFat / git-cheatSheet.md
Last active February 8, 2016 00:18 — forked from hofmannsven/README.md
My simply Git Cheatsheet
@houssemFat
houssemFat / split_join.java
Last active February 24, 2016 14:23
a simple join at java
/* package whatever; // don't place package name! */
import java.util.Arrays;
import java.util.LinkedHashSet;
import java.util.Set;
/* Name of the class has to be "Main" only if the class is public. */
class Ideone
{
public static void main (String[] args) throws java.lang.Exception
@houssemFat
houssemFat / canvas_bkg.js
Created April 28, 2016 21:19 — forked from victusfate/canvas_bkg.js
creates a dynamic color pattern canvas on mouse move event
var body, canvas, color, ctx, grad, canvasAdjust=true;
canvas = document.getElementsByTagName("canvas")[0];
ctx = null;
grad = null;
body = document.getElementsByTagName("body")[0];
color = 255;
if (canvas.getContext("2d")) {
var w = canvas.width;
var h = canvas.height;
ctx = canvas.getContext("2d");
@houssemFat
houssemFat / leaflet-custom-map.html
Created May 4, 2016 22:15 — forked from MarZab/leaflet-custom-map.html
Leaflet with latlng scale in meters and Control.Scale to match
<!DOCTYPE html>
<html>
<head>
<title>Leaflet Custom Simple Map Example</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-1.0.0-b1/leaflet.css" />
<link rel="stylesheet" href="https://cdn.rawgit.com/ardhi/Leaflet.MousePosition/master/src/L.Control.MousePosition.css">
@houssemFat
houssemFat / nginxproxy.md
Created May 12, 2016 10:18 — forked from soheilhy/nginxproxy.md
How to proxy web apps using nginx?

Virtual Hosts on nginx (CSC309)

When hosting our web applications, we often have one public IP address (i.e., an IP address visible to the outside world) using which we want to host multiple web apps. For example, one may wants to host three different web apps respectively for example1.com, example2.com, and example1.com/images on the same machine using a single IP address.

How can we do that? Well, the good news is Internet browsers

@houssemFat
houssemFat / mqtt-client.py
Last active November 10, 2016 19:33
how to run 6.4 mqtt client connection with mqq
import paho.mqtt.client as mqtt
from os import path
import json
BASE_URL = "" ;
CHANNEL_ALL = 'common'
CHANNEL_REPLY = 'reply'
CLIENT = '/me-it'
class Client:
def __init__(self, name, suffix =""):
@houssemFat
houssemFat / sort.js
Last active November 10, 2016 19:34
sorting algorithms
var a = [6, 5, 3, 1, 9, 7, 2, 4];
var length = a.length ;
bubbleSort = function (){
var swap = 0 ;
for (i = 0 ; i < length - i + 1 ; i++){
for (var j = 1 ; j < length - i ; j++) {
if (a[j-1] > a[j] ){
console.log ("moving " + a[j-1])
swap = a[j] ;
a[j] = a[j-1] ;
@houssemFat
houssemFat / Dockerfile
Last active November 10, 2016 19:30
Ubuntu 14.04, nginx , passenger and http2
#TODO
@houssemFat
houssemFat / horizontal-infinite-carousel.html
Created October 11, 2016 19:53 — forked from dongyuwei/horizontal-infinite-carousel.html
infinite loop carousel(vertical or horizontal)