Skip to content

Instantly share code, notes, and snippets.

View qtxie's full-sized avatar
🏠
Working from home

Qingtian qtxie

🏠
Working from home
  • FullStack Technologies
View GitHub Profile
@qtxie
qtxie / utxs
Created June 17, 2019 14:51
BTC legacy address 之间互转出错
utxs: [inputs [[addr "mnXVvGotveRZUYH7qX9sYBQwwvUEbNH4Jy" pubkey #{
04CA60B8F84405C00EEE10DC62D4B42E9C475E8D1213932DB38073C8C22CA0C5
40DC534D59C252D0B96E008FE6BD1CC7B8EB64B659B9D7C3AFD9BC6CF5576A7E
6E
} tx-hash {87ca1a8160708df6e7f0e6fd335ddd447aed015eb6e5bb9b845230edf7988c01} pat
h [-2147483604 -2147483647 -2147483648 1 0] info [version 1 lock_time 0 inputs [
[prev-addresses ["msZnufFHcrxKK29jUcksxADMFvztPZk5jJ"] prev-position 0 prev-tx-h
ash {20c3030d3e17989ac22d1c65b537f8e38824b244492d09550df6bc58596e2038} script-he
x {483045022100a25b8d3752022b4c8e8a927a6eb38f00a22a8c20e43029533af5f16bc32236250
2206befdb03169be0a2a4b47d3b1362c026e30b0491aeb36d5177a415cfe7e44c28012102a3bcf3b
@qtxie
qtxie / min-heap.reds
Created December 21, 2018 13:19
A min-heap in Red/System
Red/System [
Title: "A min-heap implementation"
Author: "Xie Qingtian"
File: %min-heap.reds
Tabs: 4
Rights: "Copyright (C) 2018 Xie Qingtian. All rights reserved."
License: {
Distributed under the Boost Software License, Version 1.0.
See https://github.com/red/red/blob/master/BSL-License.txt
}
@qtxie
qtxie / Of Mice and Men
Created March 22, 2017 07:03 — forked from svoisen/Of Mice and Men
Information on low-level scrolling events on Mac OS X
From the WebKit documentation at:
http://www.opensource.apple.com/source/WebKit/WebKit-7533.16/chromium/src/mac/WebInputEventFactory.mm
// Of Mice and Men
// ---------------
//
// There are three types of scroll data available on a scroll wheel CGEvent.
// Apple's documentation ([1]) is rather vague in their differences, and not
// terribly helpful in deciding which to use. This is what's really going on.
//

Keybase proof

I hereby claim:

  • I am qtxie on github.
  • I am qtxie (https://keybase.io/qtxie) on keybase.
  • I have a public key whose fingerprint is 8DEE 946F 308F B191 FD47 2505 9B1C 7BFD AF8D 021F

To claim this, I am signing this object:

@qtxie
qtxie / gist:67b382155c516b6af7b61a985880380e
Created November 10, 2016 23:30 — forked from Koze/gist:10550725
List of monospace font
// UIFontDescriptor on iOS 7 or later
NSDictionary *traitsAttributes = @{UIFontSymbolicTrait: @(UIFontDescriptorTraitMonoSpace)};
NSDictionary *fontAttributes = @{UIFontDescriptorTraitsAttribute: traitsAttributes};
UIFontDescriptor *fontDescriptor = [UIFontDescriptor fontDescriptorWithFontAttributes:fontAttributes];
NSArray *array = [fontDescriptor matchingFontDescriptorsWithMandatoryKeys:nil];
for (UIFontDescriptor *descriptor in array) {
NSLog(@"%@", descriptor.postscriptName);
// NSLog(@"%@", [descriptor objectForKey:UIFontDescriptorNameAttribute]);
// NSLog(@"%@", [descriptor objectForKey:UIFontDescriptorVisibleNameAttribute]);
@qtxie
qtxie / irq_balance_habrahabr.sh
Created October 24, 2016 04:18 — forked from pavel-odintsov/irq_balance_habrahabr.sh
irq_balance_habrahabr.sh
#!/bin/bash
# from http://habrahabr.ru/post/108240/
ncpus=`grep -ciw ^processor /proc/cpuinfo`
test "$ncpus" -gt 1 || exit 1
n=0
for irq in `cat /proc/interrupts | grep eth | awk '{print $1}' | sed s/\://g`
do
f="/proc/irq/$irq/smp_affinity"
@qtxie
qtxie / latency.markdown
Created October 8, 2016 23:15 — forked from hellerbarde/latency.markdown
Latency numbers every programmer should know

Latency numbers every programmer should know

L1 cache reference ......................... 0.5 ns
Branch mispredict ............................ 5 ns
L2 cache reference ........................... 7 ns
Mutex lock/unlock ........................... 25 ns
Main memory reference ...................... 100 ns             
Compress 1K bytes with Zippy ............. 3,000 ns  =   3 µs
Send 2K bytes over 1 Gbps network ....... 20,000 ns  =  20 µs
SSD random read ........................ 150,000 ns  = 150 µs

Read 1 MB sequentially from memory ..... 250,000 ns = 250 µs

@qtxie
qtxie / JSON.red
Last active October 6, 2016 22:39 — forked from dockimbel/JSON.red
JSON toy parser for Red
Red [
Title: "JSON parser"
File: %json.red
Author: "Nenad Rakocevic, Qingtian Xie"
License: "BSD-3 - https://github.com/red/red/blob/master/BSD-3-License.txt"
]
json: context [
quoted-char: charset {"\/bfnrt}
exponent: charset "eE"
@qtxie
qtxie / gameoflife2.red
Last active September 30, 2016 07:35 — forked from Mufferaw/gameoflife2.red
system/view/auto-sync?: no
grid: collect [repeat i 50 [keep/only collect [repeat j 50 [keep random true]]]]
scratchgrid: collect [repeat i 50 [keep/only collect [repeat j 50 [keep false]]]]
a: copy grid/1
b: copy grid/50
c: collect [keep/only b keep grid keep/only a]
count-neighbors: function [gridd x y][
@qtxie
qtxie / systemversion.c
Created September 16, 2016 11:41 — forked from deltheil/systemversion.c
iOS: get device OS version from C code via the Objective-C Runtime
#include <objc/runtime.h>
#include <objc/message.h>
#include <CoreFoundation/CoreFoundation.h>
/* ... */
/**
* Return a character string that holds the current version
* of the operating system which is equivalent to: