Skip to content

Instantly share code, notes, and snippets.

View EHDEV's full-sized avatar

Elias Hussen EHDEV

  • New York, NY
View GitHub Profile
@EHDEV
EHDEV / dashboard_demo.html
Created April 24, 2015 13:20
Demo Dashboard Created with Jinja, highcharts, python
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap-theme.min.css">
<!-- Latest compiled and minified JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script>
import pandas as p
import requests as r
from StringIO import StringIO
import datetime
from bs4 import BeautifulSoup
import re
from alchemyapi import AlchemyAPI
import json
import numpy as np
from flask import request
@EHDEV
EHDEV / rail_blog.RMD
Created March 26, 2015 20:17
R code to generate some ggplot2 charts
---
title: "rail_blog"
output: html_document
---
```{r echo=FALSE}
library(ggplot2)
library(gridExtra)
@EHDEV
EHDEV / inv_transform.py
Created March 25, 2015 02:03
Inverse Transform Random Sampler
def rand_sampler(self, n, prob, u):
"""
Generates a random sample of k numbers according to the discrete probability distribution
n: sample size
pro: probability distribution
"""
cdf = []
np.random.seed(100)
for k in range(0, len(prob)):
cdf.append(sum([prob[k] for k in range(0, k + 1)]))
@EHDEV
EHDEV / ethiopian_multiply.py
Created March 21, 2015 18:45
Ancient Ethiopian Multiplication by Addition (Base 2)
def multiply(x1, x2):
x1, x2 = min(x1, x2), max(x1, x2)
u = 0
while x1 >= 1:
if x1 % 2 or x2 % 2:
u += x2
x1 /= 2
x2 *= 2
return u
@EHDEV
EHDEV / index.html
Last active August 29, 2015 14:16
d3 scatter 1
<!-- Author: eliashussen -->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>D3 Test</title>
<script src="http://d3js.org/d3.v3.min.js" charset="utf-8"></script>
<style>
div.bar {
@EHDEV
EHDEV / index.html
Last active August 29, 2015 14:16
d3 Scatter Plot 2
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>D3 Test</title>
<script src="http://d3js.org/d3.v3.min.js" charset="utf-8"></script>
<style>
div.bar {
display: inline-block;
width: 20px;
.build
node_modules
package.json
makefile