This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| on cuckoo() | |
| set dateStr to time string of (current date) | |
| set meow to POSIX path of (path to resource "meow.mp3") | |
| display notification dateStr with title "Meow" | |
| do shell script ("afplay " & meow) | |
| end cuckoo | |
| script main | |
| cuckoo() | |
| end script |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /var/log/mongodb/mongod.log { | |
| hourly | |
| missingok | |
| rotate 5 | |
| compress | |
| delaycompress | |
| notifempty | |
| create 0640 mongodb mongodb | |
| sharedscripts | |
| postrotate |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # http://blog.hakril.net/articles/0-understanding-python-by-breaking-it.html | |
| def get_ref(obj): | |
| """ returns a c_size_t, which is the refcount of obj """ | |
| return ctypes.c_size_t.from_address(id(obj)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import socket | |
| from pyos import Scheduler | |
| from pyos import NewTask | |
| from pyos import Accept, Send, Receive | |
| def handle_client(client, addr): | |
| print "Connection from", addr | |
| while True: | |
| data = yield Receive(client, 65536) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import random | |
| q = [] | |
| def producer(): | |
| while True: | |
| item = random.randrange(100) | |
| print 'produce', item | |
| yield item |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # coding: utf-8 | |
| import requests | |
| MAX_COUNT = 10 | |
| DOWNLOAD_DIR = "/Users/kaiix/Music/Songs/" | |
| common_headers = { | |
| "User-Agent": "网易云音乐 1.7.1 (iPhone; iPhone OS 7.1; en_US)", | |
| "Cookie": "os=iPhone OS; osver=7.1; appver=1.7.1;", | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [UIView animateWithDuration:0.0f animations:^{ | |
| [textView_ becomeFirstResponder]; | |
| }]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| + (void)dismissKeyboard { | |
| [[UIApplication sharedApplication] sendAction:@selector(resignFirstResponder) | |
| to:nil | |
| from:nil | |
| forEvent:nil]; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| - (void)shake { | |
| CAKeyframeAnimation * anim = [ CAKeyframeAnimation animationWithKeyPath:@"transform" ] ; | |
| anim.values = @[ | |
| [NSValue valueWithCATransform3D:CATransform3DMakeTranslation(-5.0f, 0.0f, 0.0f) ], | |
| [NSValue valueWithCATransform3D:CATransform3DMakeTranslation(5.0f, 0.0f, 0.0f)]]; | |
| anim.autoreverses = YES ; | |
| anim.repeatCount = 2.0f ; | |
| anim.duration = 0.07f ; | |
| [self.layer addAnimation:anim forKey:nil ] ; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @interface UIImageView (Touch) | |
| @property(nonatomic, assign) id delegate; | |
| @end | |
| @protocol UIImageViewTouchDelegate <NSObject> | |
| @optional | |
| - (void)imageViewDidTouch:(UIImageView *)imageView withPoint:(CGPoint)point; | |
| @end | |
| @implementation UIImageView (Touch) |