Skip to content

Instantly share code, notes, and snippets.

@ValekS
ValekS / 1_registration.py
Last active March 17, 2024 09:30
[Monobank open API for providers] registration / check reg.status / get corp.info EXAMPLE REQUESTS | Original: https://gist.github.com/mydropcrm/0798023a520826260c60c648dbc0dc6a
import requests
import base64
import time
import ecdsa
import hashlib
# Monobank open API for providers - registration
# Docs - https://api.monobank.ua/docs/corporate.html#tag/Avtorizaciya-ta-nalashtuvannya-kompaniyi
# POST https://api.monobank.ua/personal/auth/registration
@mydropcrm
mydropcrm / registration.py
Created February 28, 2023 13:59
Monobank corporate API registration (/personal/auth/registration)
import requests
import json
import base64
import time
import ecdsa
import hashlib
# Docs - https://api.monobank.ua/docs/corporate.html#tag/Avtorizaciya-ta-nalashtuvannya-kompaniyi
if __name__ == '__main__':
@tuansoibk
tuansoibk / cryptography-file-formats.md
Last active July 4, 2024 10:42
Cryptography material conversion and verification commands
  1. Introduction
  2. Standards
  3. Common combinations
  4. Conversion
  5. Verification/Inspection
  6. Tips for recognising

Introduction

It happens that there are many standards for storing cryptography materials (key, certificate, ...) and it isn't always obvious to know which standard is used by just looking at file name extension or file content. There are bunch of questions on stackoverflow asking about how to convert from PEM to PKCS#8 or PKCS#12, while many tried to answer the questions, those answers may not help because the correct answer depends on the content inside the PEM file. That is, a PEM file can contain many different things, such as an X509 certificate, a PKCS#1 or PKCS#8 private key. The worst-case scenario is that someone just store a non-PEM content in "something.pem" file.

// NewWrapResponseWriter wraps an http.ResponseWriter, returning a proxy that allows you to
// hook into various parts of the response process.
func NewWrapResponseWriter(w http.ResponseWriter, protoMajor int) WrapResponseWriter {
_, fl := w.(http.Flusher)
bw := basicWriter{ResponseWriter: w}
if protoMajor == 2 {
_, ps := w.(http.Pusher)
if fl && ps {
@synthetic-intelligence
synthetic-intelligence / More Helpful Commands
Last active July 2, 2024 15:35
Smart Card Config MacOS
# MacOS smartcard
List tokens available in the system
pluginkit -m -p com.apple.ctk-tokens
ex: com.apple.CryptoTokenKit.setoken(1.0)
com.apple.CryptoTokenKit.pivtoken(1.0)
@vhermecz
vhermecz / custom_keys_git_ssh
Created June 8, 2020 11:20
Allow configuring multiple ssh deploy keys with git
#!/bin/bash
# Script to use custom ssh keys for various git repositories
# Run without arguments to get usage info.
#
# How it works:
# When used with SSH, git sends the path to the repository in the SSH command.
# @see: https://github.com/git/git/blob/e870325/connect.c#L1268
# We extract this info and search for a key with the name.
# Based on the source, this seems to be used format since v2.0 at least.
# @see: https://github.com/git/git/commit/a2036d7
@karstengresch
karstengresch / Podman-on-MacOS.md
Created December 20, 2019 15:14 — forked from rbo/Podman-on-MacOS.md
Podman on Mac OS
$ export PATH=$(pwd):$PATH
$ podman-machine create box
Podman machine "box" already exists
$ podman-machine start box
Starting "box"...
@mununki
mununki / user_password_django_pbkdf2_sha256.go
Last active April 28, 2024 09:40
[Go] Implementation Django default password hashing PBKDF2_SHA256 with Go
import (
"crypto/rand"
"crypto/sha256"
"crypto/subtle"
"encoding/base64"
"strconv"
"strings"
"time"
"golang.org/x/crypto/pbkdf2"
@shankarshastri
shankarshastri / LearnXInYMinProtocolBuffer.proto
Last active July 4, 2024 00:52
Self-Explanatory Protocol Buffer Lang Guide (CheatSheet)
/*
* Self-Explanatory Protocol Buffer Lang Guide
*/
/*
* Why Protocol Buffers?
* Protocol buffers are Google's language-neutral, platform-neutral, extensible mechanism for serializing structured data – think XML, but smaller, faster, and simpler.
* You define how you want your data to be structured once, then you can use special generated source code to easily write and read your structured data to and from a variety of data streams and using a variety of languages.
* Protocol Buffers are Schema Of Messages. They are language agnostic.
@dmrub
dmrub / Dockerfile
Last active May 8, 2024 17:07
Dockerfile piece for installing su-exec in debian/ubuntu container
# Install latest su-exec
RUN set -ex; \
\
curl -o /usr/local/bin/su-exec.c https://raw.githubusercontent.com/ncopa/su-exec/master/su-exec.c; \
\
fetch_deps='gcc libc-dev'; \
apt-get update; \
apt-get install -y --no-install-recommends $fetch_deps; \
rm -rf /var/lib/apt/lists/*; \
gcc -Wall \