Skip to content

Instantly share code, notes, and snippets.

View puffin's full-sized avatar

David Michon puffin

  • Salvador - Bahia / Brazil
View GitHub Profile
@puffin
puffin / MockResponse.py
Created May 11, 2011 18:18
Mock urllib2.open for UnitTest
class MockResponse(object):
def __init__(self, resp_data, code=200, msg='OK'):
self.resp_data = resp_data
self.code = code
self.msg = msg
self.headers = {'content-type': 'text/plain; charset=utf-8'}
def read(self):
return self.resp_data

Keybase proof

I hereby claim:

  • I am puffin on github.
  • I am davidmichon (https://keybase.io/davidmichon) on keybase.
  • I have a public key whose fingerprint is 6893 25C8 126B B78D B95A 9A93 3ACF 64D4 5641 D24E

To claim this, I am signing this object:

@puffin
puffin / 01-easy-big-digits.md
Last active February 15, 2017 14:09
Big digits

CHALLENGE DESCRIPTION:

In this challenge you're presented with a situation in which you need to output big symbols on devices which only support ASCII characters and single, fixed-width fonts. To do this you're going to use pseudo-graphics to ‘draw’ these big symbols.

Here is an example of the font with digits from 0 to 9:

-**----*--***--***---*---****--**--****--**---**--
@puffin
puffin / 02-easy-chardonnay-or-cabernet.md
Last active February 24, 2017 18:13
Chardonnay or Cabernet

CHALLENGE DESCRIPTION:

Your good friend Tom is admirer of tasting different types of fine wines. What he loves even more is to guess their names. One day, he was sipping very extraordinary wine. Tom was sure he had tasted it before, but what was its name? The taste of this wine was so familiar, so delicious, so pleasant… but what is it exactly? To find the answer, Tom decided to taste the wines we had. He opened wine bottles one by one, tasted different varieties of wines, but still could not find the right one. He was getting crazy, “No, it’s not that!” desperately breaking a bottle of wine and opening another one. Tom went off the deep end not knowing what this wine was. Everything he could say is just several letters of its name. You can no longer look at it and decided to help him.

@puffin
puffin / 03-moderate-justify-the-text.md
Created February 15, 2017 14:10
Justify the text

CHALLENGE DESCRIPTION:

Write a program that reformats the text into lines of 80 symbols by stretching the text to full line width by adding extra spaces.

Longer series of spaces should go first. For example:

  • if you need to add just one extra space, add it between the first and the second word
  • if there are 4 words in a line, and you need 10 spaces to stretch the text up to 80 symbols, add 4 spaces between the first and the second word, 3 spaces between the second and the third word, and 3 spaces between the third and the fourth word. The last line of the paragraph remains unchanged.

INPUT SAMPLE:

@puffin
puffin / 04-moderate-predict-the-number.md
Created February 15, 2017 14:11
Predict the number

CHALLENGE DESCRIPTION:

The sequence "011212201220200112 ..." is constructed as follows:

first goes 0, and then the following action is repeated: existing part is added to the right, but 0 is replaced with 1, 1 with 2, and 2 with 0.

0 -> 01 -> 0112 -> 01121220 -> ...
@puffin
puffin / 05-hard-longest-common-subsequence.md
Created February 15, 2017 14:12
Longest common subsequence

CHALLENGE DESCRIPTION:

You are given two sequences. Write a program to determine the longest common subsequence between the two strings (each string can have a maximum length of 50 characters). NOTE: This subsequence need not be contiguous. The input file may contain empty lines, these need to be ignored.

INPUT SAMPLE:

The first argument will be a path to a filename that contains two strings per line, semicolon delimited. You can assume that there is only one unique subsequence per test case. E.g.

@puffin
puffin / 06-devops-challenge.md
Last active March 2, 2017 20:21
DevOps Challenge

The Challenge

Your challenge is to develop an AWS S3 storage analysis tool. To test your tool, you will have to create a free Amazon account (if you don't already have one).

Specifications

The tool is a shell command line utility (could be either Mac or Linux) that returns informations over all S3 buckets in an Amazon account.

The tool must returns the following informations:

Challenge Description

We would like to improve the LinkedIn skills features. Today LinkedIn skills are isolated tags you can assign to profiles. We want to bind these skills together on a flat relationship so we can propose new connections to users based on skills similarities.

Note: every LinkedIn users can bind skills together. Skills have a "binding score" based on the number of time 2 skills are binded together and the number of link a specific skill has.

Your challenge is to imagine a database model to support this feature.

@puffin
puffin / 07-mobile-app-challenge.md
Last active March 10, 2017 12:53
Mobile App Challenge

The Challenge

Your challenge is to develop an AWS S3 storage analysis tool. To test your tool, you will have to create a free Amazon account (if you don't already have one).

Specifications

The tool is a mobile app that returns informations over all S3 buckets in an Amazon account.

The app should provide a clean interface and navigation system to display informations. The final app should offer an authentication system for user's to login with their AWS credentials.