Skip to content

Instantly share code, notes, and snippets.

View nilp0inter's full-sized avatar

Roberto Abdelkader Martínez Pérez nilp0inter

View GitHub Profile

Keybase proof

I hereby claim:

  • I am nilp0inter on github.
  • I am nilp0inter (https://keybase.io/nilp0inter) on keybase.
  • I have a public key ASCWHPy74-j6RBcLmM5GKoWVhhEtQjocncvd4I45XV45lgo

To claim this, I am signing this object:

There are 24 handle(s) keeping the process running
# TTYWRAP
(unknown stack trace)
# DNSCHANNEL
(unknown stack trace)
# TickObject
/home/nil/Project/nixpkgs/node_modules/readable-stream/lib/_stream_readable.js:905 - process.nextTick(resume_, stream, state);
from experta import *
import types
class ReturningEngine(KnowledgeEngine):
def run(self, steps=float('inf'), generate=False):
if not generate:
to_return = list()
for rhs in self._run_activations(steps=steps):
res = rhs()
@nilp0inter
nilp0inter / fizzbuzz.rkt
Last active January 7, 2020 13:06
The first beautiful implementation of FizzBuzz?
#lang 2d racket
(require 2d/match)
(define (fizz? n)
(= 0 (modulo n 5)))
(define (buzz? n)
(= 0 (modulo n 3)))
@nilp0inter
nilp0inter / workon.fish
Last active March 31, 2016 10:28
fish function compatible with virtualenvwrapper's workon function
function workon
. ~/Envs/$argv[1]/bin/activate.fish
if [ -f ~/Envs/$argv[1]/.project ]
cd (cat ~/Envs/$argv[1]/.project)
end
end
@nilp0inter
nilp0inter / lefinale.py
Created February 26, 2016 16:09
Non blocking file reader for python asyncio
import asyncio
import sys
import os
LOOP = asyncio.get_event_loop()
class AsyncFile:
def __init__(self, filename):
self.filename = filename
@nilp0inter
nilp0inter / diagmagic.py
Last active April 8, 2018 15:29 — forked from dorneanu/diagmagic.py
Embed blockdiag into IPython using ipython-diags
# -*- coding: utf-8 -*-
"""magics for using blockdiag.com modules with IPython Notebook
The module provides magics: %%actdiag, %%blockdiag, %%nwdiag, %%seqdiag, %%packetdiag, %%rackdiag
Sample usage (in IPython cell):
%%blockdiag
{
A -> B -> C;
class Gray:
def __init__(self, length):
self.length = length
def _gen(self, start, end, n):
if n == 1:
yield (start, )
yield (end, )
else:
for s in Gray(n-1):
@nilp0inter
nilp0inter / gray2.py
Created August 28, 2014 21:21
Gray codes generator
class Gray:
def __init__(self, length):
self.length = length
def _right(self, n):
if n == 1:
yield (0,)
yield (1,)
else:
for s in Gray(n-1):
import sys
BAD_VERSIONS = [
(2, 4),
(2, 5),
(2, 6) ]
TRANSLATE_TEXT = sys.version_info[:2] in BAD_VERSIONS