Skip to content

Instantly share code, notes, and snippets.

View hashlash's full-sized avatar

hashlash

View GitHub Profile
@hashlash
hashlash / scrum-guidelines.md
Last active February 20, 2019 07:05
SCRUM Guidelines

The Scrum Guide™

This HTML version of the Scrum Guide is a direct port of the November 2017 version available as a PDF here.

Purpose of the Scrum Guide

Scrum is a framework for developing, delivering, and sustaining complex products. This Guide contains the definition of Scrum. This definition consists of Scrum’s roles, events, artifacts, and the rules that bind them together. Ken Schwaber and Jeff Sutherland developed Scrum; the Scrum Guide is written and provided by them. Together, they stand behind the Scrum Guide.

Definition of Scrum

Scrum (n): A framework within which people can address complex adaptive problems, while productively and creatively delivering products of the highest possible value.

Scrum is:

@hashlash
hashlash / bfs.cpp
Last active April 1, 2019 05:00
2019-03-29 OSP
// Created by: hashlash
// 2019-03-30
//
// Given G = (V, E)
// V = { v1, v2, v3, ..., vN}
// E = { (e1,f1), (e2,f2), ..., (eM,fM)}
//
// Traverse using BFS from v1 and output
// the traversal path
//
@hashlash
hashlash / anymatch@1.3.2.package.json
Last active April 14, 2019 06:49
Files for stackoverflow question. The files are from the node_modules directory
{
"name": "anymatch",
"version": "1.3.2",
"description": "Matches strings against configurable strings, globs, regular expressions, and/or functions",
"files": [
"index.js"
],
"author": {
"name": "Elan Shanker",
"url": "http://github.com/es128"
@hashlash
hashlash / unpacking-kwargs-example1.py
Last active May 14, 2019 02:13
Simple example for using asterisks for unpacking variables
# function with unpacked parameter
def func1(**kwargs):
print(kwargs)
# both function call are the identical
func1(var1='hello', var2='world', var3='!')
func1(**{'var1':'hello', 'var2':'world', 'var3':'!'})
# this one throw error
func1({'var1':'hello', 'var2':'world', 'var3':'!'})
@hashlash
hashlash / unpacking-kwargs-example2.py
Last active May 14, 2019 02:13
Simple example for using asterisks for unpacking variables
# function with keyworded parameter
def func2(var1=None, var2=None, var3=None):
print(var1, var2, var3)
# both function call are the identical
func2(var1='hello', var2='world', var3='!')
func2(**{'var1':'hello', 'var2':'world', 'var3':'!'})
# this one throw error
func2(**{'var1':'hello', 'var2':'world', 'var4':'!'})
@hashlash
hashlash / unpacking-kwargs-example3.py
Last active May 14, 2019 02:13
Simple example for using asterisks for unpacking variables (this example is the one without asterisks)
# single parameter function
# expect kwargs as dict
def func3(kwargs):
print(kwargs)
# you can call the function like this
func3({'var1':'hello', 'var2':'world', 'var3':'!'})
# but you can't do something like this
func3(var1='hello', var2='world', var3='!')
from abc import ABCMeta, abstractmethod
from collections import defaultdict
from typing import Iterable
from waste.models import WasteType
class TransactionUnit:
amount = 0
unit = None
# rest_framework.generics
class RetrieveUpdateDestroyAPIView(mixins.RetrieveModelMixin,
mixins.UpdateModelMixin,
mixins.DestroyModelMixin,
GenericAPIView):
"""
Concrete view for retrieving, updating or deleting a model instance.
"""
def get(self, request, *args, **kwargs):
return self.retrieve(request, *args, **kwargs)
@classonlymethod
def as_view(cls, **initkwargs):
"""Main entry point for a request-response process."""
for key in initkwargs:
if key in cls.http_method_names:
raise TypeError("You tried to pass in the %s method name as a "
"keyword argument to %s(). Don't do that."
% (key, cls.__name__))
if not hasattr(cls, key):
raise TypeError("%s() received an invalid keyword %r. as_view "

Problem statement:

There are N kind of stamps with different prices, denoted by pi as price for i-th stamp. Prove that every amount of postage of x cents or more can be formed using just the stamps above (with price pi for each stamp).

Mathematically we can define:

x = c1.p1 + c2.p2 + ... + cN.pN

with ci is the number of i-th stamp with price pi to form postage of x cents.