Skip to content

Instantly share code, notes, and snippets.

View EntilZha's full-sized avatar
👨‍🔬

Pedro Rodriguez EntilZha

👨‍🔬
View GitHub Profile
@EntilZha
EntilZha / gist:dcea1ad24d126105d9c3
Created July 2, 2014 22:34
install_graphite_server
if [[ ! -f "/opt/graphite/bin/carbon-cache.py" ]]; then
wget -qNP /tmp https://github.com/downloads/graphite-project/whisper/whisper-0.9.10.tar.gz
tar -C /tmp -zxf /tmp/whisper-0.9.10.tar.gz
cd /tmp/whisper-0.9.10
python setup.py install
wget -qNP /tmp https://github.com/downloads/graphite-project/carbon/carbon-0.9.10.tar.gz
tar -C /tmp -zxf /tmp/carbon-0.9.10.tar.gz
cd /tmp/carbon-0.9.10
python setup.py install
Topic 0: adhering(948), amplification(838), autonomous(766), bower(748), airborne(748), amplifying(738), bination(698), acl(695), buy(688), assume(663), acldey(658), bypass(657), account(653), appendix(641), busy(636),
Topic 1: aut(1107), biggest(1020), accents(1020), associative(955), barron(954), barrier(945), adap(927), austin(906), adam(906), aration(882), burges(806), affecting(801), affects(794), afferent(759), acyclic(757),
Topic 2: boser(876), apex(716), berlin(704), automaton(654), atypical(608), aliasing(608), ariaboost(585), barak(571), accumulated(559), attias(555), ang(531), antennas(525), antennae(516), annu(498), biological(490),
Topic 3: activating(1192), acceleration(836), accent(798), ary(794), bahl(792), brosch(791), acceptance(751), aggregate(707), blowfly(662), aggregation(648), beneath(635), bringing(630), benchmarks(623), backprop(617), caption(601),
Topic 4: arl(949), boot(907), baluja(884), carefully(769), capacitances(734), bonn(728), bfilthoff(720), ballard(704), buffer(690), carpen
@EntilZha
EntilZha / proposal.md
Last active August 29, 2015 14:19
Ampcrowd JS Template

AMPCrowd Template Proposal

Task API

Task Group

  • group_id
  • tasks_finished
  • callback_url
  • group_context
  • crowd_config

Task

@EntilZha
EntilZha / main.rs
Created October 6, 2015 06:35
Rust code trying to implement the EM algorithm for a simple example
fn main() {
let observations = [5, 9, 8, 4, 7];
let (theta_a, theta_b) = em(0.5, 0.5, observations);
println!("ThetaA: {}, ThetaB: {}", theta_a, theta_b);
}
fn em(theta_a_0: f64, theta_b_0: f64, observations: [i32; 5]) -> (f64, f64) {
let mut theta_a = theta_a_0;
let mut theta_b = theta_b_0;
let a_probs = observations.iter().map(|x| binomial(theta_a, *x, 10));
@EntilZha
EntilZha / hashtable.py
Last active December 18, 2022 05:37
Hash Table (Open Address) implementation in Python practicing for interviews
from collections import namedtuple
TableEntry = namedtuple('Element', 'hash key value')
class HashTable(object):
DEFAULT_SIZE = 8
EMPTY_VALUE = TableEntry(None, None, None)
DELETED_VALUE = TableEntry(None, None, None)
LOAD_FACTOR = 2 / 3
MIN_FACTOR = 1 / 3
@EntilZha
EntilZha / Max Interval.ipynb
Created November 18, 2015 21:54
Max Interval Solution
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@EntilZha
EntilZha / RDD.cpp
Last active December 5, 2015 01:41
#include <iostream>
#include <vector>
using namespace std;
template <typename A>
class RDD {
public:
vector<A> sequence;
RDD(vector<A> sequence): sequence(sequence) {}
@EntilZha
EntilZha / graph.rs
Last active February 24, 2016 18:12
use std::collections::HashMap;
#[derive(Debug)]
pub struct Graph<V: Copy, E: Copy> {
pub vertexes: HashMap<usize, Vertex<V>>,
pub edges: HashMap<(usize, usize), E>,
adjacency_matrix: Vec<Vec<bool>>
}
#[derive(Debug)]
[package]
name = "ffitest"
version = "0.1.0"
authors = ["Pedro Rodriguez <ski.rodriguez@gmail.com>"]
[dependencies]
[lib]
name = "ffitest"
crate-type = ["dylib"]
pub struct BfsIterator<'a, V: 'a + Copy, E: 'a + Copy> {
queue: VecDeque<VertexId>,
graph: &'a Graph<V, E>,
distances: Vec<u64>,
parents: Vec<VertexId>,
predicate: &'a Fn(V, E, V) -> bool
}
impl<'a, V: Copy, E: Copy> Graph<V, E> {
pub fn bfs_iter(&'a self, source: VertexId) -> BfsIterator<V, E> {