Skip to content

Instantly share code, notes, and snippets.

Alexander Kojevnikov alexkay

Block or report user

Report or block alexkay

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
alexkay /
Created Apr 16, 2013
Thumbtack PyCon 2013 challenge
#!/usr/bin/env python
import collections
import itertools
import re
import sys
words = {
for word in re.split(r'\W+',
alexkay / gist:2566869
Last active Apr 26, 2016
Mirrored encrypted FreeBSD install
View gist:2566869
# Start with the setup normally, then select "Shell" at the partitioning step.
# Check device names
camcontrol devlist
# Create a gpt and a bootstrap partition
gpart destroy -F ada0
gpart create -s gpt ada0
gpart add -a 4k -t freebsd-boot -s 64k ada0
gpart bootcode -b /boot/pmbr -p /boot/gptboot -i 1 ada0
alexkay / gist:1600742
Created Jan 12, 2012
Code Sprint 2 - Quora Nearby
View gist:1600742
#include <algorithm>
#include <cmath>
#include <iostream>
#include <map>
#include <set>
#include <vector>
using namespace std;
struct Topic {
alexkay / gist:1600725
Created Jan 12, 2012
Code Sprint 2 - Subsequence Weighting
View gist:1600725
#include <algorithm>
#include <iostream>
#include <set>
using namespace std;
struct Node {
int a;
long long w;
Node *prev;
alexkay / gist:1600704
Created Jan 12, 2012
Code Sprint 2 - Fraud Prevention
View gist:1600704
#!/usr/bin/env python
import re
def normalise_email(email):
email = email.lower()
i = email.find("@")
prefix = email[:i]
j = prefix.find("+")
if j != -1:
alexkay / gist:1600579
Created Jan 12, 2012
Code Sprint 2 - Coin Tosses
View gist:1600579
#!/usr/bin/env python
memo = {}
def calc(n, m):
key = n * 10000 + m
if key in memo:
return memo[key]
if n == 0 or n == m:
res = 0
elif m == 0:
alexkay / gist:1600348
Created Jan 12, 2012
Code Sprint 2 - Picking Cards
View gist:1600348
#!/usr/bin/env python
def calc(a, n):
res = 1
m = 1
for i in xrange(n):
m -= 1
for k in xrange(i + m, n):
if a[k] > i:
You can’t perform that action at this time.