Skip to content

Instantly share code, notes, and snippets.

View kmansoft's full-sized avatar

Kostya Vasilyev kmansoft

View GitHub Profile
@kmansoft
kmansoft / simple-4.yaml
Created May 11, 2022 19:09
Creating two network interfaces, one with EIP
AWSTemplateFormatVersion: '2010-09-09'
Description: 'Test - simple 2 network interfaces'
Parameters:
KeyName:
Description: 'Key Pair name'
Type: 'AWS::EC2::KeyPair::KeyName'
Default: kman
Resources:
VPC:
Type: 'AWS::EC2::VPC'
@kmansoft
kmansoft / simple-3.yaml
Created May 11, 2022 03:44
AWS CloudFormation - two network interfaces - public and private
AWSTemplateFormatVersion: '2010-09-09'
Description: 'Test - simple 2 network interfaces'
Parameters:
KeyName:
Description: 'Key Pair name'
Type: 'AWS::EC2::KeyPair::KeyName'
Default: kman
Resources:
VPC:
Type: 'AWS::EC2::VPC'
@kmansoft
kmansoft / simple-2.yaml
Last active May 10, 2022 23:58
An attempt at two network interfaces per EC2 node - results in an error
AWSTemplateFormatVersion: '2010-09-09'
Description: 'Test - simple 2 network interfaces'
Parameters:
KeyName:
Description: 'Key Pair name'
Type: 'AWS::EC2::KeyPair::KeyName'
Default: kman
Resources:
VPC:
Type: 'AWS::EC2::VPC'
#!/usr/bin/env python3
import sys
import argparse
import secrets
ALPHABET = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_-'
if __name__ == "__main__":
@kmansoft
kmansoft / LongToMultiLongArray.kt
Created June 9, 2020 07:53
A multi-map of long's in Kotlin
class LongToMultiLongArray {
fun put(key: Long, value: Long) {
var i = ContainerHelpers.binarySearch(mKeys, mSize, key)
if (i >= 0) {
val index = mIndices[i]
val offset = ((index shr 32) and 0x7FFF).toInt()
val cap = ((index shr 16) and 0x7FFF).toInt()
val len = ((index) and 0x7FFF).toInt()
function makeDebounce(real, interval) {
var timerValue;
return function() {
if (timerValue) {
clearTimer(timerValue)
}
timerValue = setTimer(real, interval)
}
}
@kmansoft
kmansoft / parse_jwk.go
Created July 18, 2019 12:05
Parse JWK in GO (Golang)
package auth
import (
"crypto/rsa"
"encoding/base64"
"encoding/json"
"fmt"
"math/big"
)
@kmansoft
kmansoft / build.gradle
Created December 9, 2018 19:51
Failing exoplayer dependencies
// Copyright (C) 2016 The Android Open Source Project
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
@kmansoft
kmansoft / AppLocaleManager.java
Created September 16, 2016 14:35
Change Android application locale
package org.kman.Compat.util;
import java.util.Locale;
import android.annotation.TargetApi;
import android.content.Context;
import android.content.SharedPreferences;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.os.Build;
@kmansoft
kmansoft / CollateTrie.java
Last active January 17, 2019 23:30
A simple Java trie for collated (hex-encoded) strings
package org.kman.Compat.util;
import java.util.ArrayDeque;
import java.util.Collection;
import java.util.Deque;
/**
* Created by kman on 8/30/16.
*
* Works only with collated strings (hex encoded)