Skip to content

Instantly share code, notes, and snippets.

Avatar

Luis Lavena luislavena

View GitHub Profile
View crystal-alpine-static.dockerfile
# syntax = docker/dockerfile:1.2
# ---
FROM alpine:3.12 AS base
# upgrade system and install dependencies
RUN set -eux; \
apk upgrade --no-cache
# download and copy crystal
View wsl.conf
[automount]
enabled=true
mountFsTab=true
options="metadata,uid=1000,gid=1000,fmask=11,umask=22"
[network]
generateHosts=true
generateResolvConf=true
@luislavena
luislavena / 0-source-drone.jsonnet
Last active Aug 24, 2019
Drone CI - missing `purge` when converting jsonnet to YAML
View 0-source-drone.jsonnet
local Pipeline(version) = {
kind: "pipeline",
steps: [
{
name: "build",
image: "plugins/docker",
settings: {
dockerfile: "builder-" + version + ".dockerfile",
registry: "img.company.com",
repo: "img.company.com/builder",
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 / 0-ubuntu-wsl.aptfile
Last active Aug 20, 2019
Quick setup of my Ubuntu (WSL)
View 0-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 Oct 5, 2020
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