Skip to content

Instantly share code, notes, and snippets.

View seemethere's full-sized avatar
👀
does anyone actually look at this?

Eli Uriegas seemethere

👀
does anyone actually look at this?
View GitHub Profile
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.plugin.java.JavaPlugin;
import java.io.File;
import java.io.FileNotFoundException;
import java.util.Set;
@seemethere
seemethere / Description.md
Last active September 9, 2015 00:18
Python 2.7 solution for /r/DailyProgrammer intermediate challenge #228

Desciption

Modern web services are the core of the net. One website can leverage 1 or more other sites for rich data and mashups. Some notable examples include the Google maps API which has been layered with crime data, bus schedule apps, and more.

Today's a bit of a departure from the typical challenge, there's no puzzle to solve but there is code to write. For this challenge, you'll be asked to implement a call to a simple RESTful web API for Bitcoin pricing. This API was chosen because it's freely available and doesn't require any signup or an API key. Furthermore, it's a simple GET request to get the data you need. Other APIs work in much the same way but often require API keys for use.

The Bitcoin API we're using is documented here: http://bitcoincharts.com/about/markets-api/ Specifically we're interested in the /v1/trades.csv endpoint.

Your native code API (e.g. the code you write and run locally) should take the following parameters:

@seemethere
seemethere / Description.md
Last active September 10, 2015 21:41
A python 2.7 solution to finding palindromes from combinations of words

Thread

Description
A palindrome can be read the same forwards as backwards. For example, "racecar" which is well known and only mildly interesting. Palindromes can also be phrases or entire sentences such as "Dammit I'm Mad" or "Marge let a moody baby doom a telegram". The subject of this challenge will be to not only recognize palindromes from input but to identify as many possible palindromes from the combinations of the provided words in a reasonable amount of time, for brevity's sake, let's put a max of around 10 minutes. You can police this yourself or have your code manage itself and stop attempting at 10 minutes. Timer code doesn't appear to be often used in challenges so that would be interesting to see.

A palindrome typically will ignore Upper and lower case as well as ignore all punctuation, if present.

Example Input
Adinida

Thread

Description

For a set of men {A,B,...,Z} and a set of women {a,b,...,z} they have a preference table - A would prefer to marry b, but will be satisfied to marry c; c would prefer to marry B, will be OK to marry C, etc. Matches are considered unstable if there exists a pair who likes each other more than their spouses. The challenge is then to construct a stable set of marriages given the preferences.

The Gale-Shapley Theorem tells us that a stable marriage is always possible, and found in O( n^2 ) time.

Formal Input Description

Description

My grandmother and I are moving to a new neighborhood. The houses haven't yet been built, but the map has been drawn. We'd like to live as close together as possible. She makes some outstanding cookies, and I love visiting her house on the weekend for delicious meals - my grandmother is probably my favorite cook!

Please help us find the two lots that are closest together so we can build our houses as soon as possible.

Example Input

You'll be given a single integer, N, on a line, then N lines of Cartesian coordinates of (x,y) pairs. Example:

@seemethere
seemethere / sfscrape.py
Created September 24, 2015 21:57
Scrapes fist 10 pages of sourceforge directory for repository names
from requests import get
from bs4 import BeautifulSoup
base = 'http://sourceforge.net/directory/?page={}'
results = []
for i in range(1, 10):
r = get(base.format(i))
soup = BeautifulSoup(r.text, 'html.parser')
results += soup.find_all('span', {'itemprop': 'name'})
@seemethere
seemethere / split.py
Last active September 28, 2015 21:40
Full test program for our implementation of split.py
from string import whitespace
def split(input_string, separator=None, maxsplit=-1):
# Whitespace is handled completely differently by split
if separator is None:
return split_whitespace(input_string, maxsplit=maxsplit)
# Collect all indices where our substring is present
indices = [i for i, _ in enumerate(input_string) if input_string[i:i + len(separator)] == separator]
prev, ret = 0, []
This file has been truncated, but you can view the full file.

Keybase proof

I hereby claim:

  • I am seemethere on github.
  • I am seemethere (https://keybase.io/seemethere) on keybase.
  • I have a public key whose fingerprint is 5C6E 6F1C 226A 2B00 02AC 0728 7FFD BC36 78DD A36A

To claim this, I am signing this object:

import asyncio
import aiohttp
BASE_URL = 'https://josephg.com/sp/edit'
HEADERS = {
'Origin': 'https://josephg.com',
'User-Agent': ('Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) '
'AppleWebKit/537.36 (KHTML, like Gecko) '
'Chrome/57.0.2987.133 Mobile Safari/537.36'),
'Referer': 'https://josephg.com/sp/',