Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am zrbecker on github.
  • I am danikarpn (https://keybase.io/danikarpn) on keybase.
  • I have a public key ASAr3KVO1npP3Hah0BVVx4sobM9OW3_2WJxEkHcswoJTAQo

To claim this, I am signing this object:

'''Utilities for managing time at different resolutons'''
from collections import defaultdict, deque, namedtuple
from datetime import datetime, timedelta
import logging
logging.basicConfig(level=logging.DEBUG)
logging.disable(logging.CRITICAL) # Comment out for debug messages
class SquareRootException(Exception):
pass
def square_root(n):
if n < 0:
raise SquareRootException(
f'{n} is negative, so it does not have a square root.')
if n == 0 or n == 1:
return n
start = 0
@zrbecker
zrbecker / index.html
Created September 8, 2017 00:35
Getting Starting with Vue.js
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta key="viewport" value="width=device-width,initial-scale=1">
<title>Vue.js Test</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/css/bootstrap.min.css" integrity="sha384-rwoIResjU2yc3z8GV/NPeZWAv56rSmLldC3R/AZzGRnGxQQKnKkoFVhFQhNUwEyJ" crossorigin="anonymous">
</head>
<body>
<div class="container">
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
#include "Combinations.h"
namespace ZB
{
Combinations::Combinations(int n, int k)
: m_n(n)
, m_k(k)
{
}
# given a knapsack of size n, a list of items costs C and weights W
# this function returns a list of items which fits in the knapsack of
# maximum cost
#
# algorithm runs in O(nm) where m = len(C) = len(W)
def knapsack(n, C, W):
# m is number of items in list
m = len(C)
# create two dimensional array
import sys, time, random
def nQueens(n):
board = [i for i in xrange(n)]
optimal = 0
current = n * (n - 1) / 2
if n < 4:
return board
char *file2string(const char *path)
{
FILE *fd;
long len,
r;
char *str;
if (!(fd = fopen(path, "r")))
{
fprintf(stderr, "Can't open file '%s' for reading\n", path);
#include <SFML/Window.hpp>
#include <glload/gl_3_3.h>
#include <glload/gll.h>
#include <vector>
#include "util.h"
GLuint theProgram;