Skip to content

Instantly share code, notes, and snippets.

View shankarnakai's full-sized avatar
🤓
System programming, Rust, low latency, Databases

Shankar Nakai Gonçalves dos Santos shankarnakai

🤓
System programming, Rust, low latency, Databases
View GitHub Profile
@dillonstreator
dillonstreator / context-aware-io-copy.md
Last active August 8, 2025 02:34
Golang context aware `io.Copy`
type readerFunc func(p []byte) (n int, err error)

func (rf readerFunc) Read(p []byte) (n int, err error) { return rf(p) }

func Copy(ctx context.Context, dst io.Writer, src io.Reader) error {
	_, err := io.Copy(dst, readerFunc(func(p []byte) (int, error) {
		select {
		case <-ctx.Done():
 return 0, ctx.Err()

Texto original em Inglês: https://gist.github.com/rondy/af1dee1d28c02e9a225ae55da2674a6f

  • FWIW: Eu não produzi o conteúdo apresentado aqui (o esboço do livro de Edmond Lau). Acabei de copiar e colar de algum lugar da Internet, mas não me lembro qual é exatamente a fonte original. Também não consegui encontrar o nome do autor, por isso não posso lhe dar os devidos créditos. *

Engenheiro Eficaz(The Effective Engineer) - Notas

  • Por Edmond Lau
  • Altamente recomendado: +1:
@laughedelic
laughedelic / sbt-dependency-management-guide.md
Last active March 20, 2025 09:36
Explicit dependency management in sbt

Some of these practices might be based on wrong assumptions and I'm not aware of it, so I would appreciate any feedback.

  1. avoiding some dependency conflicts:

    • install sbt-explicit-dependencies globally in your ~/.sbt/{0.13,1.0}/plugins/plugins.sbt
    • run undeclaredCompileDependencies and make the obvious missing dependencies explicit by adding them to libraryDependencies of each sub-project
    • (optionally) run unusedCompileDependencies and remove some obvious unused libraries. This has false positives, so ; reload; Test/compile after each change and ultimately run all tests to see that it didn't break anything
    • (optionally) add undeclaredCompileDependenciesTest to the CI pipeline, so that it will fail if you have some undeclared dependencies
  2. keeping dependencies up to date and resolving conflicts:

    • install sbt-updates globally in your `~/.sbt/{0.13,1.0}/plugins/plugins.
@luismts
luismts / GitCommitBestPractices.md
Last active September 22, 2025 14:09
Git Tips and Git Commit Best Practices

Git Commit Best Practices

Basic Rules

Commit Related Changes

A commit should be a wrapper for related changes. For example, fixing two different bugs should produce two separate commits. Small commits make it easier for other developers to understand the changes and roll them back if something went wrong. With tools like the staging area and the ability to stage only parts of a file, Git makes it easy to create very granular commits.

Commit Often

Committing often keeps your commits small and, again, helps you commit only related changes. Moreover, it allows you to share your code more frequently with others. That way it‘s easier for everyone to integrate changes regularly and avoid having merge conflicts. Having large commits and sharing them infrequently, in contrast, makes it hard to solve conflicts.

@birdayz
birdayz / reflect.json
Created September 23, 2018 23:04
Javalin GraalVM reflection config
[
{
"name": "[Lorg.eclipse.jetty.servlet.ServletMapping;",
"allDeclaredFields": true,
"allPublicFields": true,
"allDeclaredMethods": true,
"allPublicMethods": true
},
{
"name": "org.slf4j.impl.StaticLoggerBinder",
@ronoaldo
ronoaldo / swf2mp4.sh
Created August 8, 2017 20:28
Converte SWF para MP4
#!/bin/bash
echo "swf2mp4.sh - flash player to mp4 conversion script"
echo " * Requires gnash, mplayer2 and ffmpeg CLI tools"
echo " * Source https://stackoverflow.com/a/39304421 (Aleksey Kontsevich)"
SWFFILE=$1
MP4FILE=${SWFFILE%.*}.mp4
TMPFILE=$(cat /dev/urandom | tr -dc 'a-zA-Z' | fold -w 32 | head -n 1).bin
@flyingluscas
flyingluscas / InstallPopcornTime.md
Last active April 19, 2023 01:51
Installing Popcorn Time on Ubuntu 16.x

1. Downloading

32 bits version

$ wget https://get.popcorntime.sh/build/Popcorn-Time-0.3.10-Linux-32.tar.xz -O popcorntime.tar.xz

64 bits version

; Path of Exile macros
; go to hideout
#IfWinActive, Path of Exile
^h:: Send {Enter}+{Home}^c/hideout{Enter}{Enter}^v{Escape}
; logout
#IfWinActive, Path of Exile
$^l:: Send {Enter}+{Home}^c/exit{Enter}{Enter}^v{Escape}
@mrlesmithjr
mrlesmithjr / ansible-macos-homebrew-packages.yml
Last active January 21, 2025 16:34
Install MacOS Homebrew Packages With Ansible
---
- name: Install MacOS Packages
hosts: localhost
become: false
vars:
brew_cask_packages:
- atom
- docker
- dropbox
- firefox
@soroushjp
soroushjp / deepcopy.go
Last active June 14, 2025 11:49
Golang: deepcopy map[string]interface{}. Could be used for any other Go type with minor modifications.
// Package deepcopy provides a function for deep copying map[string]interface{}
// values. Inspired by the StackOverflow answer at:
// http://stackoverflow.com/a/28579297/1366283
//
// Uses the golang.org/pkg/encoding/gob package to do this and therefore has the
// same caveats.
// See: https://blog.golang.org/gobs-of-data
// See: https://golang.org/pkg/encoding/gob/
package deepcopy