Skip to content

Instantly share code, notes, and snippets.

Avatar

Eduard edwardstock

  • Turkey, Antalya
View GitHub Profile
@edwardstock
edwardstock / gpg_guide.md
Last active Mar 31, 2022
GPG Simple Usage Guide
View gpg_guide.md

Generate key

gpg --gen-key

  • Set realname: Name Surname
  • Set eamil: mail@mailbox.up
  • Set strong password

List keys

gpg --list-keys

@edwardstock
edwardstock / gir-reset-all.sh
Created Feb 8, 2022 — forked from nicktoumpelis/repo-rinse.sh
Cleans and resets a git repo and its submodules
View gir-reset-all.sh
git clean -xfd
git submodule foreach --recursive git clean -xfd
git reset --hard
git submodule foreach --recursive git reset --hard
git submodule update --init --recursive
@edwardstock
edwardstock / update_alternatives_python.sh
Created Feb 7, 2022
Update Alternatives Python 2/3 Example
View update_alternatives_python.sh
#!/usr/bin/env bash
# install
update-alternatives --install /usr/bin/python python /usr/bin/python3 1
update-alternatives --install /usr/bin/python python /usr/bin/python2.7 2
# list
update-alternatives --list python
# change
update-alternatives --config python
@edwardstock
edwardstock / FFMpegProgress.java
Last active Dec 12, 2020
FFmpeg progress parsing regular expression (with named groups)
View FFMpegProgress.java
public class FFMpegProgress {
// raw
// frame=\s*(?<nframe>[0-9]+)\s+fps=\s*(?<nfps>[0-9\.]+)\s+q=(?<nq>[0-9\.-]+)\s+(L?)\s*size=\s*(?<nsize>[0-9]+)(?<ssize>kB|mB|b)?\s*time=\s*(?<sduration>[0-9\:\.]+)\s*bitrate=\s*(?<nbitrate>[0-9\.]+)(?<sbitrate>bits\/s|mbits\/s|kbits\/s)?.*(dup=(?<ndup>\d+)\s*)?(drop=(?<ndrop>\d+)\s*)?speed=\s*(?<nspeed>[0-9\.]+)x
private final static Pattern PATTERN_S = Pattern.compile("" +
"frame=\\s*(?<nframe>[0-9]+)\\s+" +
"fps=\\s*(?<nfps>[0-9\\.]+)\\s+" +
"q=(?<nq>[0-9\\.-]+)\\s+(L?)\\s*" +
"size=\\s*(?<nsize>[0-9]+)(?<ssize>kB|mB|b)?\\s*" +
"time=\\s*(?<sduration>[0-9\\:\\.]+)\\s*" +
"bitrate=\\s*(?<nbitrate>[0-9\\.]+)(?<sbitrate>bits\\/s|mbits\\/s|kbits\\/s)?.*" +
@edwardstock
edwardstock / aes256.cpp
Created Nov 8, 2020
C++ OpenSSL AES256 encryption
View aes256.cpp
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <memory>
#include <stdexcept>
#include <cstring>
#include <openssl/aes.h>
#include <openssl/err.h>
@edwardstock
edwardstock / minter-sdk-java.md
Last active Sep 8, 2020
Minter SDK in pure Java
View minter-sdk-java.md

How to use Minter Android SDK within pure Java/Kotlin project

  1. Download required SDK from official bintray repository: https://bintray.com/minterteam/android
  2. There are 4 files:
    • *-javadoc.jar
    • *-sources.jar
    • *.aar
    • *.pom

You need *.aar one.

View pgsql.helpers.sh
# init new database
# dir: /usr/pgsql-$VERS
initdb -A trust --auth-local=trust --encoding=UTF8 --pgdata=/var/pgsql10
# dump old database (-O [--no-owners] - drops owners assignment, by default in new db's rights will grant to importer)
pg_dumpall -O -U postgres > /var/db.out
# import database dump
psql -f db.out postgres
@edwardstock
edwardstock / filter.regexp
Last active May 28, 2020
Strict ADB logging (only app logs and few important android)
View filter.regexp
^(?!(FA|Settings|ea|MultiDex|OpenGLRenderer|art|FirebaseApp|System\.out|FirebaseInitProvider|Adreno\-EGL|ApplicationLoaders|dalvikvm|eglCodecCommon|SQLiteDatabase|NativeCrypto|Surface|MALI|GraphicBuffer|MultiWindow|HttpUrlPinger|FeatureProxyBase|InputMethodManager|libc\-netbsd|AudioCapabilities|VideoCapabilities|Proxy|InstantRun|PhoneWindow|ViewRootImpl|PhoneWindow|ResourceManager|OpenSSLLib|ResourcesManager|AnalyticsService|cr\_BindingManager|AccessibilityManager|ProgramBinary|\[MALI\]\[Gralloc\]|MPlugin|Posix|WifiManager|cr\_LibraryLoader|CellLocation|MaliEGL|WebView|linked|cr_BrowserStartup|ExifInterface\_JNI|cr\_Ime|FirebaseInstanceId|InputTransport|TelephonyManager|mali\_winsys|PlayCommon|Places|ExifInterface|ThermalEngine|WifiHAL|BatteryStatsService|OcrModelUpStIntentOp|LightsService|tigonliger|NetRec|Finsky|SingleFileAttributeStore|cr_media|libEGL|NetworkSecurityConfig|AppMetrica|HostConnection|DynamiteModule|GAv4|inter.bipwalle|EGL_emulation|libc|skia|Gralloc3))
^(?!(Accessing hidden))
@edwardstock
edwardstock / conan_fallback.cmake
Created Dec 13, 2019
If conan not enabled, trying to find system library of using local subdirectory
View conan_fallback.cmake
function (conan_fallback)
set(options)
set(single NAME LOCAL_INCLUDE_DIR SUBDIR SYSTEM_INCLUDE_DIR TARGET_NAME LOCAL_LIBS_PREFIX)
set(multi PROPERTIES)
cmake_parse_arguments("FF" "${options}" "${single}" "${multi}" ${ARGN})
if (TARGET CONAN_PKG::${FF_NAME})
return()
endif ()
@edwardstock
edwardstock / Build-GCC-README.md
Last active Mar 1, 2019
GNU GCC 8.1 automated build script
View Build-GCC-README.md