Skip to content

Instantly share code, notes, and snippets.

View OzTamir's full-sized avatar

Oz Tamir OzTamir

View GitHub Profile
@OzTamir
OzTamir / custom.aliases.bash
Last active August 21, 2016 11:25
Bash-it confguration
#!/usr/bin/env bash
# Go home!
alias home="cd ~"
# Edit custom aliases
alias bashconf="sublime ~/.bash_it/aliases/custom.aliases.bash"
# Edit .bash_profile
alias bashitconf="sublime ~/.bash_profile"
@OzTamir
OzTamir / threadpool.py
Last active March 28, 2016 07:55
It's time to chimichanga! make the
####################################
#
# threadpool.py - A utility class to manage a task queue with threads
# Author: Oz Tamir
#
####################################
import random
import logging
from Queue import Queue
@OzTamir
OzTamir / ObstaclesDetector.cpp
Last active September 13, 2018 14:24
Detect obstacles using the RPLidar Sensor (and the GBLIDAR Class from here: https://gist.github.com/OzTamir/ddf8d856ec03b723d273)
#include "ObstaclesDetector.h"
using namespace GBCode;
ObstaclesDetector::ObstaclesDetector(double distanceThreshold, double resolution)
{
this->distanceThreshold = distanceThreshold;
this->resolution = resolution;
lidar = new GBLIDAR();
@OzTamir
OzTamir / GBLIDAR.cpp
Last active February 11, 2016 18:54
A class to interface with the RPLidar Sensor
#include "GBLIDAR.h"
using namespace GBCode;
GBLIDAR::GBLIDAR(const char * com_path, _u32 com_baudrate)
{
drv = RPlidarDriver::CreateDriver(RPlidarDriver::DRIVER_TYPE_SERIALPORT);
// make connection...
if (IS_FAIL(drv->connect(com_path, com_baudrate))) {
@OzTamir
OzTamir / http2_parser.py
Last active November 9, 2015 17:46
Parse raw HTTP/2 packets
import struct
FRAME_TYPES = {
0x0 : 'DATA',
0x1 : 'HEADERS',
0x2 : 'PRIORITY',
0x3 : 'RST_STREAM',
0x4 : 'SETTINGS',
0x5 : 'PUSH_PROMISE',
0x6 : 'PING',
@OzTamir
OzTamir / markov.py
Created October 27, 2015 13:00
Markov Chains in Python
import random
class Markov(object):
def __init__(self, file):
self.cache = {}
self.file = file
self.words = self.file_to_words()
self.word_size = len(self.words)
self.database()

This is a git submodule test.

@OzTamir
OzTamir / merge_sort.html
Created August 18, 2015 10:34
Merge sort example in JS
<!DOCTYPE html>
<html>
<head>
<script src="merge_sort.js"></script>
<title>Merge Sort</title>
</head>
<body>
<h1>Merge Sort!</h1>
<span>
Array: <p id="arrayText">[7, 4, 2, 3, 8, 6, 1, 5, -1, 100]</p>
@OzTamir
OzTamir / get_hadoop.sh
Created July 7, 2015 13:07
Usage: $ ./get_hadoop.sh PASSWORD
#!/usr/bin/env bash
# Make sure everything is up-to-date
echo "Updating apt"
echo $1 | sudo -S apt-get update
echo $1 | sudo -S apt-get upgrade
# Java SDK installation
echo "Installing Java"
echo $1 | sudo -S apt-get install rsync openjdk-7-jre-headless openjdk-7-jdk
@OzTamir
OzTamir / linked_string.c
Created April 9, 2015 12:55
Simple program that represent strings as a linked list of chars.
// linked_string.c
// ------------
// Simple program that represent strings as a linked list of chars.
// It takes arguments from the command line and print using this method.
// ------------
// Created by Oz Tamir on 4/9/15.
// ------------
#include <stdio.h>
#include <stdlib.h>