Skip to content

Instantly share code, notes, and snippets.

Artem ArtemGr

  • Bizlink
View GitHub Profile
@ArtemGr
ArtemGr / map_bench.rs
Last active Jun 5, 2020
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 / makefile
Last active May 22, 2020
SPI helper for a PostgreSQL CHECK when using one-to-many with a jsonb.
View makefile
all: spi.so
spi.so: spi.o makefile
g++ -shared -o spi.so spi.o
cp --remove-destination spi.so /var/lib/postgresql/spi.so
spi.o: spi.cc makefile
g++ -g -O2 -Wall -std=c++11 -fpic -c -o spi.o -I/usr/include/postgresql -I/usr/include/postgresql/9.4/server spi.cc
clean:
@ArtemGr
ArtemGr / example.sh
Last active May 20, 2020
Testing HTTP pipelining from the command line.
View example.sh
# http://aaronhawley.livejournal.com/12621.html
(echo -en "GET / HTTP/1.1\nHost: fropl.com\n\nGET / HTTP/1.1\nHost: fropl.com\n\n"; sleep 0.1) | telnet localhost 80
# Also:
perl -e '$| = 1; print "GET / HTTP/1.1\nHost: fropl.com\n\nGET / HTTP/1.1\nHost: fropl.com\n\n"; sleep (1)' | telnet localhost 80
# Also (from https://github.com/ellzey/libevhtp/issues/86#issuecomment-19137572):
(echo -en "GET /1 HTTP/1.1\r\n\r\nGET /2 HTTP/1.1\r\n\r\n"; sleep 0.1) | nc localhost 8081
@ArtemGr
ArtemGr / BsonJson.cpp
Last active Apr 29, 2020
BSON-JSON with C++ and Rapidjson
View BsonJson.cpp
#include <mongo/bson/bson.h>
using mongo::BSONObj; using mongo::BSONObjBuilder;
using mongo::BSONArray; using mongo::BSONArrayBuilder;
using mongo::BSONElement;
#include <rapidjson/document.h>
#include <rapidjson/reader.h>
#include <rapidjson/writer.h>
#include <rapidjson/stringbuffer.h>
@ArtemGr
ArtemGr / SCGI.java
Last active Mar 28, 2020
Java SCGI connector
View SCGI.java
/*
Copyright (c) 2008 ArtemGr
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
@ArtemGr
ArtemGr / system.rs
Last active Mar 13, 2020
Read lines from a pipe as soon as they come out (useful for filtering).
View system.rs
#![feature(mpsc_select, box_syntax)]
use std::io;
use std::process::Command;
use std::sync::mpsc::{channel, Receiver, Select};
use std::string::FromUtf8Error;
use std::thread::spawn;
#[derive(Debug)]
enum PipeError {
@ArtemGr
ArtemGr / mac-port-forwarding-fails.txt
Created Feb 17, 2020
mac-port-forwarding-fails.txt
View mac-port-forwarding-fails.txt
administrator@macinvalut:~$ docker stop komodo-dex
komodo-dex
administrator@macinvalut:~$ docker run -d --rm -p 14868:14868 -p 14869:14869 --name komodo-dex komodo-dex
479ca54e6d7c2a6d53cab4823b47c44ba5bd1cb712cfd4bed8b5cb79cccf96e6
administrator@macinvalut:~$ docker logs komodo-dex
ASSETCHAINS_SUPPLY 999999
MAX_MONEY 100006220417438 1000062.20417438
>>>>>>>>>> DEXP2P: p2p.14868 rpc.14869 magic.6378a12f 1668849967 999999 coins
call komodo_args.(komodod) NOTARY_PUBKEY.()
nMaxConnections 384
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]
};
You can’t perform that action at this time.