Skip to content

Instantly share code, notes, and snippets.

View jveiga's full-sized avatar
💬

João Veiga jveiga

💬
View GitHub Profile
@jveiga
jveiga / lib.rs
Created February 25, 2020 19:00
parallel frequency
use std::collections::HashMap;
use std::sync::mpsc;
use std::thread;
// running 6 tests
// test bench_large_parallel ... bench: 3,278,357 ns/iter (+/- 296,577)
// test bench_large_sequential ... bench: 1,013,777 ns/iter (+/- 137,290)
// test bench_small_parallel ... bench: 129,665 ns/iter (+/- 5,313)
// test bench_small_sequential ... bench: 34,755 ns/iter (+/- 6,094)
// test bench_tiny_parallel ... bench: 39,002 ns/iter (+/- 1,230)
@jveiga
jveiga / async_main.rs
Last active January 1, 2020 11:09 — forked from tomsteele/main.rs
Rust DNS Dictionary Guessing
use futures::future::join_all;
use std::env;
use std::fs::File;
use std::io::{BufRead, BufReader};
use trust_dns_client::client::{Client, SyncClient};
use trust_dns_client::op::DnsResponse;
use trust_dns_client::rr::{DNSClass, Name, RData, Record, RecordType};
use trust_dns_client::udp::UdpClientConnection;
async fn lookup(cfqdn: String, fqdn: String) -> Result<(String, Vec<String>), failure::Error> {
@jveiga
jveiga / api.go
Created September 3, 2018 20:24
Web api example
package main
import (
"fmt"
"net/http"
"strconv"
"sync"
// external libraries last
"github.com/gorilla/mux"
@jveiga
jveiga / run.py
Created April 25, 2017 13:32 — forked from codeinthehole/run.py
Sample Celery chain usage for processing pipeline
from celery import chain
from django.core.management.base import BaseCommand
from . import tasks
class Command(BaseCommand):
def handle(self, *args, **kwargs):
sudo apt-get install texlive-base texlive-fonts-extra texlive-latex-base texlive-fonts-recommended