Skip to content

Instantly share code, notes, and snippets.

@edwardstock
edwardstock / gpg_guide.md
Last active April 2, 2024 10:32
GPG Simple Usage Guide

Define config for quick generation

gpg --default-new-key-algo "ed25519/cert,sign+cv25519/encr" --quick-generate-key "my@email.com"

Generate key

gpg --gen-key

  • Set realname: Name Surname
  • Set eamil: mail@mailbox.up
  • Set strong password
@edwardstock
edwardstock / aes256.cpp
Created November 8, 2020 15:41
C++ OpenSSL AES256 encryption
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <memory>
#include <stdexcept>
#include <cstring>
#include <openssl/aes.h>
#include <openssl/err.h>
[
{
"inputs": [
{
"internalType": "contract ICoWSwapSettlement",
"name": "_cowSwapSettlement",
"type": "address"
},
{
"internalType": "contract IWrappedNativeToken",
@edwardstock
edwardstock / gir-reset-all.sh
Created February 8, 2022 07:46 — forked from nicktoumpelis/repo-rinse.sh
Cleans and resets a git repo and its submodules
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 February 7, 2022 10:48
Update Alternatives Python 2/3 Example
#!/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 December 12, 2020 22:50
FFmpeg progress parsing regular expression (with named groups)
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 / minter-sdk-java.md
Last active September 8, 2020 14:22
Minter SDK in pure Java

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.

# 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 18:11
Strict ADB logging (only app logs and few important android)
^(?!(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 December 13, 2019 16:33
If conan not enabled, trying to find system library of using local subdirectory
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 ()