Skip to content

Instantly share code, notes, and snippets.

timeline
    title History of Social Media Platform
    2002 : LinkedIn
    2004 : Facebook
         : Google
    2005 : Youtube
    2006 : Twitter
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]
"""
# exprassemble
Generate 8086 code for a given infix expression
It creates .asm yet it can't print the output
## Steps
@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"]])
@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

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 / 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;
#include "headers/audio.h"
#define fifo_threshold 96 //Audio out fifo
/****************************************************************************************
* For playing the audio contained in passed array
****************************************************************************************/
void play_audio(int audio[],int audio_len)
{
int fifospace;
from django.apps import AppConfig
class UsersConfig(AppConfig):
name = "users"
@selimslab
selimslab / filters.py
Last active June 7, 2020 18:47
an API to explore mobile user events , built with Django REST, has filter, group, sort, and aggregate
from django_filters.rest_framework import FilterSet
from django_filters import DateFromToRangeFilter
from api.models import Record
from django_filters.rest_framework import DjangoFilterBackend
from rest_framework import filters
class CustomFilter(FilterSet):
date = DateFromToRangeFilter()