Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Paulo Henrique Rodrigues Pinheiro paulohrpinheiro

🏠
Working from home
View GitHub Profile
@paulohrpinheiro
paulohrpinheiro / README
Created Apr 18, 2021 — forked from rdebath/README
Original brainfuck distribution by Urban Müller
View README
This archive contains the following programs:
bfc The compiler for the 'brainfuck' language (240 bytes!)
bfc.asm Source for the compiler
bfi The interpreter for the 'brainfuck' language
bfi.c Source for the interpreter (portable)
src/ Some example programs in 'brainfuck'
src/atoi.b Reads a number from stdin
src/div10.b Divides the number under the pointer by 10
src/hello.b The ubiquitous "Hello World!"
@paulohrpinheiro
paulohrpinheiro / go-generics.txt
Created Sep 3, 2020
Colinha pra instalar o compilador com suporte a generics
View go-generics.txt
Seguindo a receita em https://golang.org/doc/install/source
Tendo o go instalado, em meu fedora tive que instalar o pacote gccgo,:
gcc-go-10.1.1-1.fc32.x86_64 Go support
libgo-10.1.1-1.fc32.x86_64 Go runtime
libgo-devel-10.1.1-1.fc32.x86_64 Go development libraries
Voltando às instruções:
@paulohrpinheiro
paulohrpinheiro / bg.zig
Created Jul 11, 2020
A BF in zig (beggining)
View bg.zig
const std = @import("std");
const MEMORY_SIZE :i32 = 30_000;
fn execute(program: []const u8) [MEMORY_SIZE]i8 {
var memory :[MEMORY_SIZE]i8 = [_]i8{0} ** MEMORY_SIZE;
var memory_index: u32 = 0;
var output = std.ArrayList(u8).init(std.heap.page_allocator);
defer output.deinit();
View primitives.go
package primitives
import (
"errors"
"reflect"
)
// The definitions in functions are from THE book:
// Friedman & Felleisen. The Little Schemer, Fourth Edition, MIT Press, 1996.
View somegraph.go
package main
import (
"image"
"image/color"
"image/png"
"math"
"os"
"sync"
)
@paulohrpinheiro
paulohrpinheiro / types.go
Created Dec 13, 2019
Working with unknown types in go
View types.go
package main
import "fmt"
// Void - a generic type
type Void struct {
value interface{}
}
func work(universe map[int]interface{}, v Void) {
@paulohrpinheiro
paulohrpinheiro / mandel.go
Created Dec 12, 2019
Mandelbrot Fractal draw
View mandel.go
package main
import (
"image"
"image/color"
"image/png"
"math/cmplx"
"os"
"sync"
)
@paulohrpinheiro
paulohrpinheiro / draw.go
Last active Feb 18, 2019
GOLANG program to create png files
View draw.go
package main
import (
"image"
"image/color"
"image/png"
"os"
)
@paulohrpinheiro
paulohrpinheiro / mbfr.go
Created Nov 2, 2017
Meu BrianFuck reduzido escrito em GO
View mbfr.go
package main
import (
"bufio"
"fmt"
"log"
"os"
)
type Language struct {
@paulohrpinheiro
paulohrpinheiro / how_many.c
Created Apr 4, 2017
Quantos números aleatórios gero em 1 segundo? - C
View how_many.c
#include <stdio.h> // printf
#include <unistd.h> // alarm
#include <signal.h> // signal
#include <stdlib.h> // exit
#include <stdbool.h> // true
int64_t how_many;
void handler(int signal) {
if (signal==SIGALRM) {