Skip to content

Instantly share code, notes, and snippets.

View ConAlgorithm's full-sized avatar

Contribute ConAlgorithm

View GitHub Profile
@ConAlgorithm
ConAlgorithm / videos_grid.py
Created August 14, 2022 09:51 — forked from luuil/videos_grid.py
Merging multiple videos into one grid video by opencv and numpy
import cv2
import os
import numpy as np
class ExtractImageFromVideo(object):
def __init__(self, path, frame_range=None, debug=False):
assert os.path.exists(path)
self._p = path
@ConAlgorithm
ConAlgorithm / utils.py
Created August 14, 2022 09:47 — forked from Asadullah-Dal17/utils.py
This allow to draw text with color, blur background, it also have functionality to draw transparent shapes,
'''
Author: Asadullah Dal
Youtube Channel: https://www.youtube.com/c/aiphile
'''
import cv2 as cv
import numpy as np
@ConAlgorithm
ConAlgorithm / find_video_metadata.py
Created June 10, 2022 15:07 — forked from sscarbal/find_video_metadata.py
Python function to retrieve the timestamps of a input video file using ffmpeg.
import subprocess
import shlex
import json
# function to retrieve the timestamps of the input video file
def findVideoMetadata(pathToInputVideo):
cmd = "ffprobe -v quiet -print_format json -show_entries packet=pts_time"
args = shlex.split(cmd)
args.append(pathToInputVideo)
# run the ffprobe process, decode stdout into utf-8 & convert to JSON
@ConAlgorithm
ConAlgorithm / hdf5.py
Created May 15, 2022 05:42 — forked from Franklin-Yao/hdf5.py
save and read images with hdf5
import os.path as osp
dataset_dir = '/home/frankllin/Downloads/DomainNet'
split_dir = osp.join(dataset_dir, 'splits_mini')
image_size = 84
from PIL import Image
import h5py
import numpy as np
from tqdm import tqdm
def store_many_hdf5(h5file, images, labels):
@ConAlgorithm
ConAlgorithm / center_crop_scale.py
Created March 17, 2022 12:10 — forked from Nannigalaxy/center_crop_scale.py
Center Crop and Image Scaling functions in OpenCV using Python
# Center Crop and Image Scaling functions in OpenCV
# Date: 11/10/2020
# Written by Nandan M
import cv2
def center_crop(img, dim):
"""Returns center cropped image
Args:
@ConAlgorithm
ConAlgorithm / .js
Created June 25, 2021 23:36 — forked from thefloodshark/.js
Tampermonkey Userscript - Keybind Numbered Google Results Select
// ==UserScript==
// @name Google digits
// @include https://www.google.tld/*
// @run-at document-start
// ==/UserScript==
// only work on search pages with #q= &q= ?q=
if (location.href.match(/[#&?]q=/)) {
window.addEventListener('keydown', function(e) {
var digit = e.keyCode - 48;
// ==UserScript==
// @name Generic Key Listener
// @namespace http://tampermonkey.net/
// @version 0.1
// @description logs key events. useful for creating a script you want actived on a set of keys
// @author Petalousa
// @include *
// @grant none
// ==/UserScript==
package jp.sumasu.test;
import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
import android.telephony.PhoneStateListener;
import android.telephony.SignalStrength;
import android.telephony.TelephonyManager;
import android.widget.TextView;
@ConAlgorithm
ConAlgorithm / SignalWatcher.java
Created April 21, 2021 19:27 — forked from kimukou/SignalWatcher.java
SignalWatcher extends code
import android.content.Context;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.os.Build;
import android.telephony.PhoneStateListener;
import android.telephony.TelephonyManager;
import permissions.dispatcher.PermissionUtils;
/*
@ConAlgorithm
ConAlgorithm / Top.java
Created April 11, 2021 04:42 — forked from thorikawa/Top.java
Android DrmFramework Sample
package com.polysfactory.DrmFrameworkTest;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import android.app.Activity;
import android.drm.DrmManagerClient;
import android.os.Bundle;
import android.util.Log;
import android.widget.TextView;