Skip to content

Instantly share code, notes, and snippets.

View k06a's full-sized avatar
🚀
DeFi dreamer

Anton Bukov k06a

🚀
DeFi dreamer
View GitHub Profile
@k06a
k06a / PuppyWatchdog
Last active November 13, 2016 12:38
Puppy Watchdog (1) on Medium.com
🐶 Main thread was blocked for 0.17 sec
🐶 Main thread is still blocked for 0.27 sec
🐶 Main thread is still blocked for 0.37 sec
🐶 Main thread is still blocked for 0.48 sec
🐶 Main thread is still blocked for 0.60 sec
🐶 Main thread is still blocked for 0.71 sec
🐶🐶🐶🐶🐶🐶🐶🐶🐶🐶 Collected 39 reports for 0.8 sec:
100.000% _start (in libdyld.dylib)
| 100.000% __mh_execute_header (in xctest)
| | 100.000% __XCTestMain (in XCTest)
@k06a
k06a / UILabel+FastTextColorChange.m
Created December 19, 2016 15:31
UIView to replace UILabel with ability to super fast change text color
@interface LabelMaskedView : UIView
@property (strong, nonatomic) UIView *maskView;
@property (assign, nonatomic) CGSize cachedIntrisincContentSize;
@end
@implementation LabelMaskedView
- (instancetype)initWitLabel:(UIView *)maskView {
@k06a
k06a / WhenNoScrollingExecutor.m
Last active November 28, 2020 04:56
Executor performing blocks at least after 0.2 sec since last scrolling
static NSTimeInterval const kMinInactiveTime = 0.2;
//
@interface WhenNoScrollingExecutor : NSObject
@property (assign, nonatomic) BOOL runLoopModeWasUITrackingAgain;
- (void)executeBlock:(void (^)())block;
- (void)executeBlock:(void (^)())block completion:(void (^_Nullable)())completion;
@k06a
k06a / AVPlayerItem+MLWPerformance.m
Last active September 7, 2023 11:51
Smooth AVPlayer scrolling in UICollectionView/UITableView
#import <JRSwizzle/JRSwizzle.h>
@implementation AVPlayerItem (MLWPerformance)
+ (void)load {
[AVPlayerItem jr_swizzleMethod:NSSelectorFromString(@"_attachToFigPlayer") withMethod:@selector(mlw_attachToFigPlayer) error:nil];
}
- (void)mlw_attachToFigPlayer {
static dispatch_queue_t queue = nil;
@k06a
k06a / MLWAsyncAVPlayer.h
Last active September 7, 2023 11:51
Awesome optimized AVPlayer for smooth scrolling AVPlayerLayer inside UICollectionView/UITableView (tested on iOS10+)
#import <AVFoundation/AVFoundation.h>
@interface MLWAsyncAVPlayer : AVPlayer
@end
@k06a
k06a / keybase.md
Last active June 7, 2017 10:13
keybase.md

Keybase proof

I hereby claim:

  • I am k06a on github.
  • I am k06a (https://keybase.io/k06a) on keybase.
  • I have a public key ASCluXHEStF-cY5wgzsAWQsU50gb7uxtC1fpJlQYS-22_Qo

To claim this, I am signing this object:

@k06a
k06a / VanityPool.sol
Last active January 18, 2021 14:51
VanityPool
pragma solidity ^0.4.0;
contract VanityTask {
function lengthOfCommonPrefix(bytes a, bytes b) constant returns(uint) {
uint len = (a.length <= b.length) ? a.length : b.length;
for (uint i = 0; i < len; i++) {
if (a[i] != b[i]) {
return i;
}
@k06a
k06a / install-ffmpeg-with-h265.sh
Last active March 9, 2021 15:51
H265 with ffmpeg
# Installing ffmpeg with H265 support
brew tap varenc/ffmpeg
brew install varenc/ffmpeg/ffmpeg --with-fdk-aac --HEAD
# Installing mp4edit tool
brew install bento4
@k06a
k06a / arguments.js
Last active October 24, 2017 14:22
Constructor Arguments ABI-encoded
var abi = require('ethereumjs-abi');
var x = abi.simpleEncode("constructor(uint256,uint256,uint256,address,address,address,address)",
1508878283,
1519431362,
4700,
"0x0b8e27013dfA822bF1cc01b6Ae394B76DA230a03",
"0x5F85A0e9DD5Bd2F11a54b208427b286e9B0B519F",
"0x7F781d08FD165DBEE1D573Bdb79c43045442eac4",
"0x98bf67b6a03DA7AcF2Ee7348FdB3F9c96425a130");
@k06a
k06a / count-bits-set-256.sol
Created November 15, 2017 10:28
Count bits set 256
// https://graphics.stanford.edu/~seander/bithacks.html#CountBitsSetParallel
function countBits(uint256 v) public constant returns(uint256) {
v = v - ((v >> 1) & uint256(~uint256(0)/3));
v = (v & uint256(~uint256(0)/15*3)) + ((v >> 2) & uint256(~uint256(0)/15*3));
v = (v + (v >> 4)) & uint256(~uint256(0)/255*15);
return uint256(v * (uint256(~uint256(0)/255))) >> (32 - 1) * 8;
}