Skip to content

Instantly share code, notes, and snippets.

View phrozen's full-sized avatar

Guillermo Estrada phrozen

View GitHub Profile
@phrozen
phrozen / main.go
Created December 11, 2023 21:07
Advent of Code 2023 - Day 7
package main
import (
"advent/utils"
"fmt"
"math"
"sort"
"strconv"
"strings"
)
@phrozen
phrozen / main.go
Created December 11, 2023 02:54
Advent of Code 2023 - Day 4
package main
import (
"fmt"
"math"
"os"
"regexp"
"slices"
"strings"
)
@phrozen
phrozen / main.go
Created March 28, 2012 23:51
Peter De Jong Attractors in Go
/*
Processing version
http://www.openprocessing.org/sketch/2097
by Thor Frølich
Go version
by Guillermo Estrada
*/
package main
package main
import (
"encoding/json"
"fmt"
"math/rand"
"net/http"
"strings"
"time"
@phrozen
phrozen / Dockerfile
Created February 22, 2021 21:56
Golang Dockerfile template for binary only images
# 1. Build a statically linked binary
FROM golang:alpine as builder
# Install git to install dependencies (skip if vendored)
RUN apk add --update --no-cache git
# Copy source code to working directory
COPY . /src
WORKDIR /src
# Add some env vars for the build process
ENV CGO_ENABLED=0
ENV GOOS=linux
@phrozen
phrozen / docker-compose.yml
Created August 15, 2019 15:40
InfluxData TICK stack (InfluxDB + Telegraf + Kapacitor + Chronograf + CLI)
version: '3'
services:
# Define an InfluxDB service
influxdb:
image: influxdb:latest
volumes:
# Mount for influxdb data directory
- ./data/influxdb:/var/lib/influxdb
# Mount for influxdb configuration
@phrozen
phrozen / docker-compose.yml
Created August 14, 2019 20:25
Go App + InfluxDB + Telegraf + Graphana
# start: docker-compose up
# tear down: docker-compose down
version: '3'
services:
server:
build:
context: .
ports:
- "8010:8010"
influxdb:
@phrozen
phrozen / sqlitemark.lua
Created July 6, 2012 19:53
SQLite ffi library benchmark with LuaJit implementation.
local sql = require "ffi/ljsqlite3"
-- Global Variables
local singledb = "single.sqlite"
local manydb = "multi.sqlite"
local elapsed = 0
local times = {}
local values = 1000000
local tables = 1000
local x, y, z = {}, {}, {}
# Proyecto 2
# Ray Tracer Avanzado
# Guillermo Estrada
# Rene Garcia
# Edgar López
# Luis Ledezma
# Daniel Castillo
#
# Constantes utilizadas dentro del programa
MAX_DISTANCE = 9999999999
# scene.txt
# image_size: width height (default 320x240)
image_size 640 640
# trace depth: int (default 3)
depth 5
# oversampling: int (default 1 = no oversampling)
oversampling 2