Skip to content

Instantly share code, notes, and snippets.

View paulohrpinheiro's full-sized avatar
🏠
Working from home

Paulo Henrique Rodrigues Pinheiro paulohrpinheiro

🏠
Working from home
View GitHub Profile
@paulohrpinheiro
paulohrpinheiro / main.rs
Created January 15, 2017 17:25
Arquivos para o texto # Rust Pills - resolvendo nomes por DNS
[package]
name = "resolver"
version = "0.1.0"
authors = ["Paulo Henrique Rodrigues Pinheiro <[email protected]>"]
[dependencies]
libc = "0.2.8"
@paulohrpinheiro
paulohrpinheiro / how_many.rb
Created April 4, 2017 14:15
Quantos números aleatórios gero em 1 segundo? - Ruby
# frozen_string_literal: true
require 'timeout'
how_many = 0
rand_generator = Random.new
begin
Timeout.timeout(1) do
loop do
@paulohrpinheiro
paulohrpinheiro / how_many.py
Created April 4, 2017 14:27
Quantos números aleatórios gero em 1 segundo? - Python
import sys
import random
import signal
def handler(signum, frame):
print(how_many)
sys.exit()
signal.signal(signal.SIGALRM, handler)
@paulohrpinheiro
paulohrpinheiro / how_many.c
Created April 4, 2017 14:41
Quantos números aleatórios gero em 1 segundo? - 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) {
@paulohrpinheiro
paulohrpinheiro / mbfr.go
Created November 2, 2017 18:58
Meu BrianFuck reduzido escrito em GO
package main
import (
"bufio"
"fmt"
"log"
"os"
)
type Language struct {
@paulohrpinheiro
paulohrpinheiro / draw.go
Last active June 6, 2023 18:04
GOLANG program to create png files
package main
import (
"image"
"image/color"
"image/png"
"os"
)
@paulohrpinheiro
paulohrpinheiro / mandel.go
Created December 12, 2019 18:03
Mandelbrot Fractal draw
package main
import (
"image"
"image/color"
"image/png"
"math/cmplx"
"os"
"sync"
)
@paulohrpinheiro
paulohrpinheiro / types.go
Created December 13, 2019 11:53
Working with unknown types in go
package main
import "fmt"
// Void - a generic type
type Void struct {
value interface{}
}
func work(universe map[int]interface{}, v Void) {
package main
import (
"image"
"image/color"
"image/png"
"math"
"os"
"sync"
)
@paulohrpinheiro
paulohrpinheiro / primitives.go
Created May 25, 2020 10:44
Scheme primitives
package primitives
import (
"errors"
"reflect"
)
// The definitions in functions are from THE book:
// Friedman & Felleisen. The Little Schemer, Fourth Edition, MIT Press, 1996.