Skip to content

Instantly share code, notes, and snippets.

@selimslab
selimslab / robot.cpp
Created May 23, 2020 12:33
a mobile robot. obstacle avoiding, path-finder. built using Raspberry Pi, ROS, C++, and A* algorithm
#include <iostream>
#include <tuple>
#include <cmath>
const double PI = 3.141592653589793238463;
using namespace std;
class RobotController {
float robotRadius = 0.1;

You are a professional robber planning to rob houses along a street.

Each house has a certain amount of money stashed.

Meanwhile, adjacent houses have security system connected and it will automatically contact the police if two adjacent houses were broken into on the same night.

q1: max robbery ?

q2: what if houses form a circle so the first and last are neighbors ?

@selimslab
selimslab / pas.py
Last active May 27, 2020 21:31
a simple interpreter in python
"""
Here be dragons
This is a basic interpreter
a computer program is just text. Compilers and interpreters translate this text for the machine
let's say our program is 2 * 7 + 3
1. First step is lexical analysis, a fancy term for tokenizing
@selimslab
selimslab / get_gists.py
Last active December 23, 2023 15:52 — forked from leoloobeek/get_gists.py
Download all gists of a user
import sys
from subprocess import call
import json
import os
import requests
def download_gists(gists: list):
for gist in gists:
call(["git", "clone", gist["git_pull_url"]])
"""
# exprassemble
Generate 8086 code for a given infix expression
It creates .asm yet it can't print the output
## Steps
import csv
import yaml
import ipaddress
from intervaltree import IntervalTree, Interval
def read_csv_lines(file):
with open(file, 'r') as file:
csv_reader = csv.reader(file)
return [row[0] for row in csv_reader]
timeline
    title History of Social Media Platform
    2002 : LinkedIn
    2004 : Facebook
         : Google
    2005 : Youtube
    2006 : Twitter