Skip to content

Instantly share code, notes, and snippets.



View GitHub Profile
maksadbek /
Created Jan 19, 2022 — forked from gerrymanoim/
Code from Modern "Python Dictionaries A confluence of a dozen great ideas - Raymond Hettinger"
import array
import collections
import itertools
# Placeholder constants
FREE = -1
DUMMY = -2
class Dict(collections.MutableMapping):
'Space efficient dictionary with fast iteration and cheap resizes.'
maksadbek / lisp.cpp
Created Aug 30, 2021 — forked from ofan/lisp.cpp
Lisp interpreter in 90 lines of C++
View lisp.cpp
Lisp interpreter in 90 lines of C++
I've enjoyed reading Peter Norvig's recent articles on Lisp. He implements a Scheme interpreter in 90 lines of Python in the first, and develops it further in the second.
Just for fun I wondered if I could write one in C++. My goals would be
1. A Lisp interpreter that would complete Peter's test cases correctly...
2. no more than 90 lines of C++.
Although I've been thinking about this for a few weeks, as I write this I have not written a line of the code. I'm pretty sure I will achieve 1, and 2 will be... a piece of cake!
maksadbek / primes.go
Created Mar 13, 2021
Calculate primes using Doug McIlroy's idea:
View primes.go
package main
import "sync"
func primes() {
var recur func(ch chan int)
wg := sync.WaitGroup{}
recur = func(ch chan int) {
p := <-ch
View reddit.go
package main
import (
func web() string {
maksadbek /
Created Dec 12, 2020 — forked from dmmeteo/
SOLID Principles explained in Python with examples.
Single Responsibility Principle
“…You had one job” — Loki to Skurge in Thor: Ragnarok
A class should have only one job.
If a class has more than one responsibility, it becomes coupled.
A change to one responsibility results to modification of the other responsibility.
class Animal:
def __init__(self, name: str):
View index.html
<!DOCTYPE html>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
View postgresql.sql
create table model(
id serial primary key,
name text,
tags text[]
insert into model(name, tags) values ('a', array['a', 'b', 'c']);
insert into model(name, tags) values ('b', array['b', 'b', 'c']);
select unnest(tags) as tag, count(*) from model group by tag;
View gist:a687c9f4cd8ef496b45b05ebb070d92a
def tushar(string, pattern):
dp = [[False] * (len(pattern) + 1) for _ in range(len(string) + 1)]
dp[0][0] = True
for i in range(1, len(pattern)+1):
if pattern[i-1] == "*":
dp[0][i] = dp[0][i-2]
for i in range(1, len(string)+1):
for j in range(1, len(pattern)+1):
View stack.go
package main
import (
type item struct {
value interface{} //value as interface type to hold any data type
next *item

Keybase proof

I hereby claim:

  • I am maksadbek on github.
  • I am maksadbek ( on keybase.
  • I have a public key ASDxk49bUd8ci5rY6JODHCe_JEpdyWsw-bxlyfjyWU-jtwo

To claim this, I am signing this object: