Skip to content

Instantly share code, notes, and snippets.

<?xml version="1.0" encoding="UTF-8"?>
<ruleset xmlns="http://mojo.codehaus.org/versions-maven-plugin/rule/2.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" comparisonMethod="maven" xsi:schemaLocation="http://mojo.codehaus.org/versions-maven-plugin/rule/2.0.0 http://mojo.codehaus.org/versions-maven-plugin/xsd/rule-2.0.0.xsd">
<ignoreVersions>
<!-- Ignore Alpha's, Beta's, release candidates and milestones -->
<ignoreVersion type="regex">(?i).*Alpha(?:-?\d+)?</ignoreVersion>
<ignoreVersion type="regex">(?i).*Beta(?:-?\d+)?</ignoreVersion>
<ignoreVersion type="regex">(?i).*-B(?:-?\d+)?</ignoreVersion>
<ignoreVersion type="regex">(?i).*RC(?:-?\d+)?</ignoreVersion>
<ignoreVersion type="regex">(?i).*CR(?:-?\d+)?</ignoreVersion>
<ignoreVersion type="regex">(?i).*M(?:-?\d+)?</ignoreVersion>
@seahrh
seahrh / pg_disk_usage.sql
Created October 25, 2018 10:38
postgres queries to check disk usage
-- pg equivalent of DESCRIBE TABLE
select column_name, data_type, character_maximum_length
from INFORMATION_SCHEMA.COLUMNS where table_name = 'my_table_name';
-- General Table Size Information, Performance Snippets
-- Disk usage, Works with PostgreSQL>=9.2
-- This will report size information for all tables, in both raw bytes and "pretty" form.
SELECT *, pg_size_pretty(total_bytes) AS total
@seahrh
seahrh / install_python3.11.sh
Created August 3, 2023 22:13
Install Python 3.11 on Ubuntu 22.04|20.04|18.04
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
@seahrh
seahrh / strip_emoji.py
Created February 12, 2023 07:36 — forked from Alex-Just/strip_emoji.py
Python regex to strip emoji from a string
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('🙄🤔'))
@seahrh
seahrh / elasticsearch_dsl.py
Created August 20, 2022 02:56
ex. elasticsearch_dsl query
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),
@seahrh
seahrh / docker_build_plain.sh
Created August 1, 2022 08:43
docker build show progress in plaintext
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)
@seahrh
seahrh / .pre-commit-config.yaml
Created February 10, 2022 03:09
Example .pre-commit-config.yaml
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
@seahrh
seahrh / jq.sh
Last active February 8, 2022 09:29
jq examples
cat input/squad20/dev-v2.0.json | jq '.data[].paragraphs[].qas[] | select(.id=="5ad24ce8d7d075001a428c0e")' -C | less -r
cat input/squad20/dev-v2.0.json | jq ".data[].title" -C | less -r
cat input/squad20/dev-v2.0.json | jq ".data[].paragraphs[].qas[].id" -C | less -r
cat input/squad20/dev-v2.0.json | jq ".data[].paragraphs[].qas[].id" -C | grep -ni 'needle'
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
; 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: