Skip to content

Instantly share code, notes, and snippets.

View gaborantal's full-sized avatar
🐕

Gábor Antal gaborantal

🐕
  • University of Szeged
  • Szeged
View GitHub Profile
@gaborantal
gaborantal / TestRandom.java
Created April 11, 2022 13:41
Randomot használó osztályok tesztelése Mockito nélkül.
import org.junit.jupiter.api.Test;
import java.util.Random;
import static org.junit.jupiter.api.Assertions.assertEquals;
class MaciRandom1 {
private int mezSzeretete;
private final Random r = new Random();
@gaborantal
gaborantal / context.py
Created February 24, 2021 17:17 — forked from bradmontgomery/context.py
simple examples of a context manager in python
"""
Simple example of building your own context manager.
Resources:
- http://preshing.com/20110920/the-python-with-statement-by-example/
- https://docs.python.org/3/library/contextlib.html
- PEP 343 -- the "with" statement: https://www.python.org/dev/peps/pep-0343/
"""
@gaborantal
gaborantal / remove_tracking.py
Last active October 30, 2020 12:25
Remove tracking information from URLs in clipboard
import time
import threading
import pyperclip
def is_url(url):
if (url.startswith("https://") or url.startswith("http://") or url.startswith("www.")) and not url.startswith("https://www.google"):
return True
return False
@gaborantal
gaborantal / CompareLists.java
Last active April 25, 2019 16:37
Compare two list of objects without using equals
import java.util.ArrayList;
import java.util.List;
import java.util.function.BiFunction;
class ClassCannotBeModified {
public int a;
public int b;
public ClassCannotBeModified(int a, int b) {
this.a = a;
@gaborantal
gaborantal / remove_python_cache.py
Last active November 23, 2017 10:31
Remove Python cache files and folders
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import shutil
def remove_python_cache(directory, verbose=False):
for root, dir_names, file_names in os.walk(directory, topdown=False):
for dir_name in dir_names:
if dir_name == '__pycache__':