Skip to content

Instantly share code, notes, and snippets.

View schweigert's full-sized avatar
🥝
λxy.x

Marlon Henry Schweigert schweigert

🥝
λxy.x
View GitHub Profile
asdf install ruby 2.7.1
asdf global ruby 2.7.1
bundle install
ruby --version
@schweigert
schweigert / ruby-asdf.sh
Created June 9, 2020 15:50
Adicionar plugin do ruby ao ASDF
asdf plugin-add ruby https://github.com/asdf-vm/asdf-ruby.git
@schweigert
schweigert / asdf.sh
Last active June 9, 2020 14:43
Instalação ASDF
# Dependências
sudo pacman -S git
# Instalação
git clone https://github.com/asdf-vm/asdf.git ~/.asdf --branch v0.7.8
echo -e '\n. $HOME/.asdf/asdf.sh' >> ~/.profile
echo -e '\n source ~/.profile' >> ~/.bashrc
echo -e '\n source ~/.profile' >> ~/.zshrc
var brazil = document.createElement('option');
brazil.value = '+55';
brazil.appendChild(document.createTextNode('Brazil +55'));
document.querySelectorAll('#countrycode').forEach((select) => select.appendChild(brazil));
package main
import (
"fmt"
"crypto/sha256"
"encoding/hex"
)
func main() {
s := "123123"
@schweigert
schweigert / reflection.go
Created December 14, 2018 15:34 — forked from drewolson/reflection.go
Golang Reflection Example
package main
import (
"fmt"
"reflect"
)
type Foo struct {
FirstName string `tag_name:"tag 1"`
LastName string `tag_name:"tag 2"`
docker [opções] comando
<?
if(!isset($_SERVER['PHP_AUTH_USER'])) {
if (isset($_SERVER['HTTP_AUTHORIZATION']) && (strlen($_SERVER['HTTP_AUTHORIZATION']) > 0)) {
list($_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW']) = explode(
':',
base64_decode(substr($_SERVER['HTTP_AUTHORIZATION'], 6))
);
if(strlen($_SERVER['PHP_AUTH_USER']) == 0 || strlen($_SERVER['PHP_AUTH_PW']) == 0) {
unset($_SERVER['PHP_AUTH_USER']);
unset($_SERVER['PHP_AUTH_PW']);
@schweigert
schweigert / Embedding GoLang into a Ruby application.md
Last active April 11, 2025 19:24
Embedding GoLang into a Ruby application - Blogpost to Magrathealabs

Go Title

I am passionate about Ruby, but its execution time compared to other languages is extremely high, especially when we want to use more complex algorithms. In general, data structures in interpreted languages become incredibly slow compared to compiled languages. Some algorithms such as ´n-body´ and ´fannkuch-redux´ can be up to 30 times slower in Ruby than Go. This is one of the reasons I was interested in embedding Go code in a Ruby environment.

For those who do not know how shared libraries operate, they work in a similar way as DLLs in Windows. However, they have a native code with a direct interface to the C compiler.

Note Windows uses the DLL system, and in this case, this does not necessarily have to be in native code.

One example is DLLs written in C#, which runs on a virtual machine. Because I do not use windows, I ended up not testing if it is poss

@schweigert
schweigert / ssh_config.sh
Created November 5, 2017 17:41
Configure SSH to git in ubuntu.
ssh-keygen -t rsa -b 4096 -C "[email protected]"
eval "$(ssh-agent -s)"
ssh-add ~/.ssh/id_rsa
cat id_rsa.pub
# Add in github config the id_rsa.pub