Skip to content

Instantly share code, notes, and snippets.

View adelarsq's full-sized avatar
🐢
I may be really slow to respond.

Adelar da Silva Queiróz adelarsq

🐢
I may be really slow to respond.
View GitHub Profile
@adelarsq
adelarsq / heroku.md
Last active June 25, 2023 13:30
Heroku

Heroku

Heroku é uma plataforma em nuvem baseada em sistemas de containers gerenciados, chamados de Dynos, possuidores de um ambiente de software plugável e configurável, preparados para rodar e depurar sistemas web em um número limitado de linguagens de programação. Uma característica atrativa dessa tecnologia é a facilidade de realizar deploy de sistemas, uma vez que o ambiente é preparado para as diversas linguagens suportadas. Por outro lado, a liberdade de configuração desses ambientes é limitada.

https://pt.wikiversity.org/wiki/Heroku

@adelarsq
adelarsq / hex_editor.lua
Created January 12, 2023 02:40 — forked from RaafatTurki/hex_editor.lua
proper hex editing in neovim
local xxd_dump_cmd = 'xxd -g 1 -u'
local xxd_cur_pos = nil
local function is_binary_file()
local filename = vim.fn.expand('%:t')
-- local basename = string.match(filename, "^[a-z]*$")
local binary_ext = { 'png', 'jpg', 'jpeg', 'out' }
local ext = string.match(filename, "%.([^%.]+)$")
if ext == nil and string.match(filename, '[a-z]+') then return true end
@adelarsq
adelarsq / 00_readme.md
Created July 16, 2022 21:14 — forked from p4bl0-/00_readme.md
A complete compiler for a simple language (in less than 150 LoC)

This project is a tiny compiler for a very simple language consisting of boolean expression.

The language has two constants: 1 for true and 0 for false, and 4 logic gates: ! (not), & (and), | (or), and ^ (xor).

It can also use parentheses to manage priorities.

Here is its grammar in BNF format:

expr ::= "0" | "1"

@adelarsq
adelarsq / Money.fs
Created July 15, 2022 14:25 — forked from nikoloz-pachuashvili/Money.fs
Monetary value modeling in F#
namespace Domain
open System
open System.Runtime.CompilerServices
open System.Globalization
[<AutoOpen>]
module rec Money =
[<Struct;IsReadOnly>]
type Money = private Money of decimal * Currency with
@adelarsq
adelarsq / app.css
Created May 20, 2022 18:15 — forked from mrpmorris/app.css
The CSS I put in the top of every new web app
:root {
box-sizing: border-box;
}
*, ::before, ::after {
box-sizing: inherit;
}
html {
scroll-behavior: smooth;
}
@adelarsq
adelarsq / fsharp-tutorial.fs
Created May 25, 2021 02:40 — forked from odytrice/fsharp-tutorial.fs
F# Code Samples
// This sample will guide you through elements of the F# language.
//
// *******************************************************************************************************
// To execute the code in F# Interactive, highlight a section of code and press Alt-Enter in Windows or
// Ctrl-Enter Mac, or right-click and select "Send Selection to F# Interactive".
// You can open the F# Interactive Window from the "View" menu.
// *******************************************************************************************************
// For more about F#, see:
@adelarsq
adelarsq / ProtobufSerializationTest.fs
Created May 25, 2021 02:29 — forked from object/ProtobufSerializationTest.fs
Protobuf serialization in F#
module ProtobufSerializationTests
open System
open System.IO
open ProtoBuf
open Xunit
module ProtoBufUtils =
[<ProtoContract>]
@adelarsq
adelarsq / latency.txt
Created October 3, 2020 20:40 — forked from jboner/latency.txt
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers (~2012)
----------------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD
// This sample will guide you through elements of the F# language.
//
// *******************************************************************************************************
// To execute the code in F# Interactive, highlight a section of code and press Alt-Enter in Windows or
// Ctrl-Enter Mac, or right-click and select "Send Selection to F# Interactive".
// You can open the F# Interactive Window from the "View" menu.
// *******************************************************************************************************
//
// For more about F#, see:
// http://fsharp.org