This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
! | |
! Title: Personal AdGuard DNS whitelist | |
! Description: personal adguard home whitelist | |
! Author: xinbinhuang | |
! | |
||https://ad.doubleclick.net^ | |
||ad.doubleclick.net^$google.com | |
@@||ad.doubleclick.net^$google.com |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://github.com/microsoft/WSL/issues/4699 | |
wsl.exe --shutdown | |
# Compact wsl2 vhd to save space | |
# You may need change the path to fit your actual WSL folder name | |
cd $env:LOCALAPPDATA\Packages\CanonicalGroupLimited.Ubuntu18.04onWindows_79rhkp1fndgsc\LocalState\ | |
optimize-vhd -Path .\ext4.vhdx -Mode full |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from airflow import DAG | |
from airflow.operators.dummy_operator import DummyOperator | |
from airflow.operators.subdag_operator import SubDagOperator | |
from airflow.utils.dates import days_ago | |
def dummy_dag(dag_name, args): | |
dag_subdag = DAG( | |
dag_id=dag_name, | |
default_args=args, |
Raymond Hettinger's professional at doing code review and architecture review
P vs. NP. Pythonic vs. Non-Pythonic.
- Golden rule of PEP-8: PEP-8 onto yourself. PEP 8 is style guide, not a law book.
- Care about intelligibility, not simply visually better
- Transforming (Java) API to pythonic ones
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from dataclasses import dataclass, field, asdict | |
import random | |
from faker import Faker | |
faker = Faker() | |
@dataclass | |
class Purchase: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
###################################################### | |
######## Linux Admin | |
###################################################### | |
# Disk Space Usage | |
df -h | |
# Disk Usage | |
# https://stackoverflow.com/questions/1019116/using-ls-to-list-directories-and-their-total-sizes | |
du --summarize --human-readable * # or du -sh * |
1NF is the most basic of normal forms - each cell in a table must contain only one piece of information, and there can be no duplicate rows.
2NF and 3NF are all about being dependent on the primary key. Recall that a primary key can be made up of multiple columns. As Chris said in his response:
The data depends on the key [1NF], the whole key [2NF] and nothing but the key [3NF] (so help me [Codd][1]).
Say you have a table containing courses that are taken in a certain semester, and you have the following data:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
git remote prune origin | |
git branch -vv | grep 'origin/.*: gone]' | awk '{print $1}' | xargs git branch -d |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sed -i \ # -i: inplace; you can remove -i to do a dry run | |
-e '/<pattern>/i <text>' \ # /i: insert text after the pattern | |
-e '/<pattern>/a <text>' \ # /a: append text before the pattern | |
-e 's/<pattern>/<text>/g' \ # s/: substitute ; /g: global; match ALL instances instead of just the 1st match | |
-e 's/(<pat1>)<random_text>(<pat2>)/\1 + \2' # \1 reference <pat1>; \2 reference <pat2> | |
input.file | |
# to loop through a directory | |
find <directory> -type f -exec sed -i -e 's/<pattern>/<text>/g' {} \; |
NewerOlder