Skip to content

Instantly share code, notes, and snippets.

View Red-Eyed's full-sized avatar

Vadym Stupakov Red-Eyed

View GitHub Profile
@lukehedger
lukehedger / ffmpeg-compress-mp4
Last active November 15, 2024 21:28
Compress mp4 using FFMPEG
$ ffmpeg -i input.mp4 -vcodec h264 -acodec mp2 output.mp4
@ishchegl
ishchegl / print_hex.c
Last active April 11, 2017 07:11
Print HEX in C
#include <stdio.h>
#include <string.h>
#define MAX_DATA_LEN 1024
static unsigned char hex_string[MAX_DATA_LEN];
static inline char convert_to_printable(char c)
{
return c < 32 || c > 126 ? '.' : c;
@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
@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)
@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:
@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
@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"
@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 / !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 / 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)