Skip to content

Instantly share code, notes, and snippets.

This is not a verified profile. Or is it?

Juan Lopes juanplopes

This is not a verified profile. Or is it?
View GitHub Profile
debasishg / gist:8172796
Last active Apr 7, 2021
A collection of links for streaming algorithms and data structures
View gist:8172796
  1. General Background and Overview
darkhelmet / balance.go
Created Jun 16, 2013
Simple TCP load balancer in Go.
View balance.go
package main
import (
import static java.lang.System.exit;
import static java.lang.System.out;
public class Dafuq {
* This does not do what you think it does.
* <p>
* You think code is documentation? No! Documentation is code!
juanplopes /
Last active Oct 19, 2019
RSA by example
from random import randint
#----Step 1
# First, choose two random primes.
# In real world, they should be really big primes (hundreds of digits).
p, q = 41, 47
#----Step 2
# From them we have n=p*q and phi(n)=(p-1)*(q-1).
briandealwis / gist:782862
Created Jan 17, 2011 — forked from spullara/gist:782523
One-liner to turn jar with Main-Class into executable shell script
View gist:782862
# turn a jar with a Main-Class into a stand alone executable
(echo '#!/usr/bin/env java -jar'; cat blahblah.jar) > blah
# turn a jar with a particular main clas into a stand alone executable
(echo '#!/usr/bin/env java -jar package.MainClass'; cat blahblah.jar) > blah
luzfcb /
Last active May 13, 2019
resposta aos iniciantes novatos pythonbrasil

Olá, seja bem vindo ao grupo Python-Brasil.

  • Insira aqui o pedido de mais informações ou possivel solução a pergunta feita

Dito isto, aqui nós possuímos algumas regras que ajudam a manter essa lista útil e agradável para os participantes

Antes de mandar as suas próximas perguntas, pedimos para que leia o texto:

juanplopes /
Created Jan 22, 2014
Using Count-Min Sketch to find stream's quantiles with small memory footprint.
QuantileSketch sketch = new QuantileSketch();
for (int i = 0; i < 100000000; i++) {
double x1 = Math.random();
double x2 = Math.random();
//random normal distribution with mean=0 and stdev=1
sketch.offer(abs(sqrt(-2 * log(x1)) * cos(2 * Math.PI * x2)));
for (int i = 0; i <= 100; i++) {
juanplopes / gist:6553969
Created Sep 13, 2013
Script em Python para gerar um ~/.m2/settings.xml com token de acesso a repositório no GitHub.
View gist:6553969
#!/usr/bin/env python
import httplib, getpass, base64, json, datetime, sys, xml.etree.ElementTree as ET, os.path as path, os
KEY = 'your-private-repo'
NS = {'n':''}
def make_auth(username, password):
return base64.b64encode('{}:{}'.format(username, password))
def make_token(repokey, username, password):
from unittest import TestCase, main
import math
class TestNumerosTriangulares(TestCase):
def test_numero_28_deve_ter_5_divisores(self):
"""docstring for test_numero_28_deve_ter_5_divisores"""
self.assertEquals(primeiro_numero_triangular_com(divisores=5), 28)
def test_numero_x_deve_ter_500_divisores(self):
"""docstring for test_numero_x_deve_ter_500_divisores"""
View conficker_finder.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.Diagnostics;
using System.Threading;
using System.Net;
namespace ConsoleApplication8