Skip to content

Instantly share code, notes, and snippets.

View alysivji's full-sized avatar
🕶️

Aly Sivji alysivji

🕶️
View GitHub Profile
import { List, Set } from "immutable";
import { Advent, int } from "advent";
const { compute, computeCheck } = await Advent({ day: 8 });
compute(async (input) => {
// const data = input.tokens(/,/).map(int);
// const data = input.ints();
const data = input.lines();
let ans = 0;
@mgax
mgax / middleware.py
Created December 29, 2020 10:20
Health check with no HTTP Host header
from django.http import HttpResponse
def health(get_response):
def middleware(request):
if request.path == "/health":
return HttpResponse("Healthy")
return get_response(request)
@coryodaniel
coryodaniel / list.txt
Created May 13, 2020 22:04
GCP List of API Services
NAME TITLE
abusiveexperiencereport.googleapis.com Abusive Experience Report API
acceleratedmobilepageurl.googleapis.com Accelerated Mobile Pages (AMP) URL API
accessapproval.googleapis.com Access Approval API
accesscontextmanager.googleapis.com Access Context Manager API
actions.googleapis.com Actions API
adexchangebuyer-json.googleapis.com Ad Exchange Buyer API
adexchangebuyer.googleapis.com Ad Exchange Buyer API II
adexchangeseller.googleapis.com Ad Exchange Seller API
adexperiencereport.googleapis.com Ad Experience Report API
@raybuhr
raybuhr / Python_Loops.md
Created June 21, 2019 15:50
More than you wanted to know about loops in python

Loops

Loops are a concept for repeat an action on each item in a collection. In day to day life, you might think of this like brushing your teeth -- for each tooth in your mouth scrub with toothbrush and a little bit of toothpaste.

For Loops

The basic format for looping in python is usually taught like this:

>>> for number in range(5):
@ptmcg
ptmcg / argparse_demo.py
Last active November 9, 2023 22:06
Demo of creating custom argument types for argparse (percent and Enum)
#
# argparse_demo.py
#
# Paul McGuire - April, 2019
#
# Presented as a lightning talk at PyTexas 2019
#
# Gist url: https://gist.github.com/ptmcg
#
import sys
@bennydictor
bennydictor / solution.mk
Created December 7, 2018 15:01
Advent of Code 2018 Day 7 Part 1 in GNU Make
RULES := $(file < input)
RULES := $(subst Step,,$(RULES))
RULES := $(subst must be finished before step,,$(RULES))
RULES := $(subst can begin.,,$(RULES))
RULES := $(strip $(RULES))
TARGETS := $(sort $(RULES))
set_get = $(strip $(__set_$(1)))
@shortjared
shortjared / list.txt
Last active July 12, 2024 11:42
List of AWS Service Principals
a4b.amazonaws.com
access-analyzer.amazonaws.com
account.amazonaws.com
acm-pca.amazonaws.com
acm.amazonaws.com
airflow-env.amazonaws.com
airflow.amazonaws.com
alexa-appkit.amazon.com
alexa-connectedhome.amazon.com
amazonmq.amazonaws.com
from typing import Tuple, NamedTuple, List, Optional, Dict
class SpendResult(NamedTuple):
is_successful: bool
remaining_balance: int
class Bank(object):
@alkrauss48
alkrauss48 / Dockerfile
Last active November 10, 2022 16:24
Running a docker container as a non-root user
# By default, Docker containers run as the root user. This is bad because:
# 1) You're more likely to modify up settings that you shouldn't be
# 2) If an attacker gets access to your container - well, that's bad if they're root.
# Here's how you can run change a Docker container to run as a non-root user
## CREATE APP USER ##
# Create the home directory for the new app user.
RUN mkdir -p /home/app
@jaceklaskowski
jaceklaskowski / dcos.md
Last active June 30, 2018 12:13
Introduction to DC/OS