Skip to content

Instantly share code, notes, and snippets.

View tspannhw's full-sized avatar
💭
Unstructured Data, Vector Database, Cloud, AI, Edge, Streaming, SQL

Timothy Spann tspannhw

💭
Unstructured Data, Vector Database, Cloud, AI, Edge, Streaming, SQL
View GitHub Profile
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@tspannhw
tspannhw / fix-os-upgrade.md
Created May 10, 2024 15:47 — forked from cobaohieu/fix-os-upgrade.md
fix Your python3 install is corrupted. Please fix the '/usr/bin/python3' symlink.

sudo apt install --reinstall python3

sudo apt install --reinstall python

`` sudo update-alternatives --remove-all python

@tspannhw
tspannhw / JSON_Array_to_String_List.xml
Created January 6, 2024 02:15 — forked from ijokarumawak/JSON_Array_to_String_List.xml
NiFi template that converts JSON Array into String List.
<?xml version="1.0" ?>
<template encoding-version="1.1">
<description></description>
<groupId>1e8778a8-015c-1000-c747-8273276bab45</groupId>
<name>JSON Array to String List</name>
<snippet>
<processGroups>
<id>51eb9288-0a70-311b-0000-000000000000</id>
<parentGroupId>5454b790-94fe-3e28-0000-000000000000</parentGroupId>
<position>
@tspannhw
tspannhw / BertTranslator.java
Created October 21, 2023 17:09 — forked from KexinFeng/BertTranslator.java
Deploying HuggingFace QA model in Java
import ai.djl.modality.nlp.DefaultVocabulary;
import ai.djl.modality.nlp.Vocabulary;
import ai.djl.modality.nlp.bert.BertToken;
import ai.djl.modality.nlp.bert.BertTokenizer;
import ai.djl.modality.nlp.qa.QAInput;
import ai.djl.ndarray.NDArray;
import ai.djl.ndarray.NDList;
import ai.djl.ndarray.NDManager;
import ai.djl.translate.Batchifier;
import ai.djl.translate.Translator;
@tspannhw
tspannhw / sidecar-example.yml
Created June 14, 2023 00:05 — forked from pvillard31/sidecar-example.yml
sidecar-example.yml for MiNiFi and NiFi
apiVersion: v1
data:
# TODO: replace with own minifi properties
minifi.properties: |
# Core Properties #
nifi.version=0.11.0
nifi.flow.configuration.file=./conf/config.yml
nifi.administrative.yield.duration=30 sec
# If a component has no work to do (is "bored"), how long should we wait before checking again for work?
nifi.bored.yield.duration=100 millis
@tspannhw
tspannhw / bot.rb
Created April 30, 2023 03:42 — forked from dideler/bot.rb
Sending a notification message to Telegram using its HTTP API via cURL
# Use this script to test that your Telegram bot works.
#
# Install the dependency
#
# $ gem install telegram_bot
#
# Run the bot
#
# $ ruby bot.rb
#
{
"flowContents": {
"identifier": "42063a31-a98b-319f-8617-2086e4b7f30b",
"instanceIdentifier": "a7be953d-0186-1000-5378-dd26f8d2184c",
"name": "Github_PR_Verification_Bot",
"comments": "",
"position": {
"x": 589.4942055903919,
"y": 191.17769189766898
},
import avro.schema
import io
import os
import requests
from avro.io import DatumReader, BinaryDecoder
from cachetools import TTLCache
from kafka import KafkaConsumer
# Kafka broker
BROKERS = ['cdp.52.33.201.179.nip.io:9092']
{
"type": "record",
"name": "FinTransactions",
"fields": [
{ "name": "ts", "type": "string" },
{ "name": "account_id", "type": "string" },
{ "name": "transaction_id", "type": "string" },
{ "name": "amount", "type": "int" },
{ "name": "lat", "type": "double" },
{ "name": "lon", "type": "double" },
@tspannhw
tspannhw / kafka-python-sasl-gssapi.py
Created March 16, 2023 19:36 — forked from asdaraujo/kafka-python-sasl-gssapi.py
kafka-python example with Kerberos auth
# Requirements: kafka-python gssapi krbticket
import os
import time
from kafka import KafkaConsumer, KafkaProducer
from krbticket import KrbConfig, KrbCommand
try:
os.environ['KRB5CCNAME'] = '/tmp/krb5cc_<myusername>'
kconfig = KrbConfig(principal='araujo', keytab='/path/to/<myusername>.keytab')
KrbCommand.kinit(kconfig)