Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/python
#-*-coding:utf-8-*-
#problem 61
from itertools import permutations
F = (lambda x: x*(x+1)/2, lambda x: x**2, lambda x: x*(3*x-1)/2, lambda x: x*(2*x-1), lambda x: x*(5*x-3)/2, lambda x: x*(3*x-2))
_numbers = dict(zip(range(6), [set() for n in range(6)]))
n = 1
UIBezierPath *path =[UIBezierPath bezierPath];
CGPoint center = CGPointMake(rect.size.width / 2.0, rect.size.height / 2.0);
CGFloat radius = sqrt(pow(center.x, 2) + pow(center.y, 2));
CGFloat angle = M_PI / self.count;
[self.color set];
[path moveToPoint:center];
for (NSUInteger i = 0; i < self.count; i++) {
[path addArcWithCenter:center radius:radius startAngle:2*i*angle endAngle:(2*i+1)*angle clockwise:YES];
[path addLineToPoint:center];
[path closePath];
//
// SunshineLayerView.m
// Sunshine
//
#import "SunshineLayerView.h"
@implementation SunshineLayerView
@synthesize color = _color;
@fbparis
fbparis / LibraryOfBabel-POC.py
Last active January 11, 2016 20:02
POC for an ordered complete Library of Babel
#!/usr/bin/python
# -*- coding: utf-8 -*-
from random import choice
from tqdm import tqdm # for the progress bar...
def get_book_from_n(n):
n_max = Base**BookLength
if n >= n_max:
return None
@fbparis
fbparis / LibraryOfBabel.py
Created January 1, 2016 05:14
An augmented version of Library Of Babel using sections to store documents of any size...
#!/usr/bin/python
# -*- coding: utf-8 -*-
from random import choice
from unidecode import unidecode
from math import log10
from tqdm import tqdm
class BaseLibraryOfBabel (object):
"""A complete, ordered, searchable, browsable and customizable Library of Babel"""
Verifying that +fbparis is my blockchain ID. https://onename.com/fbparis
@fbparis
fbparis / gist:f623c78adfc24b7dd47e5510a7152ea6
Created June 2, 2016 05:42
Vous en avez marre de ces grèves et de ces blocages, faites le savoir !
Vous en avez marre de ces grèves et de ces blocages, faites le savoir !
------------------------------------------------------------------------------
Coupon à envoyer à votre employeur
------------------------------------------------------------------------------
Je soussigné __________________ __________________,
Aujourd'hui je travaille, je ne revendique rien, je demande à ne pas bénéficier
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""Python Spintax parser
This module provides an efficient spintax parser where every possible spuns have the same probability.
Given a masterspin you can get the total number of possible spuns or a randomly chosen spun.
"""

Keybase proof

I hereby claim:

  • I am fbparis on github.
  • I am fbparis (https://keybase.io/fbparis) on keybase.
  • I have a public key ASAcgU_l1t3GqfnvA9KDRH26an9d87ZCaQ9Xzo3H12o6fQo

To claim this, I am signing this object:

@fbparis
fbparis / ratelimiting.py
Last active November 26, 2018 12:16
Generic decorator to handle multiple rate limits in API calls
import sys, time
from collections import deque
_DEFAULT_POLICY = {1:1}
def rate_limited(*args):
"""
policy is an object where each key is a time interval in seconds and each value is a maximum number of requests during this interval.
{1:1} means 1 request max per second
{1:5} means 5 requests max per second