Skip to content

Instantly share code, notes, and snippets.

@majkrzak
majkrzak / bm_notify.py
Created May 24, 2022 20:19
Quick and dirty desktop notification from brandmeister network.
#!/usr/bin/env python
from socketio import Client as socket_io_client
from json import loads
import dbus
from sys import argv
if __name__ != "__main__":
exit()
\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{paper}
\LoadClass[
10pt,
a4paper,
twocolumn,
twoside
]{article}
from sympy import Matrix, Piecewise
from sympy.geometry import Curve
def cubic_beizer_poly(a,b,c,d,t):
return (Matrix([[a,b,c,d]])*Matrix([[-1,3,-3,1],[3,-6,3,0],[-3,3,0,0],[1,0,0,0]])*Matrix([[t**3],[t**2],[t],[1]])).det()
def cubic_beizer_curve(A,B,C,D,t):
return Curve((
cubic_beizer_poly(A[0],B[0],C[0],D[0],t),
cubic_beizer_poly(A[1],B[1],C[1],D[1],t)),
@interface annotation{Class c() default Object.class;}
@annotation(c=(new Object(){}).getClass())
class C{}
#setattr(ThreadPoolExecutor,'imap',__import__('imap').imap)
from collections import deque
def imap(self, fn, *iterables, timeout=None, limit=None):
if timeout is not None:
end_time = timeout + time.time()
if limit is None:
limit = self._max_workers
argv = zip(*iterables)
fs = deque([self.submit(fn, *next(argv)) for i in range(limit)])
def result_iterator():
@majkrzak
majkrzak / snake.asm
Created August 1, 2014 16:38
Snake like game writen in x86 real mode assembly.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ;;
;; ;;;;;; ;;;;;; ;;
;; ;; ;; ;; ;;
;; ;; ;; ;;;;;; ;;; ;; ;; ;; ;; ;;; ;; ;; ;;;;;; ;;
;; ;;;;;; ;; ;; ;; ;; ;;;;;;; ;;; ;; ;; ;; ;; ;; ;; ;;
;; ;; ;; ;;;;; ;; ;; ;; ;; ;; ; ;; ;; ;; ;;;; ;;;;;; ;;
;; ;; ;; ;; ;;;;;;; ;; ;; ;; ;;; ;;;;;;; ;; ;; ;; ;;
;; ;; ;; ;;;;;; ;; ;; ;;;;;; ;;;;;; ;; ;; ;; ;; ;; ;; ;;;;;; ;;
;; ;;
<doctype html>
<html>
<head>
<script src="http://cdn.peerjs.com/0.3/peer.min.js"></script>
<script src="http://code.jquery.com/jquery-2.1.1.min.js"></script>
<script>
var peer = null;
var conn = null;
function create()
{