Skip to content

Instantly share code, notes, and snippets.

View juanplopes's full-sized avatar
🌲
Is that a Segment Tree problem?

Juan Lopes juanplopes

🌲
Is that a Segment Tree problem?
View GitHub Profile
@juanplopes
juanplopes / gist:6553969
Created September 13, 2013 17:59
Script em Python para gerar um ~/.m2/settings.xml com token de acesso a repositório no GitHub.
#!/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':'http://maven.apache.org/SETTINGS/1.0.0'}
def make_auth(username, password):
return base64.b64encode('{}:{}'.format(username, password))
def make_token(repokey, username, password):
@darkhelmet
darkhelmet / balance.go
Created June 16, 2013 05:05
Simple TCP load balancer in Go.
package main
import (
"flag"
"io"
"log"
"net"
"strings"
)
/*
* Copyright 1999-2006 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
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"""
@briandealwis
briandealwis / gist:782862
Created January 17, 2011 13:55 — forked from spullara/gist:782523
One-liner to turn jar with Main-Class into executable shell script
# 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
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