Skip to content

Instantly share code, notes, and snippets.

View Gunni's full-sized avatar

Gunnar Guðvarðarson Gunni

View GitHub Profile
@Gunni
Gunni / helpers.py
Last active February 7, 2021 23:33
I hate number words
import re
import nltk as nltk
from word2number import w2n
def replaceTextnumberWithNumber(text):
#print(f'-- BEFORE --\n{text}')
tagged_number_words = 'ten/CD thousand/CD nine/CD hundred/CD ninety/CD eight/CD seven/CD six/CD five/CD four/CD three/CD two/CD one/CD eighty/CD seventy/CD sixty/CD fifty/CD forty/CD thirty/CD twenty/CD nineteen/CD eighteen/CD seventeen/CD sixteen/CD fifteen/CD fourteen/CD thirteen/CD twelve/CD eleven/CD zero/CD'
@Gunni
Gunni / sentry.inc.php
Created September 9, 2021 17:41
Observium integration for Sentry
<?php
// This file is silently disabled if not configured
if ( ! isset($config['sentry_dsn']))
{
return;
}
if (defined('SENTRY_LOADED'))
{
@Gunni
Gunni / get_systemd_services.py
Created May 4, 2023 18:46
How to get systemd service state via dbus in python
#!/usr/bin/env python3
from dataclasses import dataclass
from enum import Enum
from typing import List
from pystemd.systemd1 import Manager
@dataclass
class ServiceActiveState(str, Enum):