Skip to content

Instantly share code, notes, and snippets.

@hakjoon
hakjoon / Dockerfile
Created October 4, 2023 15:03 — forked from jsheedy/Dockerfile
dockerfile-compose for a celery worker with autoreload on code change
FROM python:3.6
RUN mkdir /app
ADD requirements.txt /app/
WORKDIR /app/
RUN pip install -r requirements.txt
CMD [ \
"watchmedo", \
"auto-restart", \
@hakjoon
hakjoon / dotnet-interview-stories.md
Last active December 10, 2020 02:26
.NET Project Interview stories

Suggested Coding Interview Stories

Story Points
In order for other developers to utilize the API, implement Swagger/OpenAPI 2
The CTO has requested we standardize our API documentation. Change the title of your swagger document to "Fool Commerce API." 1
Add a new endpoint that allows searching for a customer by email address. 1
BI has noticed some customers have purchased the product more than once. Setup the API to prevent customers from ordering a product they currently own. 1
Add a way for to return all the products for a given "brand". 1
Marketing has decided they want to track the type of payment used for each order. Record what type of payment method the customer used. (Credit Card, Apple Pay, Google Pay, etc.). 2
As it stands, orders in the system cannot be cancelled. Add a way to keep track of the status of an order. The statuses of "Active" and "Cancelled" come to mind as a good start. 2
@hakjoon
hakjoon / CODEOWNERS
Created January 9, 2019 21:10
Code owners not tracking pyup
# This is a CODEOWNERS file
# see https://help.github.com/articles/about-codeowners/ for details
* @realuser
/requirements/ @ghost

Developer setup

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

git

brew install git

# bash <(curl -s https://gist.github.com/drye/5387341/raw/ec72cddfe43ec3d39c91a3c118cb68ab14a049f8/enable_dnsmasq_on_osx.sh)
# ----------------------
# installing dnsmasq and enable daemon
# ----------------------
brew install dnsmasq
sudo brew services start dnsmasq
# ----------------------
# adding resolver for DOMAIN domain
# ie. domain = *.local.example.com
@hakjoon
hakjoon / upgrade_pg.sh
Created August 2, 2017 17:33
How to upgrade Homebrew PostgreSQL DB
# You can see what the old version you have is by looking at
# /usr/local/var/postgres/PG_VERSION
brew services stop postgresql
cp -r /usr/local/var/postgres /usr/local/var/postgres_bak #backup db just in case
mv /usr/local/var/postgres /usr/local/var/postgres<OLD_VERSION> # move it form default location
initdb /usr/local/var/postgres -E utf8 # create new DB in default location
pg_upgrade \
-b /usr/local/Cellar/postgresql/<OLD_VERSION>/bin/ \
-B /usr/local/Cellar/postgresql/<NEW_VERSION>/bin/ \
@hakjoon
hakjoon / Merge_git_repos.txt
Last active February 15, 2017 22:33
Merge repos maintaining history
# You will lose any untracked files so a new checkout is probably wise
git checkout --orphan <branch_name>
git rm -rf .
git pull <other repo>
# clean up file structure. For example remove packaging metadata files
git merge master
git checkout master
git merge <branch_name>
@hakjoon
hakjoon / update_all_content_types.py
Created November 18, 2016 19:31
Update all content types
from django.apps import apps
from django.contrib.contenttypes.management import update_contenttypes
def update_all_contenttypes(**kwargs):
for app_config in apps.get_app_configs():
update_contenttypes(app_config, **kwargs)
@hakjoon
hakjoon / robot_date.py
Last active February 19, 2016 14:52
Robot date
from itertools import izip_longest
import random
def grouper(iterable, n, fillvalue=None):
"Collect data into fixed-length chunks or blocks"
# grouper('ABCDEFG', 3, 'x') --> ABC DEF Gxx
args = [iter(iterable)] * n
return izip_longest(fillvalue=fillvalue, *args)
def make_grid(rows, columns):
@hakjoon
hakjoon / filtered_dict.py
Created October 20, 2015 14:04
Filtered Dictionary without None values
def filtered_dict(d, keys):
return {key: d[key] for key in keys if d.get(key) is not None}