Skip to content

Instantly share code, notes, and snippets.

View arischow's full-sized avatar
🐈
Focusing with my kitten Loki

Aris Chow arischow

🐈
Focusing with my kitten Loki
View GitHub Profile
@arischow
arischow / snippets.py
Created October 16, 2021 08:45
[BeautifulSoup] #Python
tag: bs4.Tag
# find tags by one CSS class:
soup.select(".classa")
# OR (match one of the classes)
soup.select(".classa, .classb, .classc")
# AND
soup.select(".classa.classb.classc")
@arischow
arischow / delete.sh
Created September 18, 2021 03:16
[Evicted Pods] Source: https://stackoverflow.com/a/62640917/4003204 #Kubernetes
kubectl get -A pods --no-headers --field-selector status.phase=Failed | awk '{system("kubectl -n " $1 " delete pod " $2 )}'
@arischow
arischow / To list the files changed on recent commit
Last active August 24, 2021 03:08
[To list the files changed on recent commit] #git #command
git show --pretty=%gd --stat --name-only
@arischow
arischow / private_fork.md
Created May 6, 2021 06:55 — forked from 0xjac/private_fork.md
Create a private fork of a public repository

The repository for the assignment is public and Github does not allow the creation of private forks for public repositories.

The correct way of creating a private frok by duplicating the repo is documented here.

For this assignment the commands are:

  1. Create a bare clone of the repository. (This is temporary and will be removed so just do it wherever.)

git clone --bare git@github.com:usi-systems/easytrace.git

@arischow
arischow / gist:680fba94c03a7b8fd39c8d41bb916107
Created April 22, 2021 03:42 — forked from digitaljhelms/gist:4287848
Git/GitHub branching standards & conventions

Branching

Quick Legend

Description, Instructions, Notes
Instance Branch
@arischow
arischow / Dockerfile
Last active September 7, 2020 17:22
Dockerfile multi-stage build for Python
# build wheels
FROM python:3.7.9-buster as builder
ENV PYTHONFAULTHANDLER=1 \
PYTHONUNBUFFERED=1 \
PYTHONHASHSEED=random \
# pip:
PIP_NO_CACHE_DIR=yes \
PIP_DISABLE_PIP_VERSION_CHECK=on \
PIP_DEFAULT_TIMEOUT=100
@arischow
arischow / DAZN.list
Last active September 4, 2023 13:59
Rules
# DAZN
DOMAIN-SUFFIX,dazn.com
DOMAIN-SUFFIX,dca-ll-voddazn-dznvodjp.s.llnwi.net
DOMAIN-SUFFIX,control.kochava.com
DOMAIN-SUFFIX,startup-prod.dazn.com
DOMAIN-SUFFIX,tags.dazn.com
DOMAIN-SUFFIX,api.playback.indazn.com
DOMAIN-SUFFIX,rail.discovery.indazn.com
DOMAIN-SUFFIX,dc2-vodhls-perform.secure.footprint.net
DOMAIN-SUFFIX,favourites-prod.api.dazn.com
@arischow
arischow / model.py
Last active April 9, 2019 03:20
[Django] abstract base model
# Based on https://medium.com/@adriennedomingus/soft-deletion-in-django-e4882581c340
# There’s one other thing that might be interesting to point out about the implementation of the soft-deletion: the unique together constraint.
# If you have a model with a unique together rule for fields ‘a’ and ‘b’, when an entry with the values ‘a=1’ and ‘b=2’ is soft-deleted, another one could not be created with the same values for those fields. So the ‘deleted_at’ has to be included on the constraint.
from django.db import models
from django.utils import timezone
class HasDeletedError(Exception):
pass
# dropping a database via pymongo
from pymongo import Connection
client = MongoClient() # default host localhost, port 27017
client.drop_database('mydatabase')
# drop a collection via pymongo
from pymongo import Connection
client = MongoClient()
client['mydatabase'].drop_collection('mycollection')
@arischow
arischow / get_query_string.js
Last active March 22, 2017 07:53
JavaScript
// Get all query string
var after_slash = window.location.search // "search?number=007&name=Aris&addr=PHP+is+the+best"
var urlParams = new URLSearchParams(window.location.search);
console.log(urlParams.get('number')); // "007";
console.log(urlParams.get('name')); // "Aris"
console.log(urlParams.get('addr')); // "PHP is the best";
console.log(urlParams.has('name')); // true
console.log(urlParams.append('language', 'zh_CN')); // "?number=007&name=Aris&addr=PHP+is+the+best&language=zh_CN"