Skip to content

Instantly share code, notes, and snippets.

View seocam's full-sized avatar

Sergio Oliveira seocam

  • Uber
  • Brazil
  • 03:41 (UTC -03:00)
View GitHub Profile
#!/bin/bash
REPOS="repo1 repo2 repo3"
BASE_DIR="/Users/user/repo_home" # Where you repos are
OUTPUT_FILE="/Users/user/Documents/git-stats.html"
for repo in $REPOS; do
cd "$BASE_DIR/$repo"
echo "Updating repo $repo"
git fetch
import avinit
avinit.get_svg_avatar('Douglas Adams')
# Returns:
# '<svg xmlns="http://www.w3.org/2000/svg" pointer-events="none" width="46" height="46" style="width: 46px; border-radius: 0px; -moz-border-radius: 0px; background-color: #34495e; height: 46px"> <text text-anchor="middle" y="50%" x="50%" dy="0.35em" pointer-events="auto" fill="#ffffff" font-family="HelveticaNeue-Light,Helvetica Neue Light,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif" style="font-size: 20px; font-weight: 400">DA</text> </svg>'
avinit.get_avatar_data_url('Douglas Adams')
# Returns:
# 'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHBvaW50ZXItZXZlbnRzPSJub25lIiB3aWR0aD0iNDYiIGhlaWdodD0iNDYiIHN0eWxlPSJ3aWR0aDogNDZweDsgYm9yZGVyLXJhZGl1czogMHB4OyAtbW96LWJvcmRlci1yYWRpdXM6IDBweDsgYmFja2dyb3VuZC1jb2xvcjogIzM0NDk1ZTsgaGVpZ2h0OiA0NnB4Ij4gPHRleHQgdGV4dC1hbmNob3I9Im1pZGRsZSIgeT0iNTAlIiB4PSI1MCUiIGR5PSIwLjM1ZW0iIHBvaW50ZXItZXZlbnRzPSJhdXRvIiBmaWxsPSIjZmZmZmZmIiBmb250LWZhbWlseT0iSGVsdmV0aWNhTmV1ZS1M
<svg xmlns=”http://www.w3.org/2000/svg" pointer-events=”none” width=”{width}”
height=”{height}” style=”{style}”>
<text text-anchor=”middle” y=”50%” x=”50%” dy=”0.35em”
pointer-events=”auto” fill=”#ffffff” font-family=”{font-family}”
style=”{text-style}”>{text}</text>
</svg>
@seocam
seocam / setup.js
Created March 13, 2017 21:50
Failing tests when React Warnings are raised
const ERROR_MESSAGES = [
'Warning: React.createElement',
'Failed propType:'
];
/* Turn console.error messages into failing tests */
console.error = (logger => (...options) => {
const [message, ..._rest] = options;
ERROR_MESSAGES.forEach(error_message => {
@seocam
seocam / gh2elasticsearch.py
Last active May 8, 2017 14:56
Index Github data in Elasticsearch
#!/usr/bin/env python
import functools
import itertools
import requests
from elasticsearch import Elasticsearch
from elasticsearch.helpers import bulk
diff -r -U3 newrelic/api/web_transaction.py newrelic/api/web_transaction.py
--- newrelic/api/web_transaction.py 2017-05-26 15:13:50.000000000 -0300
+++ newrelic/api/web_transaction.py 2017-08-11 15:28:16.000000000 -0300
@@ -720,11 +720,15 @@
class _WSGIApplicationIterable(object):
- def __init__(self, transaction, generator):
+ def __init__(self, transaction, generator, group=None):
self.transaction = transaction
let iters = 0;
function greedyThief(items, n){
iters = 0
const new_items = [...items]
const sorted_items = new_items.sort((a, b) => {
const w_diff = b.weight - a.weight
if (w_diff === 0) {
return b.price - a.price
}
@seocam
seocam / csv2contabilizei_ofx.py
Last active December 28, 2024 21:20
Converte CSV para um arquivo OFX aceito pela contabilizei
#!/usr/bin/env python
import argparse
import calendar
import itertools as it
from datetime import datetime
from csv2ofx import utils
from csv2ofx.mappings.default import mapping
from csv2ofx.ofx import OFX
# Execute command only if configuration changes.
if not compare_args_ipa(ansible_module, args, res_find):
try:
api_command_no_name(ansible_module, 'dnsconfig_mod', args)
except Exception as e:
msg = str(e)
ansible_module.fail_json(msg="dnsconfig_mod: %s" % msg)
else:
# If command did not fail, something changed.
changed = True
@seocam
seocam / distros.json
Created March 29, 2020 19:35
Example for parsing distro info from json
{
"amazon2": {
"qcow": "amzn2-kvm-2.0.20190313-x86_64.xfs.gpt.qcow2",
"os_type": "linux",
"os_variant": "auto",
"image_url": "https://cdn.amazonlinux.com/os-images/2.0.20190313/kvm",
"disk_format": "qcow2",
"login_user": "ec2-user"
},