Skip to content

Instantly share code, notes, and snippets.

Luis Lavena luislavena

Block or report user

Report or block luislavena

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
View .gitconfig
[core]
autocrlf = false
excludesfile = ~/.gitignore.global
[color]
ui = auto
[push]
default = current
followTags = true
View build-crystal-locally.log
$ crystal --version
Crystal 0.24.2 [4f9ed8d03] (2018-03-08)
LLVM: 4.0.0
Default target: x86_64-unknown-linux-gnu
$ time make crystal stats=true
Using /usr/bin/llvm-config-5.0 [version=5.0.0]
g++ -c -o src/llvm/ext/llvm_ext.o src/llvm/ext/llvm_ext.cc -I/usr/lib/llvm-5.0/include -std=c++0x -fuse-ld=gold -Wl,--no-keep-files-mapped -Wl,--no-map-whole-files -fPIC -fvisibility-inlines-hidden -Werror=date-time -std=c++11 -Wall -W -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wno-maybe-uninitialized -Wdelete-non-virtual-dtor -Wno-comment -ffunction-sections -fdata-sections -O2 -DNDEBUG -g1 -fno-exceptions -DLLVM_BUILD_GLOBAL_ISEL -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS
cc -fPIC -c -o src/ext/sigfault.o src/ext/sigfault.c
@luislavena
luislavena / ubuntu-wsl.aptfile
Last active Apr 5, 2018
Quick setup of my Ubuntu (WSL)
View ubuntu-wsl.aptfile
#!/usr/bin/env aptfile
# NOTE:
# This script uses `bash-aptfile`, which can be obtained from GitHub:
# https://github.com/seatgeek/bash-aptfile
#
# Once `aptfile` has been installed (per instructions), you can invoke this
# script with `sudo`:
#
# $ sudo aptfile path/to/my_setup.aptfile
@luislavena
luislavena / 0-intro.md
Last active Aug 31, 2018
Collecting information about Ruby gems installed
View 0-intro.md

Introduction

Hello! I'm doing some analysis of installed Ruby gems, specially those that require a compiler toolchain to be installed.

This analysis will help me determine an usage pattern and potentially work with gem authors to improve platform support for those gems.

Will be great if you can help me collect this information.

View foo.cr
abstract class Foo
VERBS = %w(GET POST PUT)
{% for method in ::Foo::VERBS %}
macro {{ method.downcase.id }}(*args, **params)
\{% params[:via] = {{ method.downcase }} %}
match(\{{*args}}, \{{**params}})
end
{% end %}
View bench-5340.cr
require "benchmark"
class Foo
getter query : String?
def initialize(@query)
end
def method1
@query if @query && !@query.try(&.empty?)
@luislavena
luislavena / 2-console-output.log
Last active Oct 2, 2017
Docker + VirtualBox VM + Alpine - FS issue
View 2-console-output.log
$ pwd
/home/luis/code/_sandbox/testing-alpine
$ echo 'foo' > file.txt
$ ls
file.txt
$ cat file.txt
foo
View beryl_action.cr
require "../src/beryl"
# This sample showcases how to use a separate action
class HelloRouter < Beryl::Router
routing do
get "/", HelloAction
end
end
class HelloAction
View multi-servers.cr
require "http/server"
server1 = HTTP::Server.new(8080) do |ctx|
ctx.response.status_code = 200
ctx.response.headers["Content-Type"] = "text/plain"
ctx.response.puts "Hello World! #1"
end
server2 = HTTP::Server.new(8081) do |ctx|
ctx.response.status_code = 200
View 1-bench-uri-path-regex.cr
require "benchmark"
require "uri"
RESOURCE = URI.parse "http://localhost:3000/path?param=value"
def use_uri_path(uri)
uri.path
end
def use_uri_full_path_and_regex(uri)
You can’t perform that action at this time.