Skip to content

Instantly share code, notes, and snippets.

View xni's full-sized avatar

I.B. xni

  • Finance
  • Georgia
View GitHub Profile
#!/bin/bash
if [ $# != 2 ]
then
echo "Format: $0 TRANSACTION_ID FEE"
exit 1
fi
TRANSACTION_ID="$1"
FEE="$2"

Keybase proof

I hereby claim:

  • I am xni on github.
  • I am knikitin (https://keybase.io/knikitin) on keybase.
  • I have a public key ASBZ89CNVC0dC_QwwxOM4-uFeNVLWoQKjZZEe-SpY3hNPAo

To claim this, I am signing this object:

@xni
xni / for_full.py
Last active October 24, 2019 21:27
>>> def my_f():
... str1 = ""
... for i in range(1000):
... str1 = str1 + str(i)
... return str1
>>> dis.dis(my_f)
2 0 LOAD_CONST 1 ('')
2 STORE_FAST 0 (str1)
@xni
xni / main.cpp
Created August 6, 2019 22:54
PrisonserCell
#include <array>
#include <iostream>
struct CellProgress {
int loop_starts;
int loop_size;
};
constexpr int next(int cur) {
@xni
xni / count_try.py
Last active June 16, 2019 22:20
Try counter
"""
This module counts amount of try and try/else statements
in the files.
Usage:
find ../cpython/Lib/ -type f -name '*.py' | xargs python3.7 main.py output.md FILE1 FILE2 ...
"""
import ast
import logging
@xni
xni / main.cpp
Created December 21, 2018 12:07
Type introspection
#include <cstdlib>
#include <cstdio>
#include <chrono>
#include <variant>
#include <vector>
#include <typeinfo>
#include <type_traits>
using Clock = std::chrono::high_resolution_clock;
@xni
xni / main.cpp
Created August 3, 2018 10:36
ThreadPool for downloads
#include <bdlmt_threadpool.h>
#include <bsl_string.h>
#include <chrono>
#include <thread>
#include <future>
#include <iostream>
#include <bsl_vector.h>
struct DownloadTask {
@xni
xni / main.cpp
Created June 23, 2017 09:25
Compile time check if type is an import type
#include <iostream>
#include <type_traits>
template<class>
struct sfinae_true : std::true_type{};
struct is_file_node {
template <typename X>
static auto value(X x, int) -> sfinae_true<decltype(x.fileOwner)> {
}
@xni
xni / main.py
Created February 15, 2016 13:10
humbledb bug
>>> import humbledb
>>> class P(humbledb.Document):
... x = humbledb.Embed('x')
... x.a = 'a'
...
>>> obj = P()
>>> obj.x = []
>>> item1 = obj.x.new()
>>> item1.a = 'a'
>>> item2 = obj.x.new()
from collections import defaultdict
import time
import traceback
import pymongo
COUNT = 50000
db = pymongo.MongoClient().db.orders