Skip to content

Instantly share code, notes, and snippets.

@vladignatyev
vladignatyev / progress.py
Last active March 31, 2024 22:54
Python command line progress bar in less than 10 lines of code.
# The MIT License (MIT)
# Copyright (c) 2016 Vladimir Ignatev
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
# and/or sell copies of the Software, and to permit persons to whom the Software
# is furnished to do so, subject to the following conditions:
#
@vladignatyev
vladignatyev / say.sh
Created November 10, 2023 10:04
Say AI: Linux's `say` command-line tool for voice over using OpenAI TTS model.
#!/bin/bash
# Function to display help
usage() {
echo "Usage: $0 [-o output_file] [-v voice] [-m model] [-i input_file] \"input_string\""
exit 1
}
# Default values
output_file="speech.mp3"
@vladignatyev
vladignatyev / Top Bitcoin Dice Games.md
Last active November 17, 2023 10:10
Top Bitcoin Dice Games

Top Bitcoin Dice Games

Curated list of the best Bitcoin Dice games is here. It seems that you're up to play and to win real Bitcoins, but please cool down for a moment and read the notice before you start.

Read before play Bitcoin dice games

This page contains a curated list of awesome Bitcoin betting games that pay. Every game presented has a faucet, so you can claim some free Bitcoins to try the game before actually making your first deposit.

Games listed here, are proven to pay: every game has separate support thread on Bitcointalk forum and pretty huge community behind it. Also, every game listed here is provably fair. It means, that you can test

@vladignatyev
vladignatyev / build.gradle.kts
Created August 5, 2023 15:03
Required dependency to enable Lottie for Jetpack Compose in Android
implementation("com.airbnb.android:lottie-compose:4.0.0")
@vladignatyev
vladignatyev / prompt.txt
Created June 21, 2023 08:46
ChatGPT: Lateral Thinking Helper and PMI Think Robot
You are the PMI Think Robot. Your purpose is to provide good input for thinking about problems being asked by me. I will share you some ideas in free form. Every idea will start from the word IDEA. Then you will help in lateral thinking. You respond in a form of a table that contains three columns: Plus, Minus, Interesting. Let's call this table The PMI Table.
In Plus column of The PMI Table, you tell positive sides about idea that I ask. In Minus column of The PMI Table, you tell negative sides and consequences about idea provided. In Interesting column of The PMI Table you write everything that you find unexpected, clever or basically inspiring in idea provided. Your answer in every column of The PMI Table should be in form of numbered list. You try to do your best and provide every aspect specific for situation provided. If more context required, you'd ask for every clarification needed. After my answer you try again to generate The PMI Table.
@vladignatyev
vladignatyev / dict_to_redis.py
Last active November 23, 2022 01:00
Save Python dict to Redis hash
def dict_to_redis_hset(r, hkey, dict_to_store):
"""
Saves `dict_to_store` dict into Redis hash, where `hkey` is key of hash.
>>> import redis
>>> r = redis.StrictRedis(host='localhost')
>>> d = {'a':1, 'b':7, 'foo':'bar'}
>>> dict_to_redis_hset(r, 'test', d)
True
>>> r.hgetall('test')
@vladignatyev
vladignatyev / PowerSet.swift
Created March 1, 2020 17:16
Combinatorics: Pure Swift 5 Power Set algorithm implementation. Returns power set elements (permutation), in ascending order from smaller to bigger subsets.
import Foundation
class PowerSetIterator<T> {
var sourceSet: [T]
var l: Int
var setlen: Int
var ones: [Int]
var lastDigit: Int?
var yield1: Bool
@vladignatyev
vladignatyev / elbrus.py
Created May 22, 2021 14:55
Elbrus Bootcamp: Back To The 80's Demo
# MIT License
#
# Copyright (c) 2021 Vladimir Ignatev <ya.na.pochte@gmail.com>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
@vladignatyev
vladignatyev / base64utils.js
Last active November 9, 2021 09:42
toBinary() and fromBinary() workaround to make atob() and btoa() work with UTF strings. Example for the original blog post at https://base64tool.com website
/*
* The following snippet is from the Mozilla Developer Portal documentation.
* Utility functions toBinary() and fromBinary() make possible to use btoa() and atob()
* with UTF strings.
*
* The original example here: https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/btoa
* For additional information see: https://base64tool.com/uncaught-domexception-btoa-on-window/
*
* Usage example:
* > btoa(toBinary('☸☹☺☻☼☾☿'))
Date Open High Low Close Volume
2001-01-03 00:00:00 8.8000000 8.8000000 8.8000000 8.8000000 100
2001-01-04 00:00:00 8.8000000 8.8000000 8.8000000 8.8000000 100
2001-01-05 00:00:00 8.7000000 8.7000000 8.7000000 8.7000000 100
2001-01-10 00:00:00 8.1900000 8.2900000 8.1900000 8.2900000 200
2001-01-12 00:00:00 8.4700000 8.4700000 8.4700000 8.4700000 100
2001-01-15 00:00:00 8.4000000 8.4000000 8.4000000 8.4000000 29400
2001-01-16 00:00:00 8.3000000 8.3000000 8.3000000 8.3000000 29400
2001-01-17 00:00:00 8.3000000 8.4000000 8.3000000 8.4000000 26000
2001-01-18 00:00:00 8.5000000 8.5000000 8.3000000 8.4000000 15700