Skip to content

Instantly share code, notes, and snippets.

View rolisz's full-sized avatar

Roland Szabo rolisz

View GitHub Profile
@rolisz
rolisz / mic_check.py
Created February 2, 2023 15:41
Script to alert on microphone loudness
import time
from collections import deque
import numpy as np
import sounddevice as sd
from beepy import beep
from infi.systray import SysTrayIcon
last_alert = time.time() - 10
q = deque(maxlen=200)
@rolisz
rolisz / min_pattern_error.py
Last active June 13, 2022 10:23
Reproduction for PatternMatcher bug
from typing import Union, Iterable, Optional, List
import spacy
from prodigy import recipe, get_stream
from prodigy.models.matcher import PatternMatcher
from prodigy.types import RecipeSettingsType
from prodigy.util import get_labels
@recipe(
@rolisz
rolisz / manual_patterns.py
Created May 24, 2022 12:17
Prodigy pattern for multi-label text classification using patterns, without a model in the loop.
import copy
from typing import Union, Iterable, Optional, List
import spacy
from prodigy import recipe, log, get_stream
from prodigy.models.matcher import PatternMatcher
from prodigy.types import RecipeSettingsType
from prodigy.util import get_labels
@rolisz
rolisz / Cargo.toml
Last active May 24, 2023 09:48
Simple web crawler in Rust
[package]
name = "rust_crawler"
version = "0.1.0"
authors = ["Roland Szabo <[email protected]>"]
edition = "2018"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
reqwest = { version = "0.10", features = ["json", "blocking"] }
@rolisz
rolisz / gpu_monitoring.py
Created November 21, 2018 13:07
Script to send GPU monitoring data obtained with nvidia-smi to Stackdriver.
from subprocess import Popen, PIPE
import os
import time
import sys
def compute_stats():
all_gpu = []
all_mem = []
for i in range(10):
p = Popen(["nvidia-smi","--query-gpu=utilization.gpu,utilization.memory", "--format=csv,noheader,nounits"], stdout=PIPE)
@rolisz
rolisz / NeuralNetwork.py
Created July 17, 2014 12:04
Neural network
import numpy as np
from numpy.random import random as rand
class NeuralNetwork:
activations = {
'tanh': lambda x: np.tanh(x),
'relu': lambda x: np.clip(x, 0, np.max(x))
}
derivatives = {
@rolisz
rolisz / avl.py
Created June 19, 2014 17:53
AVL tree in python
__author__ = 'Roland'
import copy
class avl:
def __init__(self,value = None,left = None,right = None,parent = None):
self.value = value
self.left = left
self.right = right
self.parent = parent
@rolisz
rolisz / scris.lsp
Created January 4, 2014 10:21
Pregatire pentru examenul scris la PLF, LISP
(defun inserare(el l)
(cond
((null l) nil)
(t (mapcar (lambda (x) (cons el x)) l))
)
)
(defun permutare(l)
(cond
((null l) '(()))
@rolisz
rolisz / img.py
Created March 17, 2013 14:05
For Catalin with multiprocessing
from multiprocessing import Pool
__author__ = 'Roland'
from PIL import Image
#size of image
imgx = 600
imgy = 400
#make image buffer
image = Image.new("RGB", (imgx, imgy))
@rolisz
rolisz / scrape_notebook.ipynb
Created February 14, 2013 15:16
IPython notebook cu scraping la notele de la BD, PLF, PS ca sa obtinem toate notele bine organizate la un loc.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.