Skip to content

Instantly share code, notes, and snippets.

View ivarprudnikov's full-sized avatar
🌍
Vivamus, moriendum est.

Ivar (aɪvɑr) ivarprudnikov

🌍
Vivamus, moriendum est.
View GitHub Profile
podx-0 /foo/bar/
ledger_1-7.committed ledger_10003-10629.committed ledger_8-10002.committed
podx-0 /foo/baz/
snapshot_10002_10004.committed snapshot_148573_148575.committed snapshot_202606_202607.committed
podx-1 /foo/bar/
ledger_1-7.committed ledger_10003-10629.committed ledger_8-10002.committed
podx-1 /foo/baz/
apt-get update
apt-get install gvm
...
gvm-setup
...
gvm-check-setup
...
// fix issues by looking into output
...
@ivarprudnikov
ivarprudnikov / go.mod
Created February 29, 2024 12:14
Create COSE_Sign1 signature envelope in Go and sign with a key in Azure KeyVault
module something.com/whatever
go 1.19
require github.com/veraison/go-cose v1.1.1-0.20240126165338-2300d5c96dbd
require (
github.com/Azure/azure-sdk-for-go/sdk/azcore v1.9.2 // indirect
github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.5.1 // indirect
github.com/Azure/azure-sdk-for-go/sdk/internal v1.5.2 // indirect
@ivarprudnikov
ivarprudnikov / multipart-form-data.go
Created February 27, 2023 15:36
Send multipart form data in go
package main
import (
"bytes"
"mime/multipart"
"net/http"
)
func PostFormMultipart(content []byte) (*http.Response, error) {
url := "http://localhost:8080"
@ivarprudnikov
ivarprudnikov / sh
Created September 21, 2022 15:57
Create CosmosDB authorization token
#!/bin/env bash
set -e
# Generate Cosmos DB authorization header
# and create a database in the emulator
# HTTP-date
# https://www.rfc-editor.org/rfc/rfc7231#section-7.1.1.1
ISSUE_DATE=$(TZ=GMT date '+%a, %d %b %Y %T %Z')
@ivarprudnikov
ivarprudnikov / inspect.sh
Created February 16, 2022 12:53
Run and inspect a Docker container
$ docker exec -it testcontainer /bin/bash
[root@18dbc0919c88 /]#
@ivarprudnikov
ivarprudnikov / main.go
Created November 5, 2021 18:07
Go parallel execution
package main
import (
"errors"
"log"
"time"
"sync"
"fmt"
)
@ivarprudnikov
ivarprudnikov / mergeSort.js
Created February 7, 2021 13:21
Merge sort in javascript
var arr = [0,5,7,3,4,9,6,2,1,8];
var ans = [0,1,2,3,4,5,6,7,8,9];
// Split array into smaller chunks recursively [a,b,c,d] => [a,b] and [c,d]
// At the bottom (or top of stack) start merging those back
// O(NlogN)
function mergeSort(a, startIdx, endIdx) {
if (startIdx < endIdx) {
var mid = Math.floor((startIdx + endIdx)/2);
mergeSort(a, startIdx, mid);
@ivarprudnikov
ivarprudnikov / dynamo_insert_row_node_sdk.js
Created March 17, 2020 10:59
Insert rows into dynamo table
const config = {
region: 'eu-west-1',
table: 'MyTableName'
};
const AWS = require('aws-sdk');
const ddb = new AWS.DynamoDB({
apiVersion: '2012-08-10',
region: config.region
});
@ivarprudnikov
ivarprudnikov / .zshrc
Last active December 6, 2023 22:18
Initial zshrc config
# zsh config
###############
# Load version control information
autoload -Uz vcs_info
precmd() { vcs_info }
# Format the vcs_info_msg_0_ variable
zstyle ':vcs_info:git:*' formats '(%b) '
autoload -U colors && colors
setopt PROMPT_SUBST