Skip to content

Instantly share code, notes, and snippets.

View yuri-potatoq's full-sized avatar
💭
Não posso parar de agregar conhecimento...

yuri-potatoq

💭
Não posso parar de agregar conhecimento...
  • Grupo SBF
  • Brasil
View GitHub Profile
@azagniotov
azagniotov / beautiful.rest.api.docs.in.markdown.md
Last active July 22, 2024 18:34
Example to create beautiful REST API docs in Markdown, inspired by Swagger API docs.
@tadfisher
tadfisher / build.nix
Last active May 16, 2024 14:26
Simplified Nix integration with Gradle
{ lib
, stdenv
, jdk
, gradle
, mavenRepo
}:
stdenv.mkDerivation {
pname = "built-with-gradle";
version = "0.0";
@oxalica
oxalica / flake.nix
Created January 16, 2021 14:49
Rust wasm example development environment
{
inputs = {
nixpkgs.url = github:nixos/nixpkgs/nixos-unstable;
flake-utils.url = github:numtide/flake-utils;
rust-overlay.url = github:oxalica/rust-overlay;
};
outputs = { nixpkgs, flake-utils, rust-overlay, ... }:
flake-utils.lib.eachSystem ["x86_64-linux"] (system: let
pkgs = import nixpkgs {
@fospathi
fospathi / identical_errors_go.md
Last active May 5, 2024 16:15
Why are Go's identical errors not equal?

⚠️ This discussion applies to version 1.13 (released 2019) of the Go language.

Why are Go's identical errors not equal?

Or, more precisely, why are two separate but otherwise seemingly identical errors created by Go's errors.New function not equal according to the == operator?

Consider the output of the following small program (Go Playground link) which compares Go's error values for equality:

package main
@xeoncross
xeoncross / Dockerfile1
Last active April 9, 2024 05:20
Examples of using multi-stage builds with docker and Go to reduce the final image size / attack surface.
# Sample from @citizen428 https://dev.to/citizen428/comment/6cmh
FROM golang:alpine as build
RUN apk add --no-cache ca-certificates
WORKDIR /build
ADD . .
RUN CGO_ENABLED=0 GOOS=linux \
go build -ldflags '-extldflags "-static"' -o app
FROM scratch
COPY --from=build /etc/ssl/certs/ca-certificates.crt \
@TheAngryByrd
TheAngryByrd / Program.fs
Last active May 21, 2024 00:41
Fsharp Websocket Helpers Asp.net Core
namespace fsharp_websocket
module WebsocketHelpers =
open System
open System.Net.WebSockets
open System.Threading
open Hopac
let readMessage buffer messageType (stream : #IO.Stream) (socket : WebSocket) = job {
@CalamarBicefalo
CalamarBicefalo / BearerAuthorizationInterceptor.kt
Created April 11, 2017 14:49
Kotlin extension methods to configure resttemplate to support various oauth2 grant types
import org.springframework.boot.web.client.RestTemplateBuilder
import org.springframework.http.HttpEntity
import org.springframework.http.HttpHeaders
import org.springframework.http.HttpRequest
import org.springframework.http.MediaType
import org.springframework.http.client.ClientHttpRequestExecution
import org.springframework.http.client.ClientHttpRequestInterceptor
import org.springframework.http.client.ClientHttpResponse
import org.springframework.util.Assert
import org.springframework.util.Base64Utils
# Hello, and welcome to makefile basics.
#
# You will learn why `make` is so great, and why, despite its "weird" syntax,
# it is actually a highly expressive, efficient, and powerful way to build
# programs.
#
# Once you're done here, go to
# http://www.gnu.org/software/make/manual/make.html
# to learn SOOOO much more.
@jboner
jboner / latency.txt
Last active July 24, 2024 19:52
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