Skip to content

Instantly share code, notes, and snippets.

@phnessu4
phnessu4 / demon.php
Created September 13, 2013 03:40
php守护进程
<?php
define("THREADS",1);
define("DAEMON","/usr/local/bin/daemon");
define("SCRIPT","/****/worker.php");
define("CHDIR","/****/");
define("NAME_PREFIX","worker");
define("PHP_CLI","/usr/local/php/bin/php");
//尚译bookmarklet 压缩
javascript:void((function(){if(window.Como&&window.Como.someyi){Como.someyi.open()}else{var%20a=document.createElement('script');a.setAttribute('type','text/javascript');var%20b=document.charset?document.charset:document.characterSet;var%20c=b.toLowerCase()=='gb2312'?'pack-gb2312.js':'pack-utf8.js';a.setAttribute('src','http://bcs.duapp.com/shangyi12345/'+c);document.getElementsByTagName('head').item(0).appendChild(a);Text.prototype.tagName='#text'}})())
//尚译bookmarklet 未压缩
javascript: void((function () {
if (window.Como && window.Como.someyi) {
Como.someyi.open()
} else {
var a = document.createElement('script');
a.setAttribute('type', 'text/javascript');
#pragma mark - NSURLConnection methods
/*
- (BOOL)connectionShouldUseCredentialStorage:(NSURLConnection *)connection {
return NO;
}
*/
- (BOOL)connection:(NSURLConnection *)connection canAuthenticateAgainstProtectionSpace:(NSURLProtectionSpace *)protectionSpace {
//NSLog(@"can auth");
@phnessu4
phnessu4 / gist:8998813
Created February 14, 2014 10:18
字节序转换
#include <CFByteOrder.h>
// Bytes to uint32_t
NSData *data = <THE_DATA>;
void *bytes = [data bytes];
uint32_t *intBytes = (NSInteger*)bytes;
uint32_t swapped = CFSwapInt32BigToHost(*intBytes); ///< If the data in `data' is big endian
// uint32_t to bytes
uint32_t someInt = 1234;
#import <Foundation/Foundation.h>
@interface MD5 : NSObject
/**
* @brief calculate a message-digest fingerprint for a input string.
*
* @return return a message-digest fingerprint
*/
+ (NSString *)MD5String:(NSString *)string;
@phnessu4
phnessu4 / DeviceIdentifier.h
Created February 18, 2014 04:29
获取mac地址, 系统唯一标示
#import <Foundation/Foundation.h>
@interface DeviceIdentifier : NSObject
/**
* @brief use this method when you need a unique identifier in one app.
* It generates a hash from the MAC-address in combination with the bundle identifier of your app.
*
@phnessu4
phnessu4 / GTMBase64.h
Last active August 29, 2015 13:56
Base64
//
// GTMBase64.h
//
// Copyright 2006-2008 Google Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License"); you may not
// use this file except in compliance with the License. You may obtain a copy
// of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
#########################
# .gitignore file for Xcode5
#
# NB: if you are storing "built" products, this WILL NOT WORK,
# and you should use a different .gitignore (or none at all)
# This file is for SOURCE projects, where there are many extra
# files that we want to exclude
#
# For updates, see: http://stackoverflow.com/questions/49478/git-ignore-file-for-xcode-projects
# and https://gist.github.com/adamgit/3786883
多线程下载请安装axel (brew install axel)
PDFs:
curl https://developer.apple.com/videos/wwdc/2014/ | grep -ioI 'http.*pdf?dl=1' | sed 's/\?dl=1//g' | xargs -n1 axel -a -n 4
Videos:
curl https://developer.apple.com/videos/wwdc/2014/ | grep -ioI 'http.*._hd_.*dl=1">HD' | sed -e 's/\?dl=1">HD//g'| xargs -n1 axel -a -n 8
@phnessu4
phnessu4 / wwdc2014
Last active July 20, 2021 02:25
wwdc 2014 sessions and pdf
pdf
http://devstreaming.apple.com/videos/wwdc/2014/102xxw2o82y78a4/102/102_platforms_state_of_the_union.pdf?dl=1
http://devstreaming.apple.com/videos/wwdc/2014/201xx2xfazhzce8/201/201_advanced_topics_in_internationalization.pdf?dl=1
http://devstreaming.apple.com/videos/wwdc/2014/202xx3ane09vxdz/202/202_whats_new_in_cocoa_touch.pdf?dl=1
http://devstreaming.apple.com/videos/wwdc/2014/203xxh9oqtm0piw/203/203_introducing_healthkit.pdf?dl=1
http://devstreaming.apple.com/videos/wwdc/2014/204xxhe1lli87dm/204/204_whats_new_in_cocoa.pdf?dl=1
http://devstreaming.apple.com/videos/wwdc/2014/205xxqzduadzo14/205/205_creating_extensions_for_ios_and_os_x,_part_1.pdf?dl=1
http://devstreaming.apple.com/videos/wwdc/2014/206xxdiurnffagr/206/206_introducing_the_modern_webkit_api.pdf?dl=1
http://devstreaming.apple.com/videos/wwdc/2014/207xx270npvffao/207/207_accessibility_on_os_x.pdf?dl=1