Skip to content

Instantly share code, notes, and snippets.

View vsouza's full-sized avatar
:octocat:
Coding time

Vinicius Souza vsouza

:octocat:
Coding time
View GitHub Profile
@vsouza
vsouza / Países - Mongo
Last active August 31, 2022 13:48
Lista com todos (ou quase) países do mundo, com nome em português e sigla.
db.countries.insert({acron: 'AF', name: 'Afeganistão'} )
db.countries.insert({acron: 'AL', name: 'Albânia'} )
db.countries.insert({acron: 'DZ', name: 'Argélia'} )
db.countries.insert({acron: 'DS', name: 'Samoa'} )
db.countries.insert({acron: 'AD', name: 'Andorra'} )
db.countries.insert({acron: 'AO', name: 'Angola'} )
db.countries.insert({acron: 'AI', name: 'Anguilla'} )
db.countries.insert({acron: 'AQ', name: 'Antártica'} )
db.countries.insert({acron: 'AG', name: 'Antigua e / ou Barbuda'} )
db.countries.insert({acron: 'AR', name: 'Argentina'} )
@vsouza
vsouza / .bashrc
Last active April 9, 2024 05:27
Golang setup in Mac OSX with HomeBrew. Set `GOPATH` and `GOROOT` variables in zshell, fish or bash.
# Set variables in .bashrc file
# don't forget to change your path correctly!
export GOPATH=$HOME/golang
export GOROOT=/usr/local/opt/go/libexec
export PATH=$PATH:$GOPATH/bin
export PATH=$PATH:$GOROOT/bin
@vsouza
vsouza / thread.py
Last active April 28, 2022 01:42
Python thread example.
from Queue import Queue
from threading import Thread
class Worker(Thread):
"""Thread executing tasks from a given tasks queue"""
def __init__(self, tasks):
Thread.__init__(self)
self.tasks = tasks
self.daemon = True
self.start()
import pandas as pd
data = {'a': [1, 3, 4, 4], 'b': [1, 3, 2, 3]}
df = pd.DataFrame(data=data)
df.to_csv("data/old_data.csv")
data2 = {'a': [1, 3, 5, 4], 'b': [1, 3, 2, 3]}
df2 = pd.DataFrame(data=data2)
df2.to_csv("data/new_data.csv")
@vsouza
vsouza / reflection.go
Last active April 13, 2016 16:09 — 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"`
@vsouza
vsouza / parse_aws_s3_billing.py
Created November 17, 2015 17:48 — forked from oddskool/parse_aws_s3_billing.py
Simplistic script to parse the detailed AWS billing CSV file. Script displays cost of S3 operations broken down per region, bucket and usage type (either storage or network). It also sums up the amount of storage used per bucket. Output is filtered wrt to costs < 1$. See http://docs.aws.amazon.com/awsaccountbilling/latest/about/programaccess.html
# -*- coding:utf-8 -*-
'''
Simplistic script to parse the detailed AWS billing CSV file.
Script displays cost of S3 operations broken down per region, bucket and usage
type (either storage or network). It also sums up the amount of storage used per bucket.
Output is filtered wrt to costs < 1$.
See http://docs.aws.amazon.com/awsaccountbilling/latest/about/programaccess.html for
how to set up programmatic access to your billing.
@vsouza
vsouza / GQL.swift
Created March 28, 2016 02:41 — forked from davbeck/GQL.swift
GraphQL data structure implemented in Swift
import Foundation
protocol GQLNodeArgument {}
extension String: GQLNodeArgument {}
extension NSNumber: GQLNodeArgument {}
class GQLNode: StringLiteralConvertible, ArrayLiteralConvertible, Printable, DebugPrintable {
let name: String?
@vsouza
vsouza / colorsUtil.swift
Last active July 20, 2017 18:27
Convert hex string to UIColor
//
// ColorsUtil.swift
//
// Created by Vinicius Souza on 5/11/16.
// Copyright © 2016 Vinicius Souza. All rights reserved.
//
import Foundation
import UIKit
@vsouza
vsouza / request.swift
Last active May 31, 2016 13:21
Simple HTTP request. Swift backend implementation
import HTTP
import File
import HTTPSClient
import JSON
var url: String?
do {
let client = try! Client(uri: "https://api.github.com:443")
var response = try client.get("/repos/vsouza/awesome-ios/git/trees/HEAD")
let buffer = try response.body.becomeBuffer()