Skip to content

Instantly share code, notes, and snippets.

View arxdsilva's full-sized avatar
:octocat:
Working from home

Arthur Silva arxdsilva

:octocat:
Working from home
View GitHub Profile
@arxdsilva
arxdsilva / main.go
Created May 10, 2019 22:52
utf8 rune count in string
package main
import "fmt"
import "unicode/utf8"
func main() {
fmt.Println("Hello, 世界", len("世界"), utf8.RuneCountInString("世界"))
}
@arxdsilva
arxdsilva / main.go
Created February 4, 2019 01:48
Tibia's house rental prices info
package main
import (
"bufio"
"fmt"
"net/http"
"os"
"strconv"
"strings"
)
{
"manifest_version": 2,
"name": "Getting started example",
"description": "This extension allows the user to change the background color of the current page.",
"version": "1.0",
"browser_action": {
"default_icon": "icon.png",
"default_popup": "popup.html"
},
"permissions": [
package com.example.influenciadores;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
public class InfluenciadoresActivity extends Activity {
@arxdsilva
arxdsilva / pizza.go
Last active November 28, 2017 11:41
Golang concurrency using method example and pizza orders
package main
import (
"fmt"
"sync"
)
type PizzaOrder struct {
orderNum int
flavor string
@arxdsilva
arxdsilva / comparer.go
Last active August 16, 2017 13:54
comparer with maps
func compare(original, translation map[string]string) map[string]string {
missing := make(map[string]string)
for k, v := range original {
if _, ok := translation[k]; !ok {
missing[k] = v
}
}
return missing
}
@arxdsilva
arxdsilva / comparer.go
Created August 16, 2017 13:32
comparing two slices in go
func compare(a, b []string) []string {
for i := len(a) - 1; i >= 0; i-- {
for _, vD := range b {
if a[i] == vD {
a = append(a[:i], a[i+1:]...)
break
}
}
}
return a
Verifying that "arxdsilva.id" is my Blockstack ID. https://onename.com/arxdsilva
@arxdsilva
arxdsilva / fedora-nvidia-driver-install.md
Last active March 1, 2017 03:01
Installing nvidia drivers on Fedora25

1.Update software & reboot

$ dnf update -y
$ reboot

2.Installing dependencies

$ dnf install kernel-devel-$(uname -r) gcc dkms

3.Add 'nouveau' to the blacklist, install vim to edit 'Grub'

@arxdsilva
arxdsilva / recursiveGlob.go
Created February 15, 2017 13:01
Recursive glob in Go
func RecursiveGlob(dirPath string, pattern string) ([]string, error) {
old, err := os.Getwd()
if err != nil {
return nil, err
}
defer os.Chdir(old)
err = os.Chdir(dirPath)
if err != nil {
return nil, err
}