This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// prime.c | |
// aaron67.cc | |
#include <stdio.h> | |
#include <string.h> | |
const int N = 1000000; | |
const int PRINT_N_INTEGER_PER_LINE = 10; | |
int main() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.ArrayList; | |
import java.util.List; | |
import java.util.concurrent.CountDownLatch; | |
class MultiThread implements Runnable { | |
private Item item; | |
private CountDownLatch signal; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// main.cpp | |
// two-eggs-problem | |
// | |
// Created by aaron67 on 15/2/12. | |
// Copyright (c) 2015年 aaron67. All rights reserved. | |
// | |
// 参考:http://ppwwyyxx.com/2013/Problem-of-Two-Eggs/ | |
// | |
// 题目描述: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// main.cpp | |
// hex-to-oct | |
// | |
// Created by aaron67 on 2017/1/23. | |
// Copyright © 2017年 aaron67. All rights reserved. | |
// | |
#include <iostream> | |
#include <string> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// main.cpp | |
// hex-to-oct | |
// | |
// Created by aaron67 on 2017/1/23. | |
// Copyright © 2017年 aaron67. All rights reserved. | |
// | |
#include <iostream> | |
#include <iomanip> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Show hidden characters
{ | |
"auto_complete": true, | |
"auto_complete_commit_on_tab": true, | |
// 在选中区域搜索 | |
"auto_find_in_selection": true, | |
"bold_folder_labels": true, | |
"color_scheme": "Packages/Color Scheme - Default/Monokai Bright.tmTheme", | |
"create_window_at_startup": false, | |
"draw_white_space": "all", | |
"highlight_line": true, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// https://github.com/crypto-browserify/pbkdf2 | |
// | |
const crypto = require('crypto'); | |
const hash = 'sha512' | |
const round = 2048 | |
const seed_bytes = 64 | |
var mnemonic = 'furnace tunnel buyer merry feature stamp brown client fine stomach company blossom' | |
var passphrase = '' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from bitsv.base58 import b58encode, b58decode | |
from bitsv.crypto import ECPrivateKey, sha256, hash160 | |
from binascii import hexlify | |
# | |
# pip install bitsv | |
# | |
# https://aaron67.cc/2019/01/04/bitcoin-address/ | |
# | |
print() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from pytz import timezone | |
from datetime import datetime | |
now = timezone('Asia/Shanghai').fromutc(datetime.utcnow()) | |
print(now.strftime('%Y-%m-%d %H:%M:%S')) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from ec_point_operation import curve, add, scalar_multiply | |
from modular_inverse import modular_multiplicative_inverse | |
from crypto import double_sha256 | |
import random | |
def hash_to_int(message: bytes) -> int: | |
"""Calculate the bitcoin double-sha256 hash of the message, return as an integer""" | |
h = double_sha256(message) | |
return int.from_bytes(h, byteorder='big') |