Dionysis Zindros, National Technical University of Athens [email protected]
pseudonymous anonymous web-of-trust identity trust bitcoin namecoin proof-of-burn timelock decentralized anonymous marketplace openbazaar
| def lacsap(n): | |
| if n==0: | |
| return [2] | |
| if n == 1: | |
| return [2,2] | |
| else: | |
| coeficientsToGenerate = n-1 | |
| above = lacsap(n-1) | |
| lenAbove = len(above) | |
| result = [2] |
| #include "brilliant.h" | |
| #define true 1 | |
| #define false 0 | |
| int gcd(int a, int b) { | |
| int c; | |
| while (a!=0) { | |
| c=a; | |
| a=b%a; | |
| b=c; |
| #include "brilliant.h" | |
| #define true 1 | |
| #define false 0 | |
| int gcd(int a, int b) { | |
| int c; | |
| while (a!=0) { | |
| c=a; | |
| a=b%a; | |
| b=c; |
| /** Java's BigInteger doesn't have a squared root function, sigh */ | |
| public static BigInteger sqrt(BigInteger n) { | |
| BigInteger a = BigInteger.ONE; | |
| BigInteger b = new BigInteger(n.shiftRight(5).add(new BigInteger("8")).toString()); | |
| while(b.compareTo(a) >= 0) { | |
| BigInteger mid = new BigInteger(a.add(b).shiftRight(1).toString()); | |
| if(mid.multiply(mid).compareTo(n) > 0) b = mid.subtract(BigInteger.ONE); | |
| else a = mid.add(BigInteger.ONE); | |
| } | |
| return a.subtract(BigInteger.ONE); |
| public static boolean isPerfectSquare(int n) { | |
| double root = Math.sqrt(n); | |
| return root-((double)((int)root)) == 0; | |
| } |
| package com.frostwire.util; | |
| public class Condition { | |
| /** | |
| * Useful to shorten long "or" boolean expressions. | |
| * @param needle | |
| * @param args | |
| * @return true if needle is in any of the args. | |
| */ |
| function rmTildes { | |
| find . | grep -e "~$" | xargs rm | |
| } |
| ''' | |
| Run this script inside of src/ and it will look for all the files | |
| that were changed this year that still have the last year in the | |
| copyright headers, and it will fix the headers on that file using | |
| a perl regex one liner. | |
| For example: if it finds something like this and we're in 2014 | |
| // Copyright (c) 2009-2013 The Bitcoin developers |
Dionysis Zindros, National Technical University of Athens [email protected]
pseudonymous anonymous web-of-trust identity trust bitcoin namecoin proof-of-burn timelock decentralized anonymous marketplace openbazaar
| #My theory is that if ioloop.instance() is to be called for every request the websocket might receive | |
| #this is costly as the instance() method has a dictionary lookup in there. | |
| #Plus there's also the cost of allocating memory for the stack of the instance() method and then returning back to | |
| #the method which invokes it, vs just keeping the reference once and reusing it. | |
| #So here's some test code | |
| import cProfile | |
| from zmq.eventloop import ioloop | |
| ioloop.install() |