Skip to content

Instantly share code, notes, and snippets.

View wpjunior's full-sized avatar
🤘

Wilson Júnior wpjunior

🤘
View GitHub Profile
@wpjunior
wpjunior / models.py
Created October 9, 2012 18:08
Prova/models.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2012 Wilson Pinto Júnior <[email protected]>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
@wpjunior
wpjunior / terminal_progressbar.py
Created February 5, 2014 12:10
terminal progressbar
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2014 Wilson Pinto Júnior <[email protected]>
#
import time
import sys
def print_in_line(text):
@wpjunior
wpjunior / simple_web_browser.py
Created May 27, 2014 17:32
Simple GObject Instrospection Web Browser
# *-* coding: utf-8 *-*
# Author: Wilson Júnior <[email protected]>
# Licence: MIT
from gi.repository import Gtk, WebKit
class MyApp(Gtk.Window):
@wpjunior
wpjunior / netflix_laucher.py
Created June 18, 2014 22:02
Netflix Simple Laucher
#!/usr/bin/env python
# Simple Netflix laucher
# AUTHOR: Wilson Júnior <[email protected]>
import os
from gi.repository import (
Gdk, Gtk, WebKit, Soup)
@wpjunior
wpjunior / http-headers.go
Created April 17, 2017 19:18
Echo all HTTP Headers
package main
import (
"fmt"
"log"
"net/http"
)
type blah struct{}
package main
import (
"crypto/tls"
"io/ioutil"
"log"
"net/http"
"golang.org/x/net/http2"
)
@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
@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)
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)
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))