Skip to content

Instantly share code, notes, and snippets.

View amirouche's full-sized avatar

Amir Amazigh BOUBEKKI amirouche

View GitHub Profile
@amirouche
amirouche / thinkero.md
Last active June 14, 2022 21:00
thinkero brainstorming

Thinkero

Licensed with cc-by-sa. You must mail amirouche@hyper.dev if you use this work. Thank you!

But I because I'm poor, I have only my dreams
I spread my dreams under your feet,
Tread softly because you tread on my dreams
@amirouche
amirouche / frontend.py
Created March 6, 2022 18:13
Frontend controlled by the backend
from collections.abc import Iterable
from uuid import uuid4
from hyperdev.base import HyperDevException
class FrontendException(HyperDevException):
pass
@amirouche
amirouche / aiohttp+websockets.md
Last active January 17, 2022 09:14
aiohttp server with websocket

** aiohttp now supports in its webframework websocket **

http://aiohttp.readthedocs.org/en/v0.14.1/web.html#websockets

This is a quick hack (ported from django-c10k) to get websocket working along side classic http with aiohttp web server. I think it would be better to inherit the aiohttp.web.RequestHandler and add the code to handle the upgrade in RequestHandler.start instead of overriding RequestHandler.transport.close in WebsocketResponse.

Anyway, it seems like it works.

requirements:

@amirouche
amirouche / index.haml
Created January 4, 2022 15:31
Parallax Star background in CSS
<link href='https://fonts.googleapis.com/css?family=Lato:300,400,700' rel='stylesheet' type='text/css'>
#stars
#stars2
#stars3
#title
%span
PURE CSS
%br
%span
PARALLAX PIXEL STARS
@amirouche
amirouche / avsl-nutshell.txt
Created June 22, 2021 12:00 — forked from johnwcowan/avsl-nutshell.txt
AVSL (A Very {Simple|Small|Safe} Language) in a nutshell
Goals:
Easy to learn and use by beginning programmers
Easy to relearn and use by "perpetual intermediate" programmers
Suitable for use as a front-end language (not in a browser)
Not infuriating to advanced programmers
Case insensitive (except strings)
Everything should be as simple as possible but no simpler
High-level design choices:
Mostly intended for easy UI programming
@amirouche
amirouche / scheme-is.scm
Created August 6, 2020 19:45
some markov chains using scheme
% ./venv scheme --program src/arew.scm eval src/bibendum.scm
;; ("% scheme is mayonnaise")
% ./venv scheme --program src/arew.scm eval src/bibendum.scm
;; ("% scheme is tail recursive tail calls have doubts d suggest that mdhughes take the insulting condescenscion elsewhere but call and then you woke up r6rs libraries also can t run benchmarks yet especially east being prefix and suffix")
% ./venv scheme --program src/arew.scm eval src/bibendum.scm
;; ("% scheme is my proposal for topological sort what does plenken mean")
% ./venv scheme --program src/arew.scm eval src/bibendum.scm
# cat foo.scm
(define y_foundationdb_status.scm
'((cluster (layers (_valid . #t) (_error . "some error description")) (processes ($map_key=zoneid (version . "3.0.0") (machine_id . "0ccb4e0feddb5583010f6b77d9d10ece") (locality ($map_key=localityName . "value")) (class_source ($enum . #("command_line" "configure_auto" "set_class"))) (class_type ($enum . #("unset" "storage" "transaction" "resolution" "proxy" "master" "test"))) (degraded . #t) (roles . #(((query_queue_max . 0) (local_rate . 0) (input_bytes (hz . 0.0) (counter . 0) (roughness . 0.0)) (stored_bytes . 12341234) (kvstore_used_bytes . 12341234) (kvstore_available_bytes . 12341234) (kvstore_free_bytes . 12341234) (kvstore_total_bytes . 12341234) (durable_bytes (hz . 0.0) (counter . 0) (roughness . 0.0)) (queue_disk_used_bytes . 12341234) (queue_disk_available_bytes . 12341234) (queue_disk_free_bytes . 12341234) (queue_disk_total_bytes . 12341234) (role ($enum . #("master" "proxy" "log" "storage" "resolver" "cluster_controller" "data_distributor" "ra
(require 'package)
(add-to-list
'package-archives
'("melpa" . "http://melpa.org/packages/") t)
(add-to-list
'package-archives
'("elpy" . "http://jorgenschaefer.github.io/packages/"))
src$ ./run-chibi.sh
((json-checks) i_number_double_huge_neg_exp.json)
((json-checks) i_number_huge_exp.json)
((json-checks) i_number_neg_int_huge_exp.json)
((json-checks) i_number_pos_double_huge_exp.json)
((json-checks) i_number_real_neg_overflow.json)
((json-checks) i_number_real_pos_overflow.json)
((json-checks) i_number_real_underflow.json)
((json-checks) i_number_too_big_neg_int.json)
((json-checks) i_number_too_big_pos_int.json)
@amirouche
amirouche / crawler.py
Created September 9, 2019 13:34
pyqt5 webkit + lxml example
import sys
from PyQt5.QtGui import *
from PyQt5.QtCore import *
from PyQt5.QtWidgets import QApplication
from PyQt5.QtWebKitWidgets import *
from lxml import html
#Take this class for granted.Just use result of rendering.
class Render(QWebPage):
def __init__(self, url):