Skip to content

Instantly share code, notes, and snippets.

View felipecsl's full-sized avatar
⚒️
Building

Felipe Lima felipecsl

⚒️
Building
View GitHub Profile
@Dids
Dids / Compile_Go_for_Apple_Silicon_M1.md
Last active September 25, 2023 01:55
Compile Go for Apple Silicon (M1)

NOTICE: This guide is no longer relevant, as a lot has changed over time and Go supports Apple Silicon natively just fine now!

Compile Go for Apple Silicon (M1)

Follow these short instructions on how to compile Go for Apple Silicon (M1). From here on out, we may simply refer to it as the "ARM device".

This entire process should only take about 5-10 minutes, but please read through everything carefully, in order to avoid any potential issues along the way.

Note that at the time of writing this, Go was not yet officially available for Apple's ARM.

@joaomilho
joaomilho / peano.ts
Created November 3, 2020 16:43
Fully typed arithmetics with TypeScript 😨
type Nat = ["S", Nat] | ["Z"];
type Succ<N extends Nat> = ["S", N]
type S<N extends Nat> = Succ<N>
type Prev<N extends Nat> = N[1]
type Z = ["Z"]
type Zero = Z
type One = S<Z>
type Two = S<S<Z>>
@Yopadd
Yopadd / async-flat-map.js
Created February 16, 2018 07:15
return a flatten map resolved by async function
async function asyncFlatMap (arr, asyncFn) {
return Promise.all(flatten(await asyncMap(arr, asyncFn)))
}
function asyncMap (arr, asyncFn) {
return Promise.all(arr.map(asyncFn))
}
function flatMap (arr, fn) {
return flatten(arr.map(fn))
@timvisee
timvisee / falsehoods-programming-time-list.md
Last active May 6, 2024 20:05
Falsehoods programmers believe about time, in a single list

Falsehoods programmers believe about time

This is a compiled list of falsehoods programmers tend to believe about working with time.

Don't re-invent a date time library yourself. If you think you understand everything about time, you're probably doing it wrong.

Falsehoods

  • There are always 24 hours in a day.
  • February is always 28 days long.
  • Any 24-hour period will always begin and end in the same day (or week, or month).
@luisbebop
luisbebop / install-rbenv-amazon-linux-ami.sh
Created November 26, 2017 16:32
Install rbenv on Amazon Linux AMI
sudo yum install -y git gcc make readline-devel openssl-devel
git clone git://github.com/rbenv/rbenv.git ~/.rbenv
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
echo 'eval "$(rbenv init -)"' >> ~/.bashrc
source ~/.bashrc
# Install ruby-build system-widely
git clone git://github.com/rbenv/ruby-build.git /tmp/ruby-build
cd /tmp/ruby-build
@lovubuntu
lovubuntu / Sha256.kt
Created November 24, 2017 15:58
function to generate Sha-256 in Kotlin
Class Hasher {
fun hash(): String {
val bytes = this.toString().toByteArray()
val md = MessageDigest.getInstance("SHA-256")
val digest = md.digest(bytes)
return digest.fold("", { str, it -> str + "%02x".format(it) })
}
}
@tmelz
tmelz / pre-commit.sh
Last active April 12, 2023 15:09
auto format java files with google-java-format
#!/bin/bash
# Auto format changed java files using google-java-format.
# To install, copy this file into $repo/.git/hooks and remove the .sh extension.
# Download the google-java-format JAR from
# https://github.com/google/google-java-format
# A more mature implementation of this would be a plugin for Yelp's pre-commit library:
# http://pre-commit.com/
echo "Running auto-formatter for any changed Java files"
echo "(formatting changes will be automatically added to your commit)"
@eerwitt
eerwitt / load_jpeg_with_tensorflow.py
Created January 31, 2016 05:52
Example loading multiple JPEG files with TensorFlow and make them available as Tensors with the shape [[R, G, B], ... ].
# Typical setup to include TensorFlow.
import tensorflow as tf
# Make a queue of file names including all the JPEG images files in the relative
# image directory.
filename_queue = tf.train.string_input_producer(
tf.train.match_filenames_once("./images/*.jpg"))
# Read an entire image file which is required since they're JPEGs, if the images
# are too large they could be split in advance to smaller files or use the Fixed
@adamveld12
adamveld12 / spec.md
Created October 31, 2015 06:49
Nes Emulator tips

NES emulator development guide


Brad Taylor (BTTDgroup@hotmail.com) 4th release: April 23rd, 2004 Thanks to the NES community. http://nesdev.parodius.com. recommended literature: 2A03/2C02/FDS technical reference documents

Overview of document

@suicide
suicide / artifactory-get.sh
Last active September 10, 2023 14:27
Downloads latest artifact version from artifactory
#!/bin/bash
# downloads latest version of an artifact from artifactory
set -e
usage(){
echo "Usage: $*" >&2
exit 64
}