Skip to content

Instantly share code, notes, and snippets.

@SiNa88
SiNa88 / sync_async.py
Created January 19, 2024 21:03 — forked from joeltok/sync_async.py
synchronous async
import asyncio
async def async_func():
await asyncio.sleep(1) # <- replace this with your async code
loop = asyncio.get_event_loop()
coroutine = async_func()
loop.run_until_complete(coroutine)
@SiNa88
SiNa88 / registry-minio.md
Created April 1, 2023 20:37 — forked from leanderjanssen/registry-minio.md
Docker Registry with Minio storage example

Running a docker registry with Minio S3 backend

Run minio in a container

docker run -d -p 9000:9000 --name minio minio/minio server /export

Use docker logs to retrieve access key and secret key from minio container

docker logs minio

Create config.yml for Docker Registry

This file will have to be mounted to /etc/docker/registry/config.yml

@SiNa88
SiNa88 / app.py
Created June 2, 2022 10:48 — forked from thomasdarimont/app.py
Simple python example using flask, flask_oidc and keycloak
import json
import logging
from flask import Flask, g
from flask_oidc import OpenIDConnect
import requests
logging.basicConfig(level=logging.DEBUG)
app = Flask(__name__)
@SiNa88
SiNa88 / Client.java
Created April 3, 2022 16:00 — forked from fmbenhassine/Client.java
RMI hello world #lab
package io.github.benas.labs.javase.rmi;
import java.rmi.registry.LocateRegistry;
import java.rmi.registry.Registry;
public class Client {
public static void main(String[] args) throws Exception{
Registry r = LocateRegistry.getRegistry("localhost", 2000);
@SiNa88
SiNa88 / parallel-web-requests.py
Last active January 20, 2022 10:37 — forked from lmeulen/parallelweb_full.py
parallel-web-requests
import queue, time, urllib.request
from threading import Thread
def perform_web_requests(addresses, no_workers):
class Worker(Thread):
def __init__(self, request_queue):
Thread.__init__(self)
self.queue = request_queue
self.results = []
@SiNa88
SiNa88 / scp-speed-test.sh
Created April 2, 2021 11:58 — forked from patmandenver/scp-speed-test.sh
scp speed test between servers
#!/bin/bash
# scp-speed-test.sh
#
# Usage:
# ./scp-speed-test.sh user@hostname [test file size in MBs]
#
#############################################################
ssh_server=$1
test_file=".scp-test-file"
@SiNa88
SiNa88 / split-video-by-frame.py
Last active November 25, 2020 18:59 — forked from keithweaver/split-video-by-frame.py
Using OpenCV takes a mp4 video and produces a number of images.
import cv2
import numpy as np
import os
# Playing video from file:
cap = cv2.VideoCapture('20-200.mp4')
try:
if not os.path.exists('data-20-200'):
os.makedirs('data-20-200')