Skip to content

Instantly share code, notes, and snippets.

Avatar
:octocat:
Coding time

Vinicius Souza vsouza

:octocat:
Coding time
View GitHub Profile
@vsouza
vsouza / Países - Mongo
Last active Jan 2, 2018
Lista com todos (ou quase) países do mundo, com nome em português e sigla.
View Países - Mongo
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 May 7, 2021
Golang setup in Mac OSX with HomeBrew. Set `GOPATH` and `GOROOT` variables in zshell, fish or bash.
View .bashrc
# 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 Mar 24, 2021
Python thread example.
View thread.py
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()
View csv_diff.py
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 Apr 13, 2016 — forked from drewolson/reflection.go
Golang Reflection Example
View reflection.go
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 Nov 17, 2015 — 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
View parse_aws_s3_billing.py
# -*- 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 Mar 28, 2016 — forked from davbeck/GQL.swift
GraphQL data structure implemented in Swift
View GQL.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 Jul 20, 2017
Convert hex string to UIColor
View colorsUtil.swift
//
// 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
Simple HTTP request. Swift backend implementation
View request.swift
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()