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 / 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 / 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 / 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.

@edwardstock
edwardstock / boost_build.sh
Last active Dec 11, 2018
Boost automated build script
View boost_build.sh
#!/usr/bin/env bash
set -o xtrace
# https://dl.bintray.com/boostorg/release/1.68.0/source/boost_1_68_0.tar.gz
BOOST_MAJOR_VER="1"
BOOST_MINOR_VER="68"
BOOST_PATCH_VER="0"
BOOST_VER="${BOOST_MAJOR_VER}.${BOOST_MINOR_VER}.${BOOST_PATCH_VER}"
BOOST_VER_US="${BOOST_MAJOR_VER}_${BOOST_MINOR_VER}_${BOOST_PATCH_VER}"
@edwardstock
edwardstock / README.md
Last active Dec 9, 2018
How to create DEB package
View README.md

Step-By-Step guide how to create .deb file from your files

  1. sudo apt-get install devscripts build-essential lintian
  2. Create a directory with prebuild binaries, for example: myproj_1.0.0.orig
  3. myproj_1.0.0.orig must contains a linux file structure, for exampel: binaries should be in myproj_1.0.0.orig/usr/bin, libraries in usr/lib or usr/lib64 et cetera..
  4. Create tar.gz from directory: tar -zcvf myproj_1.0.0.orig.tar.gz myproj_1.0.0.orig
  5. cd myproj_1.0.0.orig
  6. mkdir debian
  7. dch --create -v 1.0.0-1 --package myproj - this command may ask you about preferred editor, select one
  8. Write changelog respecting syntax:
@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 / gradle.properties
Created Sep 17, 2018
Gradle optimized properties
View gradle.properties
org.gradle.jvmargs=-Xmx15g -Xms1g -XX:MaxPermSize=2g -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
org.gradle.parallel=true
org.gradle.configureondemand=true
org.gradle.daemon=true
org.gradle.workers.max=8
org.gradle.caching=true