Skip to content

Instantly share code, notes, and snippets.

Artem ArtemGr

  • Bizlink
Block or report user

Report or block ArtemGr

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 artemgr on github.
  • I am artemciy (https://keybase.io/artemciy) on keybase.
  • I have a public key ASCUwRz1jGzzJ5ZZsUS6-rRSQSqBmYnZ77If1bdOyBWnfAo

To claim this, I am signing this object:

@ArtemGr
ArtemGr / druidstone-ch.ahk
Last active Dec 25, 2019
Example automating the Cheat Happens editor with AutoHotkey
View druidstone-ch.ahk
#If WinActive("Druidstone")
q::
MouseGetPos, mouseStartX, mouseStartY
if WinExist("Cheat Happens Trainer") {
WinActivate
WinMove, 600, 111
MouseMove, 210, 180, 5
MouseClick, Left
MouseMove, 900, 320, 5
@ArtemGr
ArtemGr / main.dart
Created Dec 11, 2019
stackoverflow-33424185-2
View main.dart
// https://stackoverflow.com/questions/33424185/why-are-incorrect-type-assignments-allowed-in-dart
void main() {
Map<String, dynamic> map = {
'str': 'test',
'integer': 5,
'decimal': 1.5,
'list': [1,2,3]
};
@ArtemGr
ArtemGr / main.dart
Created Dec 11, 2019
stackoverflow-33424185-1
View main.dart
// https://stackoverflow.com/questions/33424185/why-are-incorrect-type-assignments-allowed-in-dart
void main() {
String str = "test";
int integer = 5;
double decimal = 1.5;
List list = [1,2,3];
String s = decimal; print(s); // 1.5
int i = str; print(i); // test
View pin-pepper.md

We need a second device to enforce the time limits

Password security relies to a large degree on the time limits imposed upon password verification.

That is, if I can verify three passwords per minute then guessing an alphanumeric password of eight characters might take approximately Math.pow (36, 8) / 2 / (86400 / 20) / 365 = 2236 years, but if I can verify three million passwords per second then guessing the same password might take Math.pow (36, 8) / 2 / (86400 * 3000000) = 5 days.

If we limit a PIN to be verified no more than three times per ten minutes

@ArtemGr
ArtemGr / Cargo.toml
Last active Jan 28, 2018
Inline hex escape
View Cargo.toml
[package]
name = "hex"
version = "0.1.0"
[dependencies]
fomat-macros = "*"
@ArtemGr
ArtemGr / map_bench.rs
Last active Apr 3, 2017
small strings map benchmark
View map_bench.rs
// [build] cd .. && cargo bench
#![feature(asm, test)]
extern crate inlinable_string;
extern crate ordermap;
extern crate seahash;
extern crate test;
use inlinable_string::{InlinableString, StringExt};
@ArtemGr
ArtemGr / verify.rs
Created Feb 25, 2017
Using OpenSSL to verify the JWT RS256 signature in Rust.
View verify.rs
use openssl::sign::Verifier;
use openssl::rsa::Rsa;
use openssl::pkey::PKey;
use openssl::hash::MessageDigest;
use serde_json::{self as json, Value as Json};
pub fn firebase_id_token (headers: BTreeMap<&str, &str>, mut stream: &mut BufStream<TcpStream>) -> Result<(), String> {
#[derive(Deserialize, Debug)]
struct Post {firebase_id_token: String}
@ArtemGr
ArtemGr / cmake.rs
Last active Oct 7, 2016
cmake.rs - Use a proper generator under CLion
View cmake.rs
// [build] rustc -O cmake.rs
// cf. https://youtrack.jetbrains.com/issue/CPP-188#comment=27-899992
use std::env::args;
use std::fs::OpenOptions;
use std::io::Write;
use std::path::Path;
use std::process::Command;
fn main() {
View libpg_and_libevent.cpp
// Asynchronous PostgreSQL INSERT.
glim::NsecTimer timer;
std::unique_ptr<PGconn, void(*)(PGconn*)> pg (PQconnectStart (pcs.c_str()), PQfinish);
if (pg.get() == nullptr || PQstatus (pg.get()) == CONNECTION_BAD) GTHROW ("!PQconnectStart");
int sock = PQsocket (pg.get());
auto evBase = EvServ::instance()->evbase();
event_callback_fn cbcoroInvokeFromCallback = [](evutil_socket_t, short, void* cbcoro) {((CBCoro*) cbcoro)->invokeFromCallback();};
std::unique_ptr<struct event, void(*)(struct event*)> evRead (event_new (evBase.get(), sock, EV_READ, cbcoroInvokeFromCallback, cbcoro), event_free);
You can’t perform that action at this time.