Skip to content

Instantly share code, notes, and snippets.

Bruno Kim Medeiros Cesar brunokim

Block or report user

Report or block brunokim

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@brunokim
brunokim / parser.py
Last active Apr 10, 2019
Prol: a minimal, inefficient Prolog interpreter in a few LOCs of Python
View parser.py
from prol import is_compound, to_list, solve
def parser_clauses():
"""Return clauses for parsing a limited subset of Prolog.
"""
clauses = []
def add_fact(term):
add_clause(term)
def add_clause(head, *body):
assert is_compound(head), head
@brunokim
brunokim / mwe.py
Last active Mar 8, 2019
pytype difficulties with classmethod
View mwe.py
from typing import Generic, List, TypeVar
T = TypeVar('T')
class Container(Generic[T]):
def __init__(self, x: T):
self.x = x
def __repr__(self):
return f'<Container {self.x}>'
View forca.c
#include <stdio.h>
#include <stdlib.h>
#include <locale.h>
#include <time.h>
#include <string.h>
#include <stdbool.h>
void imprime_corpo(int i) {
char desenhos[][6] = {
// vida = 0
@brunokim
brunokim / project.clj
Created May 16, 2016
Failing cljsbuild project
View project.clj
;; project.clj
(defproject mwe "0.0.1"
:dependencies [[org.clojure/clojure "1.7.0"]
[org.clojure/clojurescript "1.8.51"]
[compojure "1.4.0"]
[ring "1.1.6"]
[ring/ring-defaults "0.1.5"]]
:source-paths ["src/clj" "src/cljs"]
:plugins [[lein-ring "0.9.7"]
View Call.class
 ˛∫æ13Calljava/lang/Objectcall.ws<init>()V 
main([Ljava/lang/String;)Vjava/io/InputStreamReader java/lang/SysteminLjava/io/InputStream;  (Ljava/io/InputStream;)V 
java/util/Scanner
java/util/HashMap
[Ljava/lang/Object;ˇˇˇˇ
errLjava/io/PrintStream; "# $java/io/PrintStream&print(I)V ()
'*(C)V (,
'-CodeLineNumberTable
SourceFile!0*∑ ±
@brunokim
brunokim / ExpectedExceptionTest.java
Last active Sep 21, 2016
Example of stacktrace hiding with ExpectedException rule
View ExpectedExceptionTest.java
// I'm not sure this is the minimal possible example, edits are welcome
package assertion;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.junit.runner.RunWith;
@brunokim
brunokim / sum_test.c
Created Feb 6, 2014
Testing a chaotic function with different rounding modes for all float values.
View sum_test.c
// Compiled with gcc -o sum_test -O0 --std=c99 sum_test.c -lm -Wall -Wextra
#include <assert.h>
#include <math.h>
#include <fenv.h>
#include <stdio.h>
#include <stdint.h>
#include <stdbool.h>
// Based on
// http://randomascii.wordpress.com/2014/01/27/theres-only-four-billion-floatsso-test-them-all/
You can’t perform that action at this time.