Skip to content

Instantly share code, notes, and snippets.

View Red-Eyed's full-sized avatar

Vadym Stupakov Red-Eyed

View GitHub Profile
@Red-Eyed
Red-Eyed / logcat.py
Last active December 18, 2022 14:26
logcat
#!/usr/bin/env python3
from pathlib import Path
import os
import sys
from subprocess import Popen, PIPE, getoutput
from shlex import split
from contextlib import redirect_stdout
import argparse
#!/usr/bin/env python3
from argparse import ArgumentParser
from functools import partial
from shutil import copy
from subprocess import Popen, PIPE
from shlex import split
import os
import re
import atexit
@Red-Eyed
Red-Eyed / logging_config.py
Last active September 11, 2024 15:40
Convenient way to set python logging
from pathlib import Path
import logging
import sys
def set_logger(error_file: Path, info_file: Path):
error_file = Path(error_file).expanduser().resolve()
error_file.parent.mkdir(exist_ok=True, parents=True)
info_file = Path(info_file).expanduser().resolve()
info_file.parent.mkdir(exist_ok=True, parents=True)
@Red-Eyed
Red-Eyed / !Android debloat.md
Last active December 18, 2022 14:27
Android debloat

Usefull commands

Get current ativity: dumpsys activity activities | grep mResumedActivity

Uninstall app example: pm uninstall -k --user 0 com.aura.oobe.samsung.gl

Restore removed app example: pm install-existing com.aura.oobe.samsung.gl

@Red-Eyed
Red-Eyed / .gitconfig
Created April 4, 2022 14:47
git and ssh accounts
[includeIf "gitdir:~/Projects/work/"]
path = .gitconfig_job
[includeIf "gitdir:~/Projects/personal/"]
path = .gitconfig_personal
[filter "lfs"]
clean = git-lfs clean -- %f
smudge = git-lfs smudge -- %f
process = git-lfs filter-process
@Red-Eyed
Red-Eyed / ssh-copy-id.bat
Last active December 18, 2022 14:25
ssh-copy-id for windows
type ~/.ssh/id_rsa.pub | ssh USER@HOST "mkdir -p ~/.ssh && LANG=C sed 's/[\d128-\d255]//g' >> ~/.ssh/authorized_keys && chmod 0600 ~/.ssh/authorized_keys"
@deepak-karkala
deepak-karkala / flask_webapp_segmentation.py
Created December 21, 2020 07:08
FLASK Webapp for Image Segmentation Model
# FLASK Webapp for Image Segmentation Model
import os, sys, io
sys.path.append(".")
import webapp
from flask import Flask
import flask
import numpy as np
import pandas as pd
@gatopeich
gatopeich / dataclass_from_dict.py
Created February 19, 2019 15:08
Python 3.7 dataclass to/from dict/json
from dataclasses import dataclass, fields as datafields
from ujson import dumps, loads
# Note: ujson seamlessly serializes dataclasses, unlike stdlib's json
@dataclass
class Point:
x: float
y: float
# Shallow dataclass can be rebuilt from dict/json:
@mjdietzx
mjdietzx / residual_block.py
Last active September 18, 2021 11:21
Clean and simple Keras implementation of the residual block (non-bottleneck) accompanying Deep Residual Learning: https://blog.waya.ai/deep-residual-learning-9610bb62c355.
from keras import layers
def residual_block(y, nb_channels, _strides=(1, 1), _project_shortcut=False):
shortcut = y
# down-sampling is performed with a stride of 2
y = layers.Conv2D(nb_channels, kernel_size=(3, 3), strides=_strides, padding='same')(y)
y = layers.BatchNormalization()(y)
y = layers.LeakyReLU()(y)
@iago-suarez
iago-suarez / opencv-opencl-android.md
Last active September 10, 2024 05:34
Setting Up OpenCL for OpenCV on Android, the full story

Setting Up OpenCL for OpenCV on Android, the full story

The tutorial Use OpenCL in Android camera preview based CV application show us how we can use the Transparent API to dramatically increase the performance of some expensive operations.

The first step in order to be able to execute the tutorial example is to re-compile opencv with the correct flags:

# Export your NDK, it will be looked for OpenCV to compile your project. In my case
export ANDROID_NDK=~/graffter/libs/android-ndk-r10d/

# Download the necessary code