Skip to content

Instantly share code, notes, and snippets.

View wpjunior's full-sized avatar
🤘

Wilson Júnior wpjunior

🤘
View GitHub Profile
#!/usr/bin/env python
import sys
import xml.etree.ElementTree as ET
tree = ET.parse(sys.argv[1])
root = tree.getroot()
nfe = root.findall("{http://www.portalfiscal.inf.br/nfe}NFe")[0]
icms = nfe.findall('.//{http://www.portalfiscal.inf.br/nfe}ICMS70/{http://www.portalfiscal.inf.br/nfe}vICMS')
@wpjunior
wpjunior / slo_example.yml
Created November 10, 2019 16:07
slo_example.yml
slos:
- name: myteam-a.service-a
objectives:
availability: 99
latency:
- le: 5.0 # 95% < 5s
target: 95
- le: 10.0 # 97% < 10s
target: 97
#!/usr/bin/env python
import logging
import json
try:
from urllib.parse import unquote
except ImportError:
# Python 2.
from urllib import unquote
#!/usr/bin/python
from gi.repository import GLib, Gtk, Gdk
import Xlib.display
size = 167
def main():
window = Gtk.Window() # Gtk.WINDOW_TOPLEVEL)
window.set_default_size(size*0.68, Gdk.Screen.height())
@wpjunior
wpjunior / tracing-bad-http-requests.go
Created February 21, 2019 14:52
tracing-bad-http-requests.go
package main
import (
"bufio"
"bytes"
"fmt"
"io"
"net"
"net/http"
import numba
from numba import cuda
import numpy as np
@cuda.jit
def sort_kernel(array):
"""
Função executada dentro da GPU via LLVM
"""
import numpy as np
from numba import cuda
@cuda.jit
def add_2(array):
pos = cuda.grid(1)
array[pos] = array[pos] + 2
# criamos um vetor ordenado até 100000, [0, 1, 2, .. 999999] dentro da GPU
an_array = cuda.to_device(np.arange(100000))
import numpy as np
from numba import cuda
@cuda.jit
def add_2(array):
pos = cuda.grid(1)
array[pos] = array[pos] + 2
# criamos um vetor ordenado até 100000, [0, 1, 2, .. 999999]
an_array = np.arange(100000)
@wpjunior
wpjunior / multiply-by-2-full.py
Created December 9, 2018 17:00
multiply-by-2-full using numba and cuda
import numpy as np
from numba import cuda
@cuda.jit
def multiply_by_2(array):
pos = cuda.grid(1)
array[pos] = array[pos] * 2
# criamos um vetor ordenado até 1000, [0, 1, 2]
an_array = np.arange(1000)
@wpjunior
wpjunior / multiply-by-2.py
Last active December 9, 2018 17:00
numba-examples
from numba import cuda
@cuda.jit
def multiply_by_2(array):
pos = cuda.grid(1)
array[pos] = array[pos] * 2