start new:
tmux
start new with session name:
tmux new -s myname
| sudo chmod 777 / | |
| sudo chmod 777 -R / | |
| Linux下以上命令的危害性,试过的人都会觉得可怕,有些人遇到这种情况,第一反应是没救了,其实,你要愿意花功夫去折腾,还是有办法滴! | |
| 下面理了下怎么折腾: | |
| 道具: | |
| A、B两台电脑,假设都装着Ubuntu 12.04版本的系统,都能ssh、root(平时装Linux的时候这两个最好都弄好了,以备不时之需)。 | |
| 情景: | |
| 现假设「A」是那台悲剧的执行过「sudo chmod 777 /」的电脑,什么效果,就不说了,反正不是什么好事,如果好奇,一试便知! |
| (use '[clojure.core.match :only [match]]) | |
| (defn evaluate [env [sym x y]] | |
| (match [sym] | |
| ['Number] x | |
| ['Add] (+ (evaluate env x) (evaluate env y)) | |
| ['Multiply] (* (evaluate env x) (evaluate env y)) | |
| ['Variable] (env x))) | |
| (def environment {"a" 3, "b" 4, "c" 5}) |
| git config --global alias.lg "log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --" |
| # | |
| # A virtual host using mix of IP-, name-, and port-based configuration. | |
| # This is based on using Homebrew for OS X. You can use this in other | |
| # cases though, but you'll likely need to adjust some of the paths below. | |
| # | |
| server { | |
| # Replace this port with the right one for your requirements | |
| # listen 80 [default|default_server]; #could also be 1.2.3.4:80 |
| #define ApplicationDelegate ((AppDelegate *)[[UIApplication sharedApplication] delegate]) | |
| #define UserDefaults [NSUserDefaults standardUserDefaults] | |
| #define NotificationCenter [NSNotificationCenter defaultCenter] | |
| #define SharedApplication [UIApplication sharedApplication] | |
| #define Bundle [NSBundle mainBundle] | |
| #define MainScreen [UIScreen mainScreen] | |
| #define ShowNetworkActivityIndicator() [UIApplication sharedApplication].networkActivityIndicatorVisible = YES | |
| #define HideNetworkActivityIndicator() [UIApplication sharedApplication].networkActivityIndicatorVisible = NO | |
| #define NetworkActivityIndicatorVisible(x) [UIApplication sharedApplication].networkActivityIndicatorVisible = x | |
| #define NavBar self.navigationController.navigationBar |
| #import <UIKit/UIKit.h> | |
| @interface UIView (SMFrameAdditions) | |
| @property (nonatomic, assign) CGPoint $origin; | |
| @property (nonatomic, assign) CGSize $size; | |
| @property (nonatomic, assign) CGFloat $x, $y, $width, $height; // normal rect properties | |
| @property (nonatomic, assign) CGFloat $left, $top, $right, $bottom; // these will stretch the rect | |
| @end |
| - (UIViewController *)topViewController{ | |
| return [self topViewController:[UIApplication sharedApplication].keyWindow.rootViewController]; | |
| } | |
| - (UIViewController *)topViewController:(UIViewController *)rootViewController | |
| { | |
| if (rootViewController.presentedViewController == nil) { | |
| return rootViewController; | |
| } | |
| # luna_pinyin.custom.yaml | |
| # | |
| # 在【朙月拼音】裏使用Emoji表情(這份配置已過時,新的emoji實現代碼在 https://github.com/rime/rime-emoji ) | |
| # | |
| # 保存到Rime用戶文件夾後,重新部署生效 | |
| # ~/.config/ibus/rime (linux) | |
| # ~/Library/Rime (macos) | |
| # %APPDATA%\Rime (windows) | |
| # | |
| # 如果目標文件已經包含其他修改內容,只需按照縮進合併 patch: 以下的部分 |
In writing my first iOS app, I found myself reaching out in a few areas of self-discovery regarding the Cocoa Touch framework and what it's capable of, especially in how it compares to Ruby and it's standard library (which is what I've been used to for the past few years of my life). I've grown to love Ruby mixins and monkey-patching, and was delighted to learn that Objective-C has something quite similar: categories. ClassName+CategoryName.{h,m} is all you need, and you can define new class/static and instance methods on an Objective-C class.
One of my other strong preferences is for the Markdown format, and thus I snagged one of the more popular C-based implementations of Markdown (named [Sundown][sun]) and wrote a category around UIWebView for effortlessly displaying a parsed file. This was all made possible in the first place by [an awesome post on Stack Overflow][sta] on using Sundown with Objective-C.
//
// UIWebView+Markdown.h
//
#import <UIKit/UIKit.h>