Skip to content

Instantly share code, notes, and snippets.

⌨️
I am jumping on the keyboard

Sergey Tolmachev Tolsi

⌨️
I am jumping on the keyboard
Block or report user

Report or block Tolsi

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View keybase.md

Keybase proof

I hereby claim:

  • I am tolsi on github.
  • I am tolsi (https://keybase.io/tolsi) on keybase.
  • I have a public key ASA0CeTgUKQhTLd-uw2sGJ9r8dBNvuXpKyS5jm2bQESQ5Ao

To claim this, I am signing this object:

@Tolsi
Tolsi / Base58Length.scala
Created May 21, 2018
Scala base58 bytes array size by string and string length by bytes array size
View Base58Length.scala
object Base58Length {
private val BytesMaxValue = 256
private val Base58MaxValue = 58
private val BytesLog = math.log(BytesMaxValue)
private val BaseLog = math.log(Base58MaxValue)
def base58Length(byteArrayLength: Int): Int = math.ceil(BytesLog / BaseLog * byteArrayLength).toInt
def bytesLength(base58Length: Int): Int = math.ceil(BaseLog / BytesLog * base58Length).toInt
}
@Tolsi
Tolsi / convert-cryptopro.sh
Created Mar 13, 2018
Export CryptoPro keys from Windows Regedit format
View convert-cryptopro.sh
#!/bin/bash
# Конвертация выгрузки ключей CryptoPro из реестра Windows в папочку с бинарными ключами
# Из реестра выгружать ветку HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Crypto Pro\Settings\Users\<кто-то>\Keys
# Converting the exported CryptoPro keys from the Windows registry to the container folder with binary keys
# Dump regedit path from the registry HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Crypto Pro\Settings\Users\<username>\Keys
curpath=./
temp=$curpath/temp
@Tolsi
Tolsi / SignAsWaves.scala
Created Feb 14, 2018
Sign Ed25519 As Whisper Systems Curve25519 used at Waves
View SignAsWaves.scala
package test
import com.muquit.libsodiumjna.SodiumLibrary
import scorex.crypto.encode.Base58
import scorex.crypto.signatures.Curve25519
object SignAsWaves extends App {
SodiumLibrary.setLibraryPath("/usr/local/Cellar/libsodium/1.0.16/lib/libsodium.dylib")
val message = "message"
@Tolsi
Tolsi / gist:d8b06b37350f203618a1a7b07f07ea42
Created Feb 4, 2018 — forked from sjp38/gist:6202539
Sample code for monkeyrunner's MOVE usage
View gist:d8b06b37350f203618a1a7b07f07ea42
#!/usr/bin/env monkeyrunner
import time
from com.android.monkeyrunner import MonkeyRunner, MonkeyDevice
device = MonkeyRunner.waitForConnection()
# Touch down screen
device.touch(100, 500, MonkeyDevice.DOWN)
@Tolsi
Tolsi / gist:bf2133e669880cfd91f70ae62a80c64d
Created Dec 22, 2017
Waves distribution using WavesJ
View gist:bf2133e669880cfd91f70ae62a80c64d
import com.wavesplatform.wavesj.{Asset, Node, PrivateKeyAccount, Transaction}
object Mainb extends App {
val seeds = Seq.fill(30)(PrivateKeyAccount.generateSeed())
val myAcc = new PrivateKeyAccount("", 0, 'W')
val addresses = seeds.map(s => new PrivateKeyAccount(s, 0, 'W'))
val txs = addresses.map(a => Transaction.makeTransferTx(myAcc, a.getAddress, 100000000, Asset.WAVES, 100000, Asset.WAVES, ""))
println(seeds.mkString("\n"))
println(txs.map(_.getJson))
View bledemo.java
package org.bluetooth.bledemo;
import java.util.HashMap;
import android.util.SparseArray;
public class BleNamesResolver {
private static HashMap<String, String> mServices = new HashMap<String, String>();
private static HashMap<String, String> mCharacteristics = new HashMap<String, String>();
private static SparseArray<String> mValueFormats = new SparseArray<String>();
View gist:45b957f5a021e4af9838882eb1a02a20
Verifying that "tolsi12.id" is my Blockstack ID. https://onename.com/tolsi12
@Tolsi
Tolsi / ram_functions.sh
Last active Jun 7, 2016
Bash functions for create/mount and umount RAM partitions for Mac OS X 10.11
View ram_functions.sh
# pass size in mb and optional name
function ram_disk_mb() {
name=${2:-disk}
diskutil erasevolume HFS+ "ram_$name" $(hdiutil attach -nomount ram://$(($1*2048)))
}
# pass size in gb and optional name
function ram_disk_gb() {
ram_disk_mb $(($1*1024))
}
View SQLToIterator.scala
package scalikejdbc
import java.sql.{Connection, ResultSet, SQLException}
import java.util.{Timer, TimerTask}
import scala.collection._
import scala.util.Try
object SQLToIterator {
def apply[A, E <: WithExtractor](sql: SQL[A, HasExtractor])(implicit connectionPool: ConnectionPool): SQLToIterator[A, E] = {
You can’t perform that action at this time.