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
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 |
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
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('🙄🤔')) |
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
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), |
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
docker build -f Dockerfile -t repo/dir/myimage:1 . --no-cache --progress=plain | |
docker push repo/dir/myimage:1 |
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
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) |
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
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 |
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
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
; | |
; Opinion Lexicon: Negative | |
; | |
; This file contains a list of NEGATIVE opinion words (or sentiment words). | |
; | |
; This file and the papers can all be downloaded from | |
; http://www.cs.uic.edu/~liub/FBS/sentiment-analysis.html | |
; | |
; If you use this list, please cite one of the following two papers: |
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
# ~/.ssh/config | |
Host jump | |
HostName <hostname> | |
User <username> | |
IdentityFile ~/.ssh/id_rsa | |
Host <hostname> | |
HostName <hostname> | |
User <username> |
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
# kill all processes that match this command | |
pkill -u user -f "gunicorn myapp.app.main:app" | |
# kill sentence-transformers processes SIGKILL | |
pkill -9 -u user -f "myapp/venv/bin/python3 -c from multiprocessing" | |
# manual kill parent and child processes | |
# see uvicorn multiprocessing bug https://github.com/encode/uvicorn/issues/852 | |
PARENT_PID=$(pgrep -u user -f "uvicorn myapp.app.main:app --port=1234") |
NewerOlder