Skip to content

Instantly share code, notes, and snippets.

while (YES)
{
[[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate distantFuture]];
}
@czwen
czwen / gist:562325eeb8f376f9ba50be0ed1116993
Created April 25, 2017 02:29
iOS app icon content.json
{
"images" : [
{
"size" : "20x20",
"idiom" : "iphone",
"filename" : "Icon-Spotlight-40.png",
"scale" : "2x"
},
{
"size" : "20x20",
@czwen
czwen / gist:76a26fd9513d8d74be3723c64e17ae55
Last active August 16, 2017 10:21
check wifi toggle status
#import <ifaddrs.h>
#import <net/if.h>
- (BOOL) isWiFiEnabled {
NSCountedSet * cset = [NSCountedSet new];
struct ifaddrs *interfaces;
if( ! getifaddrs(&interfaces) ) {
- (SCNNode*)nodeFromDaeAtPath:(NSString*)path withIdentifier:(NSString*)identifier {
NSURL *urlToColladaFile = [[NSBundle mainBundle] URLForResource:path withExtension:@"dae"]; // Create NSURL from input path
SCNSceneSource *sceneSource = [[SCNSceneSource alloc] initWithURL:urlToColladaFile options:nil]; // Create a temporary SCNScene
SCNNode *node = [sceneSource entryWithIdentifier:identifier withClass:[SCNNode class]]; // Create a node from the model represented by the identifier
return node;
}
@czwen
czwen / gist:84d1f019552c7d6c1ef168823dbc198f
Created November 28, 2018 11:21 — forked from godtao/gist:4138058
网站压力测试工具webbench

Install

wget http://blog.s135.com/soft/linux/webbench/webbench-1.5.tar.gz
tar zxvf webbench-1.5.tar.gz
cd webbench-1.5
make && make install

Usage

webbench --help

@czwen
czwen / gist:fd60d6e131a41760bb8ae3f074268c9b
Created January 16, 2019 09:32
mysql 版本字符串比较
-- 获取小于等于12.0.2版本的最新数据
SELECT *, CONCAT(
LPAD(SUBSTRING_INDEX(SUBSTRING_INDEX(version, '.', 1), '.', -1), 5, '0'),
LPAD(SUBSTRING_INDEX(SUBSTRING_INDEX(version, '.', 2), '.', -1), 5, '0'),
LPAD(SUBSTRING_INDEX(SUBSTRING_INDEX(version, '.', 3), '.', -1), 5, '0')) vcode
FROM foo
having vcode <= CONCAT(LPAD(12,5,'0'), LPAD(0,5,'0'), LPAD(2,5,'0'))
order by vcode desc;
String regex = "^(\\d+\\.)?(\\d+\\.)?(\\d+\\.)?(\\*|\\d+)$";
https://stackoverflow.com/questions/82064/a-regex-for-version-number-parsing
show processlist;
show variables like "%tmp%";
@czwen
czwen / my.cnf
Created November 20, 2019 07:01 — forked from fevangelou/my.cnf
Optimized my.cnf configuration for MySQL/MariaSQL (on Ubuntu, CentOS etc. servers)
# Optimized my.cnf configuration for MySQL/MariaSQL
#
# by Fotis Evangelou, developer of Engintron (engintron.com)
#
# === Updated December 2018 ===
#
# The settings provided below are a starting point for a 2GB - 4GB RAM server with 2-4 CPU cores.
# If you have less or more resources available you should adjust accordingly to save CPU,
# RAM and disk I/O usage.
# The settings marked with a specific comment or the word "UPD" after the value
type 含义
feat 增加新功能
fix 修复bug
docs 文档改动
style 代码风格改动
refactor 重构