Skip to content

Instantly share code, notes, and snippets.

@imoldman
imoldman / OrderSplitDemo.py
Created October 12, 2018 17:03
按照sku相关性将Order分组,并查集思路解法
class Order(object):
def __init__(self, order_id, sku_id_s):
self.order_id = order_id
self.sku_id_s = sku_id_s
def __repr__(self):
return repr(self.order_id)
class OrderGroup(object):
def __init__(self):
self.head_group = self
@imoldman
imoldman / pwn22_exp.py
Last active September 6, 2018 12:50
网鼎杯 半决赛 pwn writeup
# user (0x130, 0x128)
# [0, 8) name_p (size <= 0x1000)
# [8, 0x10) age
# [0x10, 0x110) description
# [0x110, 0x118) link_message_head
# [0x118, 0x120) friend
# [0x120, 0x128) valid or not
# message (0x20, 0x18)
# [0, 8) title_p (string_size+1 <= 0x1000)
@imoldman
imoldman / wx-components.css
Created January 12, 2017 14:09
default css for we app (微信小程序默认CSS样式)
html {
-webkit-user-select: none;
user-select: none;
height: 100%;
width: 100%;
}
body {
-webkit-user-select: none;
user-select: none;
width: 100%;
@imoldman
imoldman / gist:27225d51f224ebd54162
Created December 18, 2015 09:00 — forked from phatblat/gist:0dd175b406cf2f3fbfc9
xcodebuild -exportOptionsPlist available keys (Xcode 7b6)
Available keys for -exportOptionsPlist:
compileBitcode : Bool
For non-App Store exports, should Xcode re-compile the app from bitcode? Defaults to YES.
embedOnDemandResourcesAssetPacksInBundle : Bool
For non-App Store exports, if the app uses On Demand Resources and this is YES, asset packs are embedded in the app bundle so that the app can be tested without a server to host asset packs. Defaults to YES unless onDemandResourcesAssetPacksBaseURL is specified.
@imoldman
imoldman / FMDatabase+AutoRollback.m
Created May 13, 2014 11:09
Auto rollback version for - [FMDatabase inSavePoint]
@interface FMDatabase (AutoRollback)
@end
@implementation FMDatabase (AutoRollback)
- (NSError*)inAutoRollbackSavePoint:(NSError* (^)())block
{
@imoldman
imoldman / NSThread+RunBlock.h
Created February 10, 2014 06:45
handy category for run some block on a NSThread
#import <Foundation/Foundation.h>
@interface NSThread (RunBlock)
- (void)performBlock:(void(^)())block;
- (void)performBlock:(void (^)())block afterDelay:(NSTimeInterval)delay;
@end
@imoldman
imoldman / make_unique_vs11.h
Last active December 25, 2015 03:59
implementation about std::make_unique in c++14 for vc11(vs2012), require boost-preprocessor library
#include <memory>
#include <type_traits>
#include <boost/preprocessor/repetition.hpp>
#include <boost/preprocessor/arithmetic/add.hpp>
#include <boost/preprocessor/comparison/greater.hpp>
namespace base
{
#define _MAKE_UNIQUE_PARAM_TYPENAME(z, n, data) typename ParamT##n
#define _MAKE_UNIQUE_PARAM_DECLARE(z, n, data) ParamT##n&& param##n
@imoldman
imoldman / gist:6914012
Created October 10, 2013 06:37
implementation for std::make_unique in c++14
// usage:
// auto _ = make_unqiue<string>("foobar");
// auto _ = make_unique<string[]>(2);
#include <memory>
#include <type_traits>
namespace base
{
template<typename T, typename... ParamT>