Skip to content

Instantly share code, notes, and snippets.

View citadelgrad's full-sized avatar
🤖
Identified IT Risk

Scott Nixon citadelgrad

🤖
Identified IT Risk
View GitHub Profile
@citadelgrad
citadelgrad / stacks_brackets_example.py
Last active November 9, 2019 15:37
This is an example to efficiently push items onto a stack and remove them as you find matching pairs. https://www.youtube.com/watch?v=L3ud3rXpIxA&list=PLDV1Zeh2NRsB6SWUrDFW2RmDotAfPbeHu&index=8
"""
Push items onto the Stack so that we can compare them as we process our string.
If the stack is not empty the element encapsulation is invalid.
"""
element = '[[{}]()]'
stack = list()
def matched_set(a, b):
#!/bin/bash
python -W error:"":RuntimeWarning:django.db.models.fields:0 manage.py runserver
def get_coins(cents, coins):
if cents < 1:
return 0
num_coins = 0
for coin in coins:
num_coins += int(cents / coin)
cents = cents % coin
if cents == 0:
break
return num_coins
from functools import lru_cache
@lru_cache(1000)
def fibonacci(n):
if n == 0:
return 0
elif n == 1:
return 1
return fibonacci(n - 1) + fibonacci(n - 2)

Keybase proof

I hereby claim:

  • I am citadelgrad on github.
  • I am citadelgrad (https://keybase.io/citadelgrad) on keybase.
  • I have a public key ASBvQ9sOB-mYtz8g05XGM63UM0jDxKxhwPB2uy6OpRGykwo

To claim this, I am signing this object:

FROM python:2.7.11
RUN apt-get update && apt-get install -y libmemcached-dev
COPY . /app
WORKDIR /app
RUN pip install -r requirements.txt
version: "2"
services:
db:
image: postgres
volumes:
- db_data:/var/lib/postgresql/data
- ./backup:/backup
ports:
- "8001:5432"
""" HTML
<form action="." method="POST">
{% csrf_token %}
{{ form.as_p }}
{{ formset.as_p }}
<input type="submit" value="Create/Update Template">
</form>
"""
""" views.py """
from math import factorial
import numpy as np
def choose(n, k):
''' 25 choose 5 '''
x = factorial(n) / (factorial(k)*(factorial(n-k)))
return x
def solve():
# Monthly Price, Annual Price