- open your .zshrc or .bashrc file
code ~/.zshrc
- add an alias for edge
MacOS way to do it:
curl https://pyenv.run | bash | |
# Load pyenv automatically by appending | |
# the following to | |
# ~/.bash_profile if it exists, otherwise ~/.profile (for login shells) | |
# and ~/.bashrc (for interactive shells) : | |
export PYENV_ROOT="$HOME/.pyenv" | |
[[ -d $PYENV_ROOT/bin ]] && export PATH="$PYENV_ROOT/bin:$PATH" | |
eval "$(pyenv init - bash)" |
To avoid entering your password each time you interact with a Git repository over HTTPS, you can configure Git to cache your credentials using a credential helper. | |
1. Configure a Credential Helper: | |
Caching in memory (temporary): This caches your credentials for a set period. | |
Code | |
git config --global credential.helper cache | |
git config --global credential.helper 'cache --timeout=3600' # Caches for 1 hour (3600 seconds) | |
Storing indefinitely (less secure): This stores your credentials on disk, potentially indefinitely. This is generally less recommended due to security implications. | |
Code |
-- https://cloud.google.com/bigquery/docs/reference/standard-sql/date_functions#extract | |
SELECT EXTRACT(WEEK FROM DATE '2024-12-31') -- 52 | |
,EXTRACT(ISOWEEK FROM DATE '2024-12-31') -- 1, this could be incorrectly counted as week 1 in year 2024 | |
,EXTRACT(WEEK FROM DATE '2025-01-01') -- 0 | |
,EXTRACT(ISOWEEK FROM DATE '2025-01-01') -- 1 | |
,EXTRACT(WEEK FROM DATE '2023-12-31') -- 53 | |
,EXTRACT(ISOWEEK FROM DATE '2023-12-31') -- 52 | |
,EXTRACT(WEEK FROM DATE '2024-01-01') -- 0 | |
,EXTRACT(ISOWEEK FROM DATE '2024-01-01') -- 1 |
code ~/.zshrc
MacOS way to do it:
sudo apt update && sudo apt upgrade -y | |
sudo apt install software-properties-common -y | |
sudo add-apt-repository ppa:deadsnakes/ppa | |
sudo apt install python3.11 | |
python3.11 -V |
import re | |
# http://stackoverflow.com/a/13752628/6762004 | |
RE_EMOJI = re.compile('[\U00010000-\U0010ffff]', flags=re.UNICODE) | |
def strip_emoji(text): | |
return RE_EMOJI.sub(r'', text) | |
print(strip_emoji('🙄🤔')) |
import elasticsearch_dsl as es | |
hosts = ["http://1.1.1.1:9220","http://2.2.2.2:9220"] | |
es.connections.create_connection(hosts=hosts, http_auth=(username, password), timeout=300) | |
sea = es.Search(index=index_name).extra(from_=0, size=max_neighbors) | |
sea.query = es.Q( | |
'bool', | |
must=[ | |
es.Q('match', field_1=text), | |
es.Q('term', field_2=f2), |
docker build -f Dockerfile -t repo/dir/myimage:1 . --no-cache --progress=plain | |
docker push repo/dir/myimage:1 |
mport math | |
def seconds_to_hhmmss(secs): | |
secs = int(secs) | |
hh = int(math.floor(secs / 3600)) | |
mm = int(math.floor((secs - (hh * 3600)) / 60)) | |
ss = secs - (hh * 3600) - (mm * 60) | |
return '{:02d}:{:02d}:{:02d}'.format(hh, mm, ss) |
exclude: "docs|.git" | |
default_stages: [commit] | |
fail_fast: true | |
repos: | |
- repo: https://github.com/pre-commit/pre-commit-hooks | |
rev: v3.3.0 | |
hooks: | |
- id: trailing-whitespace | |
- id: end-of-file-fixer |