Nơi niềm đam mê bắt đầu=> Swift ...

https://mega.co.nz/#F!cQYGQaRD!wQ0KjQSxFgxIWunILGe1bw

How do I hide the status bar in a Swift iOS app?
Code:
override func prefersStatusBarHidden() -> Bool {
return true
}
hoặc:Trong Info.plist thiết lập View controller-based status bar appearance là NO
thêm:
Code:
UIApplication.sharedApplication().statusBarHidden = true
objectiveC:
Code:
- (BOOL)prefersStatusBarHidden
{
return YES;
}

Share Facebook....
Code:
func showFaceBook() {
let facebook = SLComposeViewController(forServiceType: SLServiceTypeFacebook)
facebook.completionHandler = {
result in
switch result {
case SLComposeViewControllerResult.Cancelled:
//Add code to deal with it being cancelled
break

case SLComposeViewControllerResult.Done:
//Add code here to deal with it being completed
//Remember that dimissing the view is done for you, and sending the tweet to social media is automatic too. You could use this to give in game rewards?
break
}
}

high score:

Code:
var highScoretg : NSNumber? = NSUserDefaults.standardUserDefaults().integerForKey("highscore")
heightScoreLable = UILabel(frame: CGRect(x:0, y:0, width:200, height:50))
// NSLog("\(hightScore!)")
heightScoreLable?.text = "HIGH SCORE:" + highScoretg!.stringValue
heightScoreLable?.textAlignment = NSTextAlignment.Center
heightScoreLable?.textColor = UIColor(red: 1, green: 0, blue: 0, alpha: 1)
self.view.addSubview(heightScoreLable!)
heightScoreLable?.center.x = self.view.bounds.size.width/2
heightScoreLable?.center.y = 50
======> scoreLabel!.text = "SCORE:" + score!.stringValue

Rung Rung Rung!
Code:
import UIKit
import AudioToolbox

class ViewController: UIViewController {

override func viewDidLoad() {
super.viewDidLoad()

AudioServicesPlayAlertSound(SystemSoundID(kSystemSoundID_Vibrate))

}
}
http://stackoverflow.com/questions/26455880/how-to-make-iphone-vibrate-u...

admob
- https://developers.google.com/mobile-ads-sdk/docs/admob/ios/quick-start
- https://github.com/ladland/AdMob-Swift
ladland/AdMob-Swift
AdMob-Swift - AdMob Swift Example
GITHUB.COM

- https://github.com/goldenfiredo/Swift_GoogleAd
goldenfiredo/Swift_GoogleAd
Swift_GoogleAd - A demo for display Google Ad banner/Interstitial using Swift. A demo for wrapping FMDB using Swift.A demo for wrapping CoreData using Swift. UI Component Toast/Marquee.Demo for Apple Watch data sharing and...
GITHUB.COM

- http://stackoverflow.com/questions/24760156/xcode-6-swift-ads-googlemobi...

Background Music vs System Music.
http://www.raywenderlich.com/78264/learn-to-code-ios-apps-with-swift-tut...

lỗi biên dịch chậm ở BootLogic.swift, cần khai báo tường minh NSDictionary
Code:
class func boot(window:UIWindow){
let mainScreen = MainScreen(style: UITableViewStyle.Grouped)
var simpleIO = [SECTION: "Simple IO",MENU:[
[TITLE: "Read from plist",CLASS: "ReadPlist"],
[TITLE: "Write to plist",CLASS: "WritePlist"],
[TITLE: "Read/Write NSUserDefaults",CLASS: "ReadWriteNSUserDefaults#Storyboard"],
[TITLE: "NSCoding",CLASS: "NSCodingDemo"],
[TITLE: "Key Value Observer (KVO)",CLASS: "KVODemo"],
[TITLE: "Notification Center",CLASS: "NotificationDemo"]
]
] as NSDictionary //Cuong: must explicitly declare as NSDictionary to speed up compiling

UITableViewCell Selected Background Color on Multiple Selection:
Code:
override func viewDidLoad() {

super.viewDidLoad()

tableView.backgroundColor = UIColor(red: 50, green: 10, blue: 100, alpha: 0.4)
}

Game Snake 2025 credit by abtranbn:
https://itunes.apple.com/vn/app/snake-2025/id964749497?mt=8

Login facebook (using sdk facebook - swift) :
Code:
-#import to file brigh.h
-thêm vô appledelegate.swift: (trong didFinishLaunchingWithOptions)

Code:
FBLoginView.self
FBProfilePictureView.self
-thêm vô func:

Code:
func application(application: UIApplication, openURL url: NSURL, sourceApplication: NSString?, annotation: AnyObject) -> Bool {

var wasHandled:Bool = FBAppCall.handleOpenURL(url, sourceApplication: sourceApplication)
return wasHandled

}
- Them vô file .plist của project:

Code:
FacebookDisplayName
Snake 2025
FacebookAppID
1553157654954418
CFBundleURLTypes

CFBundleURLSchemes

fb1553157654954418

- thêm vô file swift chính delegate của facebook:
Code:
class LogicalView: UIViewController, STADelegateProtocol,FBLoginViewDelegate {
...
-thêm vô: button (cả mainstoryboard)
Code:
@IBOutlet var fbLoginView: FBLoginView!
- tiếp tục trong viewdidload thêm 2 dòng sau:

Code:
self.fbLoginView?.delegate = self
self.fbLoginView?.readPermissions = ["public_profile", "email", "user_friends"]
- thêm các func này là xong:

Code:
func loginViewShowingLoggedInUser(loginView : FBLoginView!) {
println("User Logged In")
println("This is where you perform a segue.")
}

func loginViewFetchedUserInfo(loginView : FBLoginView!, user: FBGraphUser){
println("User Name: \(user.name)")
}

func loginViewShowingLoggedOutUser(loginView : FBLoginView!) {
println("User Logged Out")
}

func loginView(loginView : FBLoginView!, handleError:NSError) {
println("Error: \(handleError.localizedDescription)")
}

Imposible Harry credit by abtranbn.
https://itunes.apple.com/WebObjects/MZStore.woa/wa/viewSoftware?id=96643...

Share Tweeter:
Code:
func showTweetSheet() {

let tweetSheet = SLComposeViewController(forServiceType: SLServiceTypeTwitter)

tweetSheet.completionHandler = {

result in

switch result {

case SLComposeViewControllerResult.Cancelled:

//Add code to deal with it being cancelled

self.showResult()

case SLComposeViewControllerResult.Done:

//Add code here to deal with it being completed

//Remember that dimissing the view is done for you, and sending the tweet to social media is automatic too. You could use this to give in game rewards?

self.showResult()

}

}

tweetSheet.setInitialText("Oh my god! Score in game \"Snake 2025\" is \(score!.stringValue).") //The default text in the tweet

tweetSheet.addImage(self.screenShotMethod()) //Add an image if you like?

tweetSheet.addURL(NSURL(string: "https://twitter.com/mhtranbn")) //A url which takes you into safari if tapped on

self.presentViewController(tweetSheet, animated: false, completion: {

//Optional completion statement

})

}

Add quảng cáo startapp. objectiveC

https://github.com/StartApp-SDK/Documentation/wiki/iOS-InApp-Documentation

ads by Apple (ObjtiveC):
add : to
Code:
#import
add them vo
Code:
<..., ADBannerViewDelegate>
vo View

add vo ViewColtroler
Code:
#pragma mark iAD

Code:
- (void)bannerViewDidLoadAd:(ADBannerView *)banner {

[UIViewbeginAnimations:nilcontext:nil];

[UIViewsetAnimationDuration:1];

[banner setAlpha:1];

[UIViewcommitAnimations];

}

-(void)bannerView:(ADBannerView *)banner didFailToReceiveAdWithError:(NSError *)error {

[UIViewbeginAnimations:nilcontext:nil];

[UIViewsetAnimationDuration:1];

[banner setAlpha:0];

[UIViewcommitAnimations];

}

Rates your app when it not in appstore:

Code:
func touchMyApp(){
var url:NSURL? = NSURL(string: "itms-apps://itunes.apple.com/app/id966430xxx")
UIApplication.sharedApplication().openURL(url!)
}

bo tròn các icon như sau:
Code:
image.layer.borderWidth=1.0
image.layer.masksToBounds =false
image.layer.borderColor =UIColor.whiteColor().CGColor
image.layer.cornerRadius =13
image.layer.cornerRadius = image.frame.size.height/2
image.clipsToBounds =true

Mail chèn vô: Send and Cancel Alert:
Code:
-(void)emailSendComplete:(MFMailComposeViewController *)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError *)error{

switch (result)

{

caseMFMailComposeResultCancelled:

//NSLog(@"Result: canceled");

break;

caseMFMailComposeResultSaved:

//NSLog(@"Result: saved");

break;

caseMFMailComposeResultSent:

{

UIAlertView *alert = [[UIAlertViewalloc]

initWithTitle: @"Email"

message: @"Thanks for your feeback!"

delegate: self

cancelButtonTitle: @"OK"

otherButtonTitles: nil];

[alert show];

}

break;

caseMFMailComposeResultFailed:

//NSLog(@"Result: failed");

break;

default:

//NSLog(@"Result: not sent");

break;

}

[selfdismissModalViewControllerAnimated:YES];

}

// Called when an alertview button is clicked

- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex {

switch (alertView.tag) {

switch (buttonIndex) {

case 0: // cancel

{

dispatch_async(dispatch_get_main_queue(), ^{

[selfdismissModalViewControllerAnimated:YES];

});

}

break;

case 1:

{

//[self saveToDirectory];

}

break;

}

}

}

Hidden keyboarch objectiveC:
vô viewdidload thêm:
Code:
//Add tapGesture

self.tapGesture = [[UITapGestureRecognizeralloc] initWithTarget:selfaction:mad:selector(actionHideKeyboard:)];

[self.viewaddGestureRecognizer:self.tapGesture];
thêm func:
Code:
- (void)actionHideKeyboard:(UITapGestureRecognizer *)tapGesture{

[self.txtCommentsresignFirstResponder];

}

Khởi tạo data trong Bundle:
Code:
var data : NSArray?
var dataFile: NSString = NSBundle.mainBundle().pathForResource("data", ofType: "plist", inDirectory: nil)!
data = NSArray(contentsOfFile: dataFile)

khởi tạo cell nib:
Code:
var cellNib: UINib = UINib(nibName: "PhotoCell", bundle: nil)

Restore in app purchase: OBJ
tạo file in app purchase: (Lưu key của ng dùng đã mua vô nsuserdefaults)vd
SLSInAppPurchase.m vs .h:
Code:
#import

@interface SLSInAppPurchase : NSObject
+(void)setInAppPurchase;
+(BOOL)getInAppPurchase;

@end
vs
Code:
#import "SLSInAppPurchase.h"

@implementation SLSInAppPurchase
+(void)setInAppPurchase{
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
[defaults setValue:[NSNumber numberWithBool:YES] forKey:@"key"];
[defaults synchronize];
}

+(BOOL)getInAppPurchase{
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
return [defaults integerForKey:@"key"];
}

@end
Sau đó vô View mà để button Restore:
thêm vô sự kiện bấm:
Code:
- (IBAction)reStoreA:(id)sender {

[[SKPaymentQueue defaultQueue]restoreCompletedTransactions];
}
thêm vô func:
Code:
- (void)paymentQueueRestoreCompletedTransactionsFinished:(SKPaymentQueue *)queue {
NSLog(@"%@",queue );
NSLog(@"Restored Transactions are once again in Queue for purchasing %@",[queue transactions]);

NSMutableArray *purchasedItemIDs = [[NSMutableArray alloc] init];
NSLog(@"received restored transactions: %lu", (unsigned long)queue.transactions.count);

for (SKPaymentTransaction *transaction in queue.transactions) {
NSString *productID = transaction.payment.productIdentifier;
[purchasedItemIDs addObject:productID];
NSLog (@"product id is %@" , productID);

[SLSInAppPurchase setInAppPurchase];

}
}

Đa nhiệm trên IOS - Lập trình multithread.
1, BlockingMainThread vs NonBlockingMainThread:
- BlockingMainThread:
Code:
NSThread.sleepforTimeInterval(3)
. Dùng khi muốn tác vụ nào chạy xong hẳn rồi mới chạy tác vụ khác.(thằng nào được ưu tiên trước.). Trong trường hợp này là sau 3 giây mới thao tác được tiếp.
- NonBlockingMainThread: Ngược lại, Dùng khi chạy các tác vụ cùng lúc thì tác vụ trên mainthread vẫn chạy ngon lành.
- Để dùng NonBlockingMainThread ta dùng dispatch_async.

Code:
dispatch_async(dispatch_get_main_queue()){
self.labelStatus.text = "Done"
}

Grand Central Dispatch: (Dùng làm việc chủ yếu với server.): Là hoạt động trung tâm call center GCD.
Hoặc : NSOperation:
-Threat là gì: Là tiểu trình thực thi ứng dụng.(Xử lý giao diện, đọc, tính toán dữ liệu). Các code viết mặc định được thực thi trong tiểu trình chính- Main Threat(Threat 1.).

- Block: Trong block có tính năng của closures. Trong closures muốn goị hàm thì cần self.tên hàm.
- Main queue: dùng main thread để chạy.
- Serial queue: bắt các lệnh trong hàm này chạy một cách tuần tự.(chạy trên 1 tuyến đường)
- Concerrunt queue: là một biến instance của viewcotroller.
- dùng dispatch_async: Để không blocking cái trong hàm này.
- dùng dispatch_sync: Phải hoàn thành hoàn toàn các lệnh trong scop của nó, các câu lệnh dưới nó phải chờ nó xong.
- queue: hàng đợi có đặc điểm xếp hàng, vào trước xong trước.
- tên của queue:mainqueue, concurrent, serial
- kiểu queue: serial queue vs concurent queue
- lệnh tạo queue: let queue:
Code:
dispatch_queue_t = dispatch_queue_create("tên kiểu",kiểu queue)
2, Sync vs async:
- dùng dispatch_async: Để không blocking cái trong hàm này, hàm sau nó vs trong nó cùng chạy cùng nhau.
- dùng dispatch_sync: Blocking threat trong nó. Phải hoàn thành hoàn toàn các lệnh trong scop của nó, các câu lệnh dưới nó phải chờ nó xong.

3.

=> Mục đích: Điều khiển tác vụ chạy theo ý mình.(thằng này chạy trước xong rồi mới đến thằng khác, hay chạy song song với nhau, ưu tiên thằng nào chạy trước thằng kia chạy sau...):)

Xác định thiết bị (Iphone, Ipad) với Iphone SDK.
Code:
if([UIDevice currentDevice].userInterfaceIdiom==UIUserInterfaceIdiomPad) {
//Device is ipad
}else{
//Device is iphone
}

Feedback on Swift:

add:
Code:
import MessageUI
add to class
Code:
MFMailComposeViewControllerDelegate {
exam:
Code:
var email:UITextField?
var sdt:UITextField?
var chuyenmuc: UITextField?
var body:UITextView?
override func viewDidLoad() {
super.viewDidLoad()

self.view.backgroundColor = UIColor.whiteColor()
var centerPoint = CGPoint(x: self.view.bounds.size.width / 2, y: self.view.bounds.size.height / 2)
self.email?.delegate = self
// add email and sdt chuyen muc may tinh mac os cua tinh te
email = UITextField(frame: CGRect(x: 20, y: 50, width: 300, height: 100))
email?.text = "tranmanhhoang@gmail.com"

email?.textColor = UIColor.blueColor()
email?.font = UIFont(name: "Verdana Bold.ttf", size: 18)
email?.textAlignment = NSTextAlignment.Left
self.view.addSubview(email!)

sdt = UITextField(frame: CGRect(x: 20, y: 70, width: 300, height: 100))
sdt?.text = "0984230489"
sdt?.font = UIFont(name: "Verdana Bold", size: 18)
sdt?.textAlignment = NSTextAlignment.Left
self.sdt?.delegate = self
self.view.addSubview(sdt!)
chuyenmuc = UITextField(frame: CGRect(x: 20, y: 90, width: 400, height: 100))
chuyenmuc?.text = "www.tinhte.vn/forums/mac-hoi-dap-cskn.27/"
chuyenmuc?.textAlignment = NSTextAlignment.Left
self.view.addSubview(chuyenmuc!)
self.chuyenmuc?.delegate = self
email?.userInteractionEnabled = true
var guimail: UITapGestureRecognizer?
guimail = UITapGestureRecognizer(target: self, action: "guiMail:")
self.view.addGestureRecognizer(guimail!)
// Do any additional setup after loading the view.
}

func guiMail(guimail: UITapGestureRecognizer) {
var SubjectText = " Giúp MacOS! "
// SubjectText +=
var mesaageBody = body
var nguoinhan = ["tranmanhhoang@gmail.com"]
var mc : MFMailComposeViewController = MFMailComposeViewController()
mc.mailComposeDelegate = self
mc.setSubject(SubjectText)
mc.setMessageBody(mesaageBody?.text, isHTML: false)
mc.setToRecipients(nguoinhan)
// self.presentedViewController(mc , animated: true , completion: nil)
self.presentViewController(mc, animated: true, completion: nil)
}

func mailComposeController(controller: MFMailComposeViewController!, didFinishWithResult result: MFMailComposeResult, error: NSError!) {
switch result.value{
case MFMailComposeResultCancelled.value:
NSLog("Mail cancel")

case MFMailComposeResultFailed.value:
NSLog("Mail fail : %@",[error.localizedDescription])
case MFMailComposeResultSaved.value:
NSLog("Maiil Save")
case MFMailComposeResultSent.value:
NSLog("Mail sent")
default:
break
}

self.dismissViewControllerAnimated(true, completion: nil)
}

func textFieldShouldBeginEditing(textField: UITextField) -> Bool {
return false
}

thực hiện cuộc gọi khi ta tap vô số điện thoại:
cấu trúc :
tel:1-408-555-5555

Code:
sdt?.userInteractionEnabled = true
let callHoang = UITapGestureRecognizer(target: self, action: "calHoang:")
sdt?.addGestureRecognizer(callHoang)

func calHoang(tap: UITapGestureRecognizer) {
var url = NSURL(string: "tel:0984230489")
UIApplication.sharedApplication().openURL(url!)
}

thực hiện vô trang web khi ta tap vô đường link tương tự trên:
cấu trúc:
http:\\www.tinhte.vn/forums/mac-hoi-dap-cskn.27/

Code:
chuyenmuc?.userInteractionEnabled = true
let voTinhte = UITapGestureRecognizer(target: self, action: "voTinhte:")
chuyenmuc?.addGestureRecognizer(voTinhte)

func voTinhte(votinhte: UITapGestureRecognizer){
var url = NSURL(string: "http://www.tinhte.vn/forums/mac-hoi-dap-cskn.27/")
UIApplication.sharedApplication().openURL(url!)

}

thiết lập font cho uitabbar:
Code:
vc1.tabBarItem = UITabBarItem(title: "Menu", image: imagev1, tag: 1)
if let font = UIFont(name: "Chalkboard", size: 12) {
vc1.tabBarItem.setTitleTextAttributes([NSFontAttributeName: font], forState: UIControlState.Normal)
}

thiết lập font cho navigation bar tilte:
Code:
self.title = "Giúp MacOS"
self.navigationController?.navigationBar.titleTextAttributes = [NSFontAttributeName: UIFont(name: "Chalkboard", size: 22)!, NSForegroundColorAttributeName: UIColor.blackColor()]

tương tự: thiết lập font barbutton: ;)
Code:
var back : UIBarButtonItem = UIBarButtonItem(title: "Quay lại", style: UIBarButtonItemStyle.Plain, target: self, action: "backview")
if let font = UIFont(name: "Chalkboard", size: 16) {
back.setTitleTextAttributes([NSFontAttributeName: font], forState: UIControlState.Normal)
}
self.navigationItem.leftBarButtonItem = back
func backview() {

if let navController = self.navigationController {

navController.popViewControllerAnimated(true)

}

}

ẩn bàn phím khi drag tableview hoặc scrollview:
set the Keyboard field to Dismiss on Drag.

nếu khai báo kiểu này khi search sẽ crash (url sẽ nil) :(:
Code:
url = NSURL(string: "http://mmovie.hdviet.com/tim-kiem-theo-loai.html?key=\(searchBar.text)&&page=\(currentPage)")
tìm kiếm với nsurl là tiếng việt (tổng quát : Non English) cần khai báo và làm như sau;):

Code:
var timkiem = "http://mmovie.hdviet.com/tim-kiem-theo-loai.html?key="

timkiem += searchBar.text
url = NSURL(string: timkiem.stringByAddingPercentEscapesUsingEncoding(NSUTF8StringEncoding)!)

Chú ý: khi ta nhấn longpress công việc trong hàm sẽ được gọi 2 lần (bắt đầu và kết thúc gọi phát) cho nên nếu chỉ muốn gọi 1 phát thì cần bỏ trống 1 chỗ:

Code:
func giam1may(sender: UILongPressGestureRecognizer) {
if (sender.state == UIGestureRecognizerState.Ended){

}
if (sender.state == UIGestureRecognizerState.Began) {
t -= 1
NSUserDefaults.standardUserDefaults().setInteger(t, forKey: "somaymac")
NSUserDefaults.standardUserDefaults().synchronize()
NSLog("giam 1 may")
hienthisomaycon()

}

màu ngẫu nhiên :
Code:
func randomcolor()-> UIColor {
var randomRed:CGFloat = CGFloat(drand48())
var randomGreen:CGFloat = CGFloat(drand48())
var randimBlue:CGFloat = CGFloat(drand48())
return UIColor(red: randomRed, green: randomGreen, blue: randimBlue, alpha: 1.0)
}

bật đèn flash iphone :
Code:
func toggleTorch() {
let avDevice = AVCaptureDevice.defaultDeviceWithMediaType(AVMediaTypeVideo)
// check if the device has torch
if avDevice.hasTorch {
// lock your device for configuration
avDevice.lockForConfiguration(nil)
// check if your torchMode is on or off. If on turns it off otherwise turns it on
avDevice.torchMode = avDevice.torchActive ? AVCaptureTorchMode.Off : AVCaptureTorchMode.On

// sets the torch intensity to 100%
avDevice.setTorchModeOnWithLevel(1.0, error: nil)
// unlock your device
avDevice.unlockForConfiguration()

}
}

có bật rồi phải có tắt flash.
Code:
func toggleTorchOff() {
let device = AVCaptureDevice.defaultDeviceWithMediaType(AVMediaTypeVideo)
if (device.hasTorch) {
device.lockForConfiguration(nil)
let torchOn = !device.torchActive
device.setTorchModeOnWithLevel(1.0, error: nil)
device.torchMode = torchOn ? AVCaptureTorchMode.On : AVCaptureTorchMode.Off
device.unlockForConfiguration()
}
}

kiểm tra kết nối internet vs AFNetworking:
Code:
func checkNet() {
AFNetworkReachabilityManager.sharedManager().startMonitoring()
AFNetworkReachabilityManager.sharedManager().setReachabilityStatusChangeBlock { (status:AFNetworkReachabilityStatus) -> Void in
switch status.hashValue{
case AFNetworkReachabilityStatus.NotReachable.hashValue:
NSLog("Not reachable")
case AFNetworkReachabilityStatus.ReachableViaWiFi.hashValue , AFNetworkReachabilityStatus.ReachableViaWWAN.hashValue :
NSLog("Reachable")
default:
NSLog("Unknown status")
}}
}kiểm tra kết nối internet vs AFNetworking:
Code:
func checkNet() {
AFNetworkReachabilityManager.sharedManager().startMonitoring()
AFNetworkReachabilityManager.sharedManager().setReachabilityStatusChangeBlock { (status:AFNetworkReachabilityStatus) -> Void in
switch status.hashValue{
case AFNetworkReachabilityStatus.NotReachable.hashValue:
NSLog("Not reachable")
case AFNetworkReachabilityStatus.ReachableViaWiFi.hashValue , AFNetworkReachabilityStatus.ReachableViaWWAN.hashValue :
NSLog("Reachable")
default:
NSLog("Unknown status")
}}
}

ẩn bàn phím khi tích vô view chính vs uinavigationBar:
Code:
func setupGestureRecognizer() {
let dismissKeyboardTap = UITapGestureRecognizer(target: self, action: "dismissKeyboard")
dismissKeyboardTap.cancelsTouchesInView = false

self.navigationController?.navigationBar.addGestureRecognizer(dismissKeyboardTap)
}
func setupGestureRecognizer2() {
let dismissKeyboardTap = UITapGestureRecognizer(target: self, action: "dismissKeyboard")
dismissKeyboardTap.cancelsTouchesInView = false
self.view.addGestureRecognizer(dismissKeyboardTap)
}

func dismissKeyboard() {
self.view.endEditing(true)
}

ObjectiveC:
Code:
UITapGestureRecognizer * tapGesture = [[UITapGestureRecognizer alloc]
initWithTarget:self
action:@selector(hideKeyBoard)];

[self.view addGestureRecognizer:tapGesture];

-(void)hideKeyBoard {
[_titleTextField resignFirstResponder];
[_contentTextView resignFirstResponder];
}

Ứng dụng Giúp Mac giúp các bạn đây:
https://itunes.apple.com/vn/app/giup-mac/id985144970?mt=8

thay đổi màu navigationbar, status vs title:
thêm vô appledelegate:
Code:
UIApplication.sharedApplication().statusBarStyle = UIStatusBarStyle.LightContenttìm file info.plist thêm vô view controller-based status bar vs set vs giá trị No.
thêm vô file viewcontroler:
Code:
navigationController!.navigationBar.barTintColor = UIColor(red: 0.3, green:0.8, blue: 1, alpha: 1)

code swift cũ build trên xcode 6.3 sẽ cần fix thêm ! sau khi ép kiểu as. Và nếu sau khi fix hết các lỗi gợi ý rồi mà còn lỗi như trên ảnh sau:
thì ta cần sửa lại hàm :

Code:
func application(application: UIApplication!, didFinishLaunchingWithOptions launchOptions: NSDictionary!) -> Bool {...}
thành
Code:
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool{..}
và build lại.

hàm random các phần tử trong 1 mảng:

Code:
func shuffle(var list: C) -> C {
let counts = count(list)
for i in 0..<(counts - 1) {
let j = Int(arc4random_uniform(UInt32(counts - i))) + i
swap(&list[i], &list[j])
}
return list
}

Có lưu ý khi triển công cụ search trên UIViewController hay UITableViewController là khi dùng searchdisplaycontroller vs UITableViewController thì ta có thể đổ data khi search được bằng cách dùng so sánh cái table nào đang dùng:
Code:
if tableView == self.searchDisplayController!.searchResultsTableView {
return self.filteredCandies.count
} else {
còn khi dùng với UIViewController thì không dùng so sánh trên được vì cái tableview của thằng search nó không được gán vô cái tableview đầu nên ko đổ data vô đc, nên ta xét đk xem cái thằng search active chưa hay rồi, sau đó triển tiếp:
Code:
if self.searchDisplayController!.active {
...
} else {
...

}
ex:
Code:
//
// ViewController.swift
// search test
//
// Created by mhtran on 4/30/15.
// Copyright (c) 2015 mhtran. All rights reserved.
//

import UIKit

class ViewController: UIViewController,UITableViewDelegate, UITableViewDataSource,UISearchBarDelegate,UISearchControllerDelegate,UISearchDisplayDelegate{
@IBOutlet weak var table: UITableView!

var animals:[String] = ["Bear", "Black Swan", "Buffalo", "Camel", "Cockatoo", "Dog", "Donkey", "Emu","Giraffe", "Greater Rhea","Hippopotamus", "Horse","Koala","Lion", "Llama", "Manatus", "Meerkat","Panda", "Peacock", "Pig", "Platypus", "Polar Bear","Rhinoceros", "Seagull", "Tasmania Devil","Whale", "Whale Shark", "Wombat"]

var findAnimals:[String] = []

override func viewDidLoad() {
super.viewDidLoad()
setupGestureRecognizer()
self.table.reloadData()
}

func searchBarTextDidEndEditing(searchBar: UISearchBar) {
setupGestureRecognizer()
}

func setupGestureRecognizer() {
let dismisskayboarch = UITapGestureRecognizer(target: self, action: "dismisskeyboarch:")
dismisskayboarch.cancelsTouchesInView = false
self.navigationController?.navigationBar.addGestureRecognizer(dismisskayboarch)
}
func dismisskeyboarch() {
self.view.endEditing(true)
}

func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int
{
if self.searchDisplayController!.active {
return self.findAnimals.count
} else {
return self.animals.count
}
}

func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {

let cellID = "id"
var cell: UITableViewCell
var animal:String!
if self.searchDisplayController!.active {
animal = self.findAnimals[indexPath.row]
} else {
animal = animals[indexPath.row]
}
if let dequeCell: AnyObject = tableView.dequeueReusableCellWithIdentifier(cellID) {
cell = dequeCell as! UITableViewCell
} else {
cell = UITableViewCell(style: UITableViewCellStyle.Default, reuseIdentifier: cellID)
cell.accessoryType = UITableViewCellAccessoryType.DisclosureIndicator
}
cell.textLabel?.text = animal
return cell
}

func filterContentForSearchText(searchText: String) {
self.findAnimals = self.animals.filter({ (animal: String) -> Bool in
var stringMatch = animal.rangeOfString(searchText)
return stringMatch != nil
})
}

func searchDisplayController(controller: UISearchDisplayController, shouldReloadTableForSearchString searchString: String!) -> Bool {
self.filterContentForSearchText(searchString)
return true
}

func searchDisplayController(controller: UISearchDisplayController, shouldReloadTableForSearchScope searchOption: Int) -> Bool {
self.filterContentForSearchText(self.searchDisplayController!.searchBar.text)
return true
}

}

Thánh Phim HD chuẩn bị phục vụ các bạn tới bến :).
"How old am i" lên kế hoạch.
Trong swift cần chú ý các dấu đặc biệt (như động từ bất quy tắc trong tiếng anh) này khi lập trình :

Code:
\0 (null character)
\\ (backslash)
\t (horizontal tab)
\n (line feed)
\r (carriage return)
\" (double quote)
\' (single quote)

ví dụ:
Code:
text2 = text2.stringByReplacingOccurrencesOfString("\"", withString: "", options: NSStringCompareOptions.LiteralSearch, range: nil)

Plugins hay cho xcode:
http://iosdevtips.co/post/82232620790/best-xcode-plugins

Resize image:
Code:
func RBResizeImage(image: UIImage, targetSize: CGSize) -> UIImage {
let size = image.size

let widthRatio = targetSize.width / image.size.width
let heightRatio = targetSize.height / image.size.height

// Figure out what our orientation is, and use that to form the rectangle
var newSize: CGSize
if(widthRatio > heightRatio) {
newSize = CGSizeMake(size.width * heightRatio, size.height * heightRatio)
} else {
newSize = CGSizeMake(size.width * widthRatio, size.height * widthRatio)
}

// This is the rect that we've calculated out and this is what is actually used below
let rect = CGRectMake(0, 0, newSize.width, newSize.height)

// Actually do the resizing to the rect using the ImageContext stuff
UIGraphicsBeginImageContextWithOptions(newSize, false, 1.0)
image.drawInRect(rect)
let newImage = UIGraphicsGetImageFromCurrentImageContext()
UIGraphicsEndImageContext()

return newImage
}

Đá sang objectiveC chút: Impossibe Harry - ObjectiveC :):
https://github.com/mhtranbn/ImpossibleHurry-ObjectiveC

the difference between all the Selection Segues:

Dưới đây là một bản tóm tắt nhanh chóng của các segues và một ví dụ cho mỗi loại. Bạn sẽ muốn làm nhiều nghiên cứu / thử nghiệm nếu bạn quyết định để thực hiện chúng.

Show - Đẩy bộ điều khiển xem điểm vào hướng ngăn xếp, di chuyển các điều khiển xem nguồn ra khỏi đường (điểm đến trượt vượt qua từ phải sang trái), cung cấp một nút quay lại để điều hướng trở về nguồn - trên tất cả các thiết bị
Ví dụ: Di chuyển hộp thư / thư mục trong Mail

Show Detail -Thay thế các chi tiết / bộ điều khiển xem phụ khi trong một UISplitViewController không có khả năng điều hướng trở lại điều khiển xem trước
Ví dụ: Trong Mail trên iPad trong cảnh quan, khai thác một email trong sidebar thay thế bộ điều khiển xem ở bên phải để hiển thị các email mới

Present Modally - Trình bày một bộ điều khiển xem trong nhiều cách khác nhau như được định nghĩa bởi các tùy chọn trình bày, bao che cho các điều khiển xem trước - thường được sử dụng để trình bày một bộ điều khiển xem đó làm sống động từ dưới lên và bao phủ toàn bộ màn hình trên iPhone, nhưng trên iPad nó phổ biến để trình bày nó như một hộp trung hơn người nào đó làm tối điều khiển xem bên dưới và cũng sinh động từ dưới lên
Ví dụ: Nhấn vào nút + trong lịch trên iPhone

Popover Presentation - Khi chạy trên iPad, đích đến sẽ xuất hiện trong một popover nhỏ, và khai thác bất cứ nơi nào bên ngoài của popover này sẽ bỏ qua nó. Trên iPhone, popovers cũng được hỗ trợ nhưng theo mặc định nếu nó thực hiện một segue Presentation Popover, nó sẽ trình bày các bộ điều khiển xem đích modally trên toàn màn hình.
Ví dụ: Nhấn vào nút + trong Calendar trên iPad (hoặc iPhone, nhận ra nó được chuyển thành một bài thuyết trình toàn màn hình như trái ngược với một popover thực tế)

Custom - Bạn có thể thực hiện segue tùy chỉnh của riêng bạn và kiểm soát hành vi của nó.

Để biết thêm thông tin, bạn có thể đọc qua các tài liệu cũng giải thích các loại segues và làm thế nào để sử dụng chúng trong một Storyboard. Ngoài ra kiểm tra xây dựng thích ứng Apps với UIKit - Session 216, mà Apple giới thiệu tại WWDC năm 2014. Họ đã nói chuyện về làm thế nào bạn có thể xây dựng các ứng dụng thích nghi sử dụng các Segues thích ứng mới, và họ đã xây dựng một dự án trình diễn mà sử dụng những segues.

Guidelines for viewWillAppear, viewDidAppear, viewWillDisappear, viewDidDisappear:

viewWillAppear:

This method is called before the receiver’s view is about to be displayed onscreen and before any animations are configured for showing the view. You can override this method to perform custom tasks associated with presenting the view. For example, you might use this method to change the orientation or style of the status bar to coordinate with the orientation or style of the view being presented. If you override this method, you must call super at some point in your implementation.

viewWillDisappear:

This method is called in response to a view being removed from its window or covered by another view. This method is called before the view is actually removed or covered and before any animations are configured.

Subclasses can override this method and use it to commit editing changes, resign the first responder status of the view, or perform other relevant tasks. For example, you might use this method to revert changes to the orientation or style of the status bar that were made in the viewDidDisappear: method when the view was first presented. If you override this method, you must call super at some point in your implementation.

viewDidAppear:

You can override this method to perform additional tasks associated with presenting the view. If you override this method, you must call super at some point in your implementation.

viewDidDisappear:

You can override this method to perform additional tasks associated with dismissing or hiding the view. If you override this method, you must call super at some point in your implementation.

https://mega.co.nz/#!g45U0TyC!77qpA2hjInlOLClPQzUA_njkVFIL_7erRAF3Mv3zbNI

http://www.iashes.com/2014-11-214.html

thánh phim hd is here: https://itunes.apple.com/vn/app/thanh-phim-hd/id989577397?mt=8

học qua nodejs ==> http://nodeschool.io/vi/

Install owncloud 8 on ubuntu server 14.04 ==>

http://sharadchhetri.com/2015/04/26/install-owncloud-8-on-ubuntu-server-...

defaults write com.apple.finder AppleShowAllFiles YES

https://software.opensuse.org/download/package?project=isv:ownCloud:comm...

wget -nv bit.ly/iojs-dev -O /tmp/iojs-dev.sh; bash /tmp/iojs-dev.sh

https://help.github.com/articles/generating-ssh-keys/

https://www.howtoforge.com/a-beginners-guide-to-btrfs

Here is how to do it
cp -RfXv "[source folder]" [destination directory]/[foldername]/

sudo forever start -c http-server ./ -p 80

git reset --hard

$('#author-submit').on('click', function(ev) {
$.ajax({
url: 'http://hoangmanhtran.com:8080/author',
type: 'post',
data: JSON.stringify({
'author-name': $('#author-name').val(),
'author-email': $('#author-email').val(),
'author-github': $('#author-github').val(),
'author-apps': $('#author-apps').val(),
}),
success: function(result) {
$('#author').html('Thanks')
},
dataType: 'json',
contentType: 'json'
})
})

lsof -i -P | grep -i "listen"

passport.use(new GitHubStrategy(secrets.github, function(req, accessToken, refreshToken, profile, done) {
if (req.user) {
User.findOne({ github: profile.id }, function(err, existingUser) {
if (existingUser) {
req.flash('errors', { msg: 'There is already a GitHub account that belongs to you. Sign in with that account or delete it, then link it with your current account.' });
done(err);
} else {
User.findById(req.user.id, function(err, user) {
user.github = profile.id;
user.tokens.push({ kind: 'github', accessToken: accessToken });
user.profile.name = user.profile.name || profile.displayName;
user.profile.picture = user.profile.picture || profile._json.avatar_url;
user.profile.location = user.profile.location || profile._json.location;
user.profile.website = user.profile.website || profile._json.blog;
user.save(function(err) {
req.flash('info', { msg: 'GitHub account has been linked.' });
done(err, user);
});
});
}
});
} else {
User.findOne({ github: profile.id }, function(err, existingUser) {
if (existingUser) return done(null, existingUser);
User.findOne({ email: profile._json.email }, function(err, existingEmailUser) {
if (existingEmailUser) {
req.flash('errors', { msg: 'There is already an account using this email address. Sign in to that account and link it with GitHub manually from Account Settings.' });
done(err);
} else {
var user = new User();
user.email = profile._json.email;
user.github = profile.id;
user.tokens.push({ kind: 'github', accessToken: accessToken });
user.profile.name = profile.displayName;
user.profile.picture = profile._json.avatar_url;
user.profile.location = profile._json.location;
user.profile.website = profile._json.blog;
user.save(function(err) {
done(err, user);
});
}
});
});
}
}));

http://foffer.dk/optimizing-os-x-terminal-for-10-10-yosemite/

./dev-server.sh
sudo forever stop-all
redis-cli
git pull
forever restartall
sudo forever start -c http-server ./ -p 80
forever list
echo forever start -c babel-node submissions/form.js

ssh-keygen -R "you server hostname or ip"

#### Contents of the preconfiguration file (for jessie)
### Localization
# Preseeding only locale sets language, country and locale.
d-i debian-installer/locale string en_US

# The values can also be preseeded individually for greater flexibility.
#d-i debian-installer/language string en
#d-i debian-installer/country string NL
#d-i debian-installer/locale string en_GB.UTF-8
# Optionally specify additional locales to be generated.
#d-i localechooser/supported-locales multiselect en_US.UTF-8, nl_NL.UTF-8

# Keyboard selection.
d-i keyboard-configuration/xkb-keymap select us
# d-i keyboard-configuration/toggle select No toggling

### Network configuration
# Disable network configuration entirely. This is useful for cdrom
# installations on non-networked devices where the network questions,
# warning and long timeouts are a nuisance.
#d-i netcfg/enable boolean false

# netcfg will choose an interface that has link if possible. This makes it
# skip displaying a list if there is more than one interface.
d-i netcfg/choose_interface select auto

# To pick a particular interface instead:
#d-i netcfg/choose_interface select eth1

# To set a different link detection timeout (default is 3 seconds).
# Values are interpreted as seconds.
#d-i netcfg/link_wait_timeout string 10

# If you have a slow dhcp server and the installer times out waiting for
# it, this might be useful.
#d-i netcfg/dhcp_timeout string 60
#d-i netcfg/dhcpv6_timeout string 60

# If you prefer to configure the network manually, uncomment this line and
# the static network configuration below.
#d-i netcfg/disable_autoconfig boolean true

# If you want the preconfiguration file to work on systems both with and
# without a dhcp server, uncomment these lines and the static network
# configuration below.
#d-i netcfg/dhcp_failed note
#d-i netcfg/dhcp_options select Configure network manually

# Static network configuration.
#
# IPv4 example
#d-i netcfg/get_ipaddress string 192.168.1.42
#d-i netcfg/get_netmask string 255.255.255.0
#d-i netcfg/get_gateway string 192.168.1.1
#d-i netcfg/get_nameservers string 192.168.1.1
#d-i netcfg/confirm_static boolean true
#
# IPv6 example
#d-i netcfg/get_ipaddress string fc00::2
#d-i netcfg/get_netmask string ffff:ffff:ffff:ffff::
#d-i netcfg/get_gateway string fc00::1
#d-i netcfg/get_nameservers string fc00::1
#d-i netcfg/confirm_static boolean true

# Any hostname and domain names assigned from dhcp take precedence over
# values set here. However, setting the values still prevents the questions
# from being shown, even if values come from dhcp.
d-i netcfg/get_hostname string unassigned-hostname
d-i netcfg/get_domain string unassigned-domain

# If you want to force a hostname, regardless of what either the DHCP
# server returns or what the reverse DNS entry for the IP is, uncomment
# and adjust the following line.
#d-i netcfg/hostname string somehost

# Disable that annoying WEP key dialog.
d-i netcfg/wireless_wep string
# The wacky dhcp hostname that some ISPs use as a password of sorts.
#d-i netcfg/dhcp_hostname string radish

# If non-free firmware is needed for the network or other hardware, you can
# configure the installer to always try to load it, without prompting. Or
# change to false to disable asking.
#d-i hw-detect/load_firmware boolean true

### Network console
# Use the following settings if you wish to make use of the network-console
# component for remote installation over SSH. This only makes sense if you
# intend to perform the remainder of the installation manually.
#d-i anna/choose_modules string network-console
#d-i network-console/authorized_keys_url string http://10.0.0.1/openssh-key
#d-i network-console/password password r00tme
#d-i network-console/password-again password r00tme

### Mirror settings
# If you select ftp, the mirror/country string does not need to be set.
#d-i mirror/protocol string ftp
d-i mirror/country string manual
d-i mirror/http/hostname string http.us.debian.org
d-i mirror/http/directory string /debian
d-i mirror/http/proxy string

# Suite to install.
#d-i mirror/suite string testing
# Suite to use for loading installer components (optional).
#d-i mirror/udeb/suite string testing

### Account setup
# Skip creation of a root account (normal user account will be able to
# use sudo).
#d-i passwd/root-login boolean false
# Alternatively, to skip creation of a normal user account.
#d-i passwd/make-user boolean false

# Root password, either in clear text
#d-i passwd/root-password password r00tme
#d-i passwd/root-password-again password r00tme
# or encrypted using an MD5 hash.
#d-i passwd/root-password-crypted password [MD5 hash]

# To create a normal user account.
#d-i passwd/user-fullname string Debian User
#d-i passwd/username string debian
# Normal user's password, either in clear text
#d-i passwd/user-password password insecure
#d-i passwd/user-password-again password insecure
# or encrypted using an MD5 hash.
#d-i passwd/user-password-crypted password [MD5 hash]
# Create the first user with the specified UID instead of the default.
#d-i passwd/user-uid string 1010

# The user account will be added to some standard initial groups. To
# override that, use this.
#d-i passwd/user-default-groups string audio cdrom video

### Clock and time zone setup
# Controls whether or not the hardware clock is set to UTC.
d-i clock-setup/utc boolean true

# You may set this to any valid setting for $TZ; see the contents of
# /usr/share/zoneinfo/ for valid values.
d-i time/zone string US/Eastern

# Controls whether to use NTP to set the clock during the install
d-i clock-setup/ntp boolean true
# NTP server to use. The default is almost always fine here.
#d-i clock-setup/ntp-server string ntp.example.com

### Partitioning
## Partitioning example
# If the system has free space you can choose to only partition that space.
# This is only honoured if partman-auto/method (below) is not set.
#d-i partman-auto/init_automatically_partition select biggest_free

# Alternatively, you may specify a disk to partition. If the system has only
# one disk the installer will default to using that, but otherwise the device
# name must be given in traditional, non-devfs format (so e.g. /dev/sda
# and not e.g. /dev/discs/disc0/disc).
# For example, to use the first SCSI/SATA hard disk:
#d-i partman-auto/disk string /dev/sda
# In addition, you'll need to specify the method to use.
# The presently available methods are:
# - regular: use the usual partition types for your architecture
# - lvm: use LVM to partition the disk
# - crypto: use LVM within an encrypted partition
d-i partman-auto/method string lvm

# If one of the disks that are going to be automatically partitioned
# contains an old LVM configuration, the user will normally receive a
# warning. This can be preseeded away...
d-i partman-lvm/device_remove_lvm boolean true
# The same applies to pre-existing software RAID array:
d-i partman-md/device_remove_md boolean true
# And the same goes for the confirmation to write the lvm partitions.
d-i partman-lvm/confirm boolean true
d-i partman-lvm/confirm_nooverwrite boolean true

# You can choose one of the three predefined partitioning recipes:
# - atomic: all files in one partition
# - home: separate /home partition
# - multi: separate /home, /var, and /tmp partitions
d-i partman-auto/choose_recipe select atomic

# Or provide a recipe of your own...
# If you have a way to get a recipe file into the d-i environment, you can
# just point at it.
#d-i partman-auto/expert_recipe_file string /hd-media/recipe

# If not, you can put an entire recipe into the preconfiguration file in one
# (logical) line. This example creates a small /boot partition, suitable
# swap, and uses the rest of the space for the root partition:
#d-i partman-auto/expert_recipe string \
# boot-root :: \
# 40 50 100 ext3 \
# $primary{ } $bootable{ } \
# method{ format } format{ } \
# use_filesystem{ } filesystem{ ext3 } \
# mountpoint{ /boot } \
# . \
# 500 10000 1000000000 ext3 \
# method{ format } format{ } \
# use_filesystem{ } filesystem{ ext3 } \
# mountpoint{ / } \
# . \
# 64 512 300% linux-swap \
# method{ swap } format{ } \
# .

# The full recipe format is documented in the file partman-auto-recipe.txt
# included in the 'debian-installer' package or available from D-I source
# repository. This also documents how to specify settings such as file
# system labels, volume group names and which physical devices to include
# in a volume group.

# This makes partman automatically partition without confirmation, provided
# that you told it what to do using one of the methods above.
d-i partman-partitioning/confirm_write_new_label boolean true
d-i partman/choose_partition select finish
d-i partman/confirm boolean true
d-i partman/confirm_nooverwrite boolean true

## Partitioning using RAID
# The method should be set to "raid".
#d-i partman-auto/method string raid
# Specify the disks to be partitioned. They will all get the same layout,
# so this will only work if the disks are the same size.
#d-i partman-auto/disk string /dev/sda /dev/sdb

# Next you need to specify the physical partitions that will be used.
#d-i partman-auto/expert_recipe string \
# multiraid :: \
# 1000 5000 4000 raid \
# $primary{ } method{ raid } \
# . \
# 64 512 300% raid \
# method{ raid } \
# . \
# 500 10000 1000000000 raid \
# method{ raid } \
# .

# Last you need to specify how the previously defined partitions will be
# used in the RAID setup. Remember to use the correct partition numbers
# for logical partitions. RAID levels 0, 1, 5, 6 and 10 are supported;
# devices are separated using "#".
# Parameters are:
# \
#

#d-i partman-auto-raid/recipe string \
# 1 2 0 ext3 / \
# /dev/sda1#/dev/sdb1 \
# . \
# 1 2 0 swap - \
# /dev/sda5#/dev/sdb5 \
# . \
# 0 2 0 ext3 /home \
# /dev/sda6#/dev/sdb6 \
# .

# For additional information see the file partman-auto-raid-recipe.txt
# included in the 'debian-installer' package or available from D-I source
# repository.

# This makes partman automatically partition without confirmation.
d-i partman-md/confirm boolean true
d-i partman-partitioning/confirm_write_new_label boolean true
d-i partman/choose_partition select finish
d-i partman/confirm boolean true
d-i partman/confirm_nooverwrite boolean true

## Controlling how partitions are mounted
# The default is to mount by UUID, but you can also choose "traditional" to
# use traditional device names, or "label" to try filesystem labels before
# falling back to UUIDs.
#d-i partman/mount_style select uuid

### Base system installation
# Configure APT to not install recommended packages by default. Use of this
# option can result in an incomplete system and should only be used by very
# experienced users.
#d-i base-installer/install-recommends boolean false

# The kernel image (meta) package to be installed; "none" can be used if no
# kernel is to be installed.
#d-i base-installer/kernel/image string linux-image-586

### Apt setup
# You can choose to install non-free and contrib software.
#d-i apt-setup/non-free boolean true
#d-i apt-setup/contrib boolean true
# Uncomment this if you don't want to use a network mirror.
#d-i apt-setup/use_mirror boolean false
# Select which update services to use; define the mirrors to be used.
# Values shown below are the normal defaults.
#d-i apt-setup/services-select multiselect security, updates
#d-i apt-setup/security_host string security.debian.org

# Additional repositories, local[0-9] available
#d-i apt-setup/local0/repository string \
# http://local.server/debian stable main
#d-i apt-setup/local0/comment string local server
# Enable deb-src lines
#d-i apt-setup/local0/source boolean true
# URL to the public key of the local repository; you must provide a key or
# apt will complain about the unauthenticated repository and so the
# sources.list line will be left commented out
#d-i apt-setup/local0/key string http://local.server/key

# By default the installer requires that repositories be authenticated
# using a known gpg key. This setting can be used to disable that
# authentication. Warning: Insecure, not recommended.
#d-i debian-installer/allow_unauthenticated boolean true

# Uncomment this to add multiarch configuration for i386
#d-i apt-setup/multiarch string i386

### Package selection
#tasksel tasksel/first multiselect standard, web-server, kde-desktop

# Individual additional packages to install
#d-i pkgsel/include string openssh-server build-essential
# Whether to upgrade packages after debootstrap.
# Allowed values: none, safe-upgrade, full-upgrade
#d-i pkgsel/upgrade select none

# Some versions of the installer can report back on what software you have
# installed, and what software you use. The default is not to report back,
# but sending reports helps the project determine what software is most
# popular and include it on CDs.
#popularity-contest popularity-contest/participate boolean false

### Boot loader installation
# Grub is the default boot loader (for x86). If you want lilo installed
# instead, uncomment this:
#d-i grub-installer/skip boolean true
# To also skip installing lilo, and install no bootloader, uncomment this
# too:
#d-i lilo-installer/skip boolean true

# This is fairly safe to set, it makes grub install automatically to the MBR
# if no other operating system is detected on the machine.
d-i grub-installer/only_debian boolean true

# This one makes grub-installer install to the MBR if it also finds some other
# OS, which is less safe as it might not be able to boot that other OS.
d-i grub-installer/with_other_os boolean true

# Due notably to potential USB sticks, the location of the MBR can not be
# determined safely in general, so this needs to be specified:
#d-i grub-installer/bootdev string /dev/sda
# To install to the first device (assuming it is not a USB stick):
#d-i grub-installer/bootdev string default

# Alternatively, if you want to install to a location other than the mbr,
# uncomment and edit these lines:
#d-i grub-installer/only_debian boolean false
#d-i grub-installer/with_other_os boolean false
#d-i grub-installer/bootdev string (hd0,1)
# To install grub to multiple disks:
#d-i grub-installer/bootdev string (hd0,1) (hd1,1) (hd2,1)

# Optional password for grub, either in clear text
#d-i grub-installer/password password r00tme
#d-i grub-installer/password-again password r00tme
# or encrypted using an MD5 hash, see grub-md5-crypt(8).
#d-i grub-installer/password-crypted password [MD5 hash]

# Use the following option to add additional boot parameters for the
# installed system (if supported by the bootloader installer).
# Note: options passed to the installer will be added automatically.
#d-i debian-installer/add-kernel-opts string nousb

### Finishing up the installation
# During installations from serial console, the regular virtual consoles
# (VT1-VT6) are normally disabled in /etc/inittab. Uncomment the next
# line to prevent this.
#d-i finish-install/keep-consoles boolean true

# Avoid that last message about the install being complete.
d-i finish-install/reboot_in_progress note

# This will prevent the installer from ejecting the CD during the reboot,
# which is useful in some situations.
#d-i cdrom-detect/eject boolean false

# This is how to make the installer shutdown when finished, but not
# reboot into the installed system.
#d-i debian-installer/exit/halt boolean true
# This will power off the machine instead of just halting it.
#d-i debian-installer/exit/poweroff boolean true

### Preseeding other packages
# Depending on what software you choose to install, or if things go wrong
# during the installation process, it's possible that other questions may
# be asked. You can preseed those too, of course. To get a list of every
# possible question that could be asked during an install, do an
# installation, and then run these commands:
# debconf-get-selections --installer > file
# debconf-get-selections >> file

#### Advanced options
### Running custom commands during the installation
# d-i preseeding is inherently not secure. Nothing in the installer checks
# for attempts at buffer overflows or other exploits of the values of a
# preconfiguration file like this one. Only use preconfiguration files from
# trusted locations! To drive that home, and because it's generally useful,
# here's a way to run any shell command you'd like inside the installer,
# automatically.

# This first command is run as early as possible, just after
# preseeding is read.
#d-i preseed/early_command string anna-install some-udeb
# This command is run immediately before the partitioner starts. It may be
# useful to apply dynamic partitioner preseeding that depends on the state
# of the disks (which may not be visible when preseed/early_command runs).
#d-i partman/early_command \
# string debconf-set partman-auto/disk "$(list-devices disk | head -n1)"
# This command is run just before the install finishes, but when there is
# still a usable /target directory. You can chroot to /target and use it
# directly, or use the apt-install and in-target commands to easily install
# packages and run commands in the target system.
#d-i preseed/late_command string apt-install zsh; in-target chsh -s /bin/zsh

https://wiki.debian.org/DebianInstaller/Preseed

http://www.thegeekstuff.com/2009/07/how-to-view-modify-and-recreate-init...

pull/push from multiple remote locations
git remote set-url origin --push --add
git remote update
git pull alt master

https://fak3r.com/2011/08/18/howto-automate-debian-installs-with-preseed/

preseed_ubuntu.cfg
# Language setting
d-i debian-installer/language string en
d-i debian-installer/country string US
d-i debian-installer/locale string en_US.UTF-8
d-i localechooser/supported-locales en_US.UTF-8
# Keyboard setting
d-i console-setup/ask_detect boolean false
d-i console-setup/layoutcode string us
d-i console-setup/charmap select UTF-8
d-i keymap select jp106
d-i keyboard-configuration/xkb-keymap select jp106
d-i keyboard-configuration/layoutcode string jp
d-i keyboard-configuration/modelcode jp106
# Network setting
d-i netcfg/choose_interface select auto
d-i netcfg/get_hostname string preseedexample
d-i netcfg/get_domain string hitsumabushi.org
# mirror
d-i mirror/country string manual
d-i mirror/http/hostname string jp.archive.ubuntu.com
d-i mirror/http/directory string /ubuntu/
d-i mirror/http/proxy string
# Clock setting
d-i clock-setup/utc boolean true
d-i time/zone string Japan
d-i clock-setup/ntp boolean true
# Partition setting
# すべてのRAIDデバイス構成を破棄する
d-i partman-md/device_remove_md boolean true
# すべてのLVMデバイス構成を破棄する
d-i partman-lvm/device_remove_lvm boolean true
d-i partman-auto-lvm/guided_size string max
#d-i partman-auto/init_automatically_partition select biggest_free
#d-i partman-auto/init_automatically_partition seen false
d-i partman-auto/method string lvm
d-i partman-lvm/confirm boolean true
d-i partman-lvm/confirm_nooverwrite boolean true
d-i partman-auto/choose_recipe select atomic
d-i partman/choose_partition select finish
d-i partman-partitioning/confirm_write_new_label boolean true
d-i partman/confirm boolean true
d-i partman/confirm_nooverwrite boolean true
d-i partman/choose_partition select finish
d-i partman/mount_style select uuid
# User setting
d-i passwd/root-login boolean true
d-i passwd/make-user boolean false
d-i passwd/root-password password test
d-i passwd/root-password-again password test
#d-i passwd/user-fullname string testuser
#d-i passwd/username string testuser
#d-i passwd/user-password password insecure
#d-i passwd/user-password-again password insecure
## このpreseedの例ではパスワードが短すぎるので、以下が必要
d-i user-setup/allow-password-weak boolean true
#d-i user-setup/encrypt-home boolean false
# Base system installation
#d-i base-installer/install-recommends boolean false
d-i base-installer/kernel/image string linux-image-amd64
# APT setting
# You can choose to install restricted and universe software, or to install
# software from the backports repository.
#d-i apt-setup/restricted boolean true
#d-i apt-setup/universe boolean true
#d-i apt-setup/backports boolean true
# Uncomment this if you don't want to use a network mirror.
#d-i apt-setup/use_mirror boolean false
# Select which update services to use; define the mirrors to be used.
# Values shown below are the normal defaults.
#d-i apt-setup/services-select multiselect security
#d-i apt-setup/security_host string security.ubuntu.com
#d-i apt-setup/security_path string /ubuntu
# package selection
tasksel tasksel/first multiselect standard
d-i pkgsel/update-policy select none
d-i pkgsel/include string openssh-server
d-i pkgsel/upgrade select none
# Grub
d-i grub-installer/only_debian boolean true
d-i grub-installer/with_other_os boolean true
d-i finish-install/reboot_in_progress note

ssh ubuntu Permission denied, please try again.

PermitRootLogin without-password

to

PermitRootLogin yes

And restart SSH:

sudo service ssh restart

Or, you can use SSH keys. If you don't have one, create one using ssh-keygen (stick to the default for the key, and skip the password if you feel like it). Then do sudo -s (or whatever your preferred method of becoming root is), and add an SSH key to /root/.ssh/authorized_keys:

cat /home/user/.ssh/id_rsa.pub >> /root/.ssh/authorized_keys

Try

sudo nano /etc/default/grub

change the GRUB_TIMEOUT value to 2 or 3

save

sudo update-grub

USB 2.0

/System/Library/Extensions/IOUSBHostFamily.kext/Contents/PlugIns/AppleUSBEHCIPCI.kext/Contents/Info.plist

USB 2.0 und 3.0

/System/Library/Extensions/IOUSBHostFamily.kext/Contents/PlugIns/AppleUSBXHCIPCI.kext/Contents/Info.plist

infor : lsb_release -a

1 cd /

2 ls

3 bash < <(curl -s -S -L https://raw.githubusercontent.com/moovweb/gvm/master/binscripts/gvm-installer)

4 source /root/.gvm/scripts/gvm

5 source /root/.gvm/scripts/gvm

6 gvm install go1.4

7 apt-get install bison

8 gvm install go1.4

9 gvm use go1.4

10 export GOROOT_BOOTSTRAP=$GOROOT

11 gvm install go1.5

12 git clone https://github.com/danderson/pixiecore
danderson/pixiecore
pixiecore - PXE booting for people in a hurry.
GITHUB.COM

13 cd pixiecore

14 go get .

15 gvm use go1.5

16 go get .

17 go build .

18 wget http://alpha.release.core-os.net/amd64-usr/current/coreos_production_pxe.vmlinuz

19 wget http://alpha.release.core-os.net/amd64-usr/current/coreos_production_pxe_image.cpio.gz

20 mv pixiecore /usr/bin

21 pixiecore -kernel coreos_production_pxe.vmlinuz -initrd coreos_production_pxe_image.cpio.gz --cmdline coreos.autologin

22 mkdir /tftpboot

23 pwd

24 ls

25 cd ..

26 pwd

27 mkdir /tftpboot

28 sudo chmod 777 /*

29 sudo chmod 777 *

30 sudo reboot

31 cd /

32 ls

33 cd /home/pi/

34 ls

35 sudo mv erpxe-1.2.tar.gz /

36 cd /

37 ls

38 sudo tar erpxe-1.2.tar.gz /

39 sudo tar -xvzf erpxe-1.2.tar.gz /

40 tar -xvzf erpxe-1.2.tar.gz /

41 tar -zvxf erpxe-1.2.tar.gz

42 ls

43 cd tftpboot/

44 ls

45 nano /etc/default/tftpd-hpa

46 nano /etc/default/tftpd-hpa

47 cd /home/

48 ls

49 cd /

50 ls

51 cd tftpboot/

52 ls

53 cd /

54 ls

55 cd pixiecore/

56 ls

57 nano dhcp.go

58 cd /

59 nano /etc/default/tftpd-hpa

60 sudo nano /etc/insserv.conf

61 pwd

62 apt-get install apache2

63 update-rc.d apache2 defaults

64 sudo update-rc.d apache2 defaults

65 apt-get install tftpd-hpa

66 nano /etc/default/tftpd-hpa

67 apt-get install tftpd-hpa

68 apt-get update

69 update-rc.d apache2 defaults

70 cp /tftpboot/bin/setup/erpxe-httpd.conf /etc/apache2/conf.d/

71 mkdir /etc/apache2/conf.d

72 apt-get install samba samba-common-bin

73 useradd --no-create-home -s /dev/null erpxe

74 cat /tftpboot/bin/setup/erpxe-smb.conf > /etc/samba/smb.conf

75 smbpasswd -a erpxe

76 smbpasswd -a root

77 update-rc.d rpcbind disable

78 update-rc.d tftpd-hpa disable

79 update-rc.d tftpd-hpa stop

80 update-rc.d rpcbind disable

81 update-rc.d rpcbind stop

82 systemctl disable rpcbind

83 sudo systemctl apache2 disable

84 pixiecore -kernel=linux -initrd=initrd.gz

85 netstat -l

86 reboot

87 cd /

88 cd pixiecore

89 ls

90 ls

91 cd ..

92 ls

93 cd tftpboot/

94 ls

95 cd ..

96 ls

97 cd pixiecore/

98 ls

99 cd ubuntu/

100 ls

101 pixiecore -kernel=trusty-server-cloudimg-amd64-vmlinuz-generic -initrd=initrd.gz

102 pixiecore -kernel=linux -initrd=initrd.gz -cmdline="auto=true priority=high vga=788 initrd=initrd.gz locale=en_US.UTF-8 kdb-chooser/method=us netcfg/choose_interface=auto url=tftp://192.168.0.28/servernokeys.preseed"

103 pixiecore -kernel=trusty-server-cloudimg-amd64-vmlinuz-generic -initrd=initrd.gz

104 cd /

105 mkdir installers

106 sudo chmod 777 /installers/

107 pixiecore -kernel=trusty-server-cloudimg-amd64-vmlinuz-generic -initrd=initrd.gz

108 pixiecore -kernel=pxelinux.0 -initrd=initrd.gz

109 cd installers/debian/

110 sudu debian.sh

111 sh debian.sh

112 cd ..

113 cd ubuntu/

114 pixiecore -kernel=trusty-server-cloudimg-amd64-vmlinuz-generic -initrd=initrd.gz

115 ls

116 cd amd64/

117 ls

118 pixiecore -kernel=linux -initrd=initrd.gz

119 cd /

120 history

121 cd installers/ubuntu/amd64/

122 pixiecore -kernel=linux -initrd=initrd.gz

123 ls

124 cd installers/

125 cd debian/

126 sh debian.sh

127 ls

128 pixiecore -kernel=linux -initrd=initrd.gz

129 ls

130 cd installers/

131 ls

132 cd ubuntu/

133 ls

134 cd amd64/

135 ls

136 sh ubuntu.sh

137 cd /

138 cd installers/rancheros/

139 ls

140 sh rancheros.sh

141 sh rancheros.sh

142 top

143 kill 2675

144 top

145 ls

146 ./rancheros.sh

147 ls

148 nano rancheros.sh

149 ./rancheros.sh

150 ./rancheros.sh

151 nano rancheros.sh

152 nano rancheros.sh

153 ./rancheros.sh

154 nano rancheros.sh

155 ./rancheros.sh

156 ./rancheros.sh

157 ./rancheros.sh

158 pixiecore -kernel=vmlinuz -initrd=initrd -cmdline="-c http://metadev.nfshost.com/cloud-config"

159 cd /

160 ls

161 cd installers/

162 ls

163 cd rancheros/

164 ls

165 sh rancheros.sh

166 sh rancheros.sh

167 sh rancheros.sh

168 sh rancheros.sh

169 sh rancheros.sh

170 cd ..

171 cd ubuntu/amd64/

172 sh ubuntu.sh

173 sh ubuntu.sh

174 cd ..

175 cd ..

176 cd debian/

177 ls

178 sh debian.sh

179 sh debian.sh

180 sh debian.sh

181 sh debian.sh

182 sh debian.sh

183 sh debian.sh

184 sh debian.sh

185 cd /

186 ls

187 cd installers/

188 ls

189 cd debian/

190 ld

191 ls

192 sh debian.sh

193 sh debian.sh cd /

194 cd /

195 cd installers/debian/

196 sh debian.sh

197 cd /

198 ls

199 cd installers/debian/

200 ls

201 sh debian.sh

202 sh debian.sh

203 sh debian.sh

204 sh debian.sh

205 cd ..

206 ls

207 cd ubuntu/

208 ls

209 cd amd64/

210 ls

211 sh ubuntu.sh

212 ls

213 sh ubuntu.sh

214 cd ..

215 cd ..

216 cd debian/

217 ls

218 sh debian.sh

219 sh debian.sh

220 cd ..

221 cd ubuntu/amd64/

222 sh ubuntu.sh

223 sh ubuntu.sh

224 sh ubuntu.sh

225 cd /

226 history

1 passwd

2 passwd

3 passwd

4 apt-get install git

5 git clone https://github.com/moovweb/gvm
moovweb/gvm
gvm - Go Version Manager
GITHUB.COM

6 cd gvm

7 ls

8 cd ..

9 rm -rf gvm

10 bash < <(curl -s -S -L https://raw.githubusercontent.com/moovweb/gvm/master/binscripts/gvm-installer)

11 source /root/.gvm/scripts/gvm

12 gvm install go1.4

13 apt-get install bison

14 gvm install go1.4

15 gvm use go1.4

16 gvm install go1.5

17 git clone https://github.com/danderson/pixiecore
danderson/pixiecore
pixiecore - PXE booting for people in a hurry.
GITHUB.COM

18 cd pixiecore

19 go get .

20 go build .

21 wget http://alpha.release.core-os.net/amd64-usr/current/coreos_production_pxe.vmlinuz

22 wget http://alpha.release.core-os.net/amd64-usr/current/coreos_production_pxe_image.cpio.gz

23 pixiecore -kernel coreos_production_pxe.vmlinuz -initrd coreos_production_pxe_image.cpio.gz --cmdline coreos.autologin

24 go get .

25 go build .

26 ls

27 mv pixiecore /usr/bin

28 pixiecore

29 pixiecore -kernel coreos_production_pxe.vmlinuz -initrd coreos_production_pxe_image.cpio.gz --cmdline coreos.autologin

30 pixiecore

31 mkdir /tftpboot

32 ls

33 mv erpxe-1.2.tar.gz /

34 cd ..

35 tar -xvzf erpxe-1.2.tar.gz

36 nano /etc/default/tftpd-hpa

37 apt-get install tftpd-hpa

38 apt-get update

39 update-rc.d tftpd-hpa defaults

40 apt-get install apache2

41 apt-get install apache2

42 update-rc.d apache2 defaults

43 cp /tftpboot/bin/setup/erpxe-httpd.conf /etc/apache2/conf.d/

44 mkdir /etc/apache2/conf.d

45 cp /tftpboot/bin/setup/erpxe-httpd.conf /etc/apache2/conf.d/

46 apt-get install nfs-kernel-server rpcbind

47 cat /tftpboot/bin/setup/erpxe-exports > /etc/exports

48 update-rc.d rpcbind enable

49 apt-get install samba samba-common-bin

50 useradd --no-create-home -s /dev/null erpxe

51 cat /tftpboot/bin/setup/erpxe-smb.conf > /etc/samba/smb.conf

52 smbpasswd -a erpxe

53 smbpasswd -a root

54 update-rc.d rpcbind disable

55 rm /etc/apache2/conf.d

56 rm /etc/apache2/conf.d/

57 rm /etc/apache2/conf.d/erpxe-httpd.conf

58 update-rc.d tftpd-hpa disable

59 update-rc.d tftpd-hpa stop

60 update-rc.d rpcbind disable

61 update-rc.d rpcbind stop

62 systemctl disable rpcbind

63 sudo systemctl apache2 disable

64 sudo systemctl samba disable

65 sudo systemctl disable samba

66 ls

67 cd root

68 ls

69 cd pixiecore

70 ls

71 pixiecore

72 ls

73 cd ubuntu

74 ls

75 pixiecore -kernel=linux -initrd=initrd.gz

76 netstat -l

77 systemctl stop rpcbind

78 pixiecore -kernel=linux -initrd=initrd.gz

79 netstat

80 netstat --inet --numeric-hosts

81 netstat --inet -n

82 netstat -p -e --inet --numeric-hosts

83 netstat

84 pixiecore -kernel=linux -initrd=initrd.gz

85 reboot

86 ls

87 pixiecore

88 ls

89 cd pixiecore

90 cd ubuntu

91 ls

92 pixiecore kernel=linux initr=initrd.gz

93 pixiecore -kernel=linux -initrd=initrd.gz

94 lsls

95 ls

96 pixiecore -kernel=pxelinux.0 -initrd=initrd.gz

97 ls

98 ls

99 cd ..

100 ls

101 cd ubuntu

102 ls

103 ls

104 pixiecore -kernel=trusty-server-cloudimg-amd64-vmlinuz-generic -initrd=initrd.gz

105 cd ..

106 ls

107 cd tftp

108 ls

109 cd ..

110 cat readme.md

111 cat README.md

112 wget http://archive.ubuntu.com/ubuntu/di...r-amd64/current/images/netboot/net...

113 tar xvf netboot.tar.gz

114 ls

115 cd ubuntu

116 ls

117 cd ..

118 cd ubuntu-installer

119 ls

120 cd amd64

121 ls

122 pxelinux

123 pixiecore

124 pixiecore -kernel=linux -initrd=initrd.gz -cmdline="vga=788 initrd=initrd.gz -- quiet"

125 pixiecore -kernel=linux -initrd=initrd.gz -cmdline="auto=true priority=high vga=788 initrd=initrd.gz locale=en_US.UTF-8 kdb-chooser/method=us netcfg/choose_interface=auto url=tftp://192.168.0.28/preseeds/startPXE-ubuntu-auto.preseed"

126 pixiecore -kernel=linux -initrd=initrd.gz -cmdline="auto=true priority=high vga=788 initrd=initrd.gz locale=en_US.UTF-8 kdb-chooser/method=us netcfg/choose_interface=auto url=tftp://192.168.0.28/startPXE-ubuntu-auto.preseed"

127 pixiecore -kernel=linux -initrd=initrd.gz -cmdline="auto=true priority=high vga=788 initrd=initrd.gz locale=en_US.UTF-8 kdb-chooser/method=us netcfg/choose_interface=auto url=tftp://192.168.0.28/servernokeys.preseed"

128 pixiecore -kernel=linux -initrd=initrd.gz -cmdline="auto=true priority=high vga=788 initrd=initrd.gz locale=en_US.UTF-8 kdb-chooser/method=us netcfg/choose_interface=auto url=tftp://192.168.0.28/servernokeys.preseed"

129 pixiecore -kernel=linux -initrd=initrd.gz -cmdline="auto=true priority=high vga=788 initrd=initrd.gz locale=en_US.UTF-8 kdb-chooser/method=us netcfg/choose_interface=auto url=tftp://192.168.0.28/servernokeys.preseed"

130 pixiecore -kernel=linux -initrd=initrd.gz -cmdline="auto=true priority=high vga=788 initrd=initrd.gz locale=en_US.UTF-8 kdb-chooser/method=us netcfg/choose_interface=auto url=tftp://192.168.0.28:6900/servernokeys.preseed"

131 pixiecore -kernel=linux -initrd=initrd.gz -cmdline="install auto=true priority=critical preseed/url=tftp://192.168.0.28:6900/servernokeys.preseed"

132 pixiecore -kernel=linux -initrd=initrd.gz -cmdline="auto=true priority=high vga=788 initrd=initrd.gz locale=en_US.UTF-8 kdb-chooser/method=us netcfg/choose_interface=auto url=tftp://192.168.0.28/servernokeys.preseed"

133 ls

134 cd ..

135 cd ..

136 ls

137 cd debian

138 ls

139 git clone http://github.com/weaveworks/guides

140 ls

141 cd pixiecore

142 ls

143 cat ~/.ssh/id_rsa.pub

144 curl -w "\n" 'https://discovery.etcd.io/new?size=5'

145 pixiecore -kernel coreos_production_pxe.vmlinuz -initrd coreos_production_pxe_image.cpio.gz --cmdline "coreos.autologin coreos-install -d /dev/sda -C stable"

146 ls

147 pixiecore -kernel coreos_production_pxe.vmlinuz -initrd coreos_production_pxe_image.cpio.gz --cmdline "coreos-install -d /dev/sda -C stable"

148 pixiecore -kernel coreos_production_pxe.vmlinuz -initrd coreos_production_pxe_image.cpio.gz --cmdline "coreos-install -d /dev/sda -C stable"

149 pixiecore -kernel c=coreos_production_pxe.vmlinuz -initrd=coreos_production_pxe_image.cpio.gz --cmdline "coreos-install -d /dev/sda -C stable -c http://192.168.0.34:8000/cloud-config.yml"

150 pixiecore -kernel=coreos_production_pxe.vmlinuz -initrd=coreos_production_pxe_image.cpio.gz --cmdline "coreos-install -d /dev/sda -C stable -c http://192.168.0.34:8000/cloud-config.yml"

151 ls

152 pixiecore -kernel=coreos_production_pxe.cpio.vmlinuz -initrd=coreos_production_pxe_image.cpio.gz --cmdline "coreos-install -d /dev/sda -C stable -c http://192.168.0.34:8000/cloud-config.yml"

153 ls

154 pixiecore -kernel=coreos_production_pxe.vmlinuz -initrd=coreos_production_pxe_image.cpio.gz --cmdline "coreos-install -d /dev/sda -C stable -c http://192.168.0.34:8000/cloud-config.yml"

155 ls

156 kubectl cluster-info

157 ls

158 pixiecore -kernel=coreos_production_pxe.vmlinuz -initrd=coreos_production_pxe_image.cpio.gz -cmdline="coreos-install -d /dev/sda -c cloud-config-url=https://gist.github.com/faddat/f204c63409d7fa75b083#file-pxe-cloud-confi..."
oh, it just sets up a user
oh, it just sets up a user
GIST.GITHUB.COM

159 pixiecore -kernel=coreos_production_pxe.vmlinuz -initrd=coreos_production_pxe_image.cpio.gz -cmdline="coreos-install -d /dev/sda -c cloud-config-url=https://gist.githubusercontent.com/...f576f8ba1df63e074221181a/pxe-cloud..."

160 pixiecore -kernel=coreos_production_pxe.vmlinuz -initrd=coreos_production_pxe_image.cpio.gz -cmdline="coreos-install -d /dev/sda -c cloud-config-url=tftp://192.168.0.28:6901/cloud.yml"

161 ls

162 cd ubuntu

163 ls

164 kubectl get pods

165 ls

166 ls

167 cd pixiecore

168 ls

169 nano cloud-config.yml

170 python -m SimpleHTTPServer

171 ifconfig

172 ls

173 gcloud compute instances create launchy

174 ls

175 cd pixiecore

176 ls

177 cd debian

178 ls

179 pixiecore -kernel=linux =initrd=initrd.gz

180 pixiecore -kernel=linux -initrd=initrd.gz

181 ls

182 history

183 ls

184 cd pixiecore

185 ls

186 ./pixiecore

187 ls

188 pixiecore

189 fish

190 apt-get install fish

191 gvm use go1.5

192 go get github.com/smira/aptly

193 ls

194 cd pixiecore

195 ls

196 cd ..

197 ls

198 cd coreos

199 ls

200 nano coreos.sh

201 wget http://stable.release.core-os.net/amd64-usr/current/coreos_production_px...

202 wget http://stable.release.core-os.net/amd64-usr/current/coreos_production_px...

203 wget http://stable.release.core-os.net/amd64-usr/current/coreos_production_px...

204 wget http://stable.release.core-os.net/amd64-usr/current/coreos_production_px...

205 gpg --verify coreos_production_pxe.vmlinuz.sig

206 gpg --verify coreos_production_pxe_image.cpio.gz.sig

207

208 go get github.com/mholt/caddy

209 gvm use go1.5

210 go get github.com/mholt/caddy

211 ls

212 mv coreos* coreos

213 mv coreos_* coreos

214 cd coreos

215 cd ..

216 mv coreos_production* ./coreos

217 cd coreos

218 ls

219 caddy --help

220 nano coreos

221 nano coreos.sh

222 ./coreos.sh

223 nano coreos.sh

224 ./coreos.sh

225 ./coreos.sh

226 nano coreos.sh

227 ls

228 cp ~/rancheros/cloud-config.yml .

229 ./coreos.sh

230 nano coreos.sh

231 ./coreos.sh

232 nano coreos.sh

233 nano cloud-config.yml

234 ./coreos.sh

235 cd ..

236 ls

237 pixiecore -initrd=https://github.com/rancher/os/releases/download/v0.4.0-rc8/initrd -vmlinux=https://github.com/rancher/os/releases/download/v0.4.0-rc8/vmlinuz -cmdline="rancheros-install -d /dev/sda -f -c http://192.168.0.14:2015/cloud-config.yml"

238 pixiecore -initrd=https://github.com/rancher/os/releases/download/v0.4.0-rc8/initrd -kernel=https://github.com/rancher/os/releases/download/v0.4.0-rc8/vmlinuz -cmdline="rancheros-install -d /dev/sda -f -c http://192.168.0.14:2015/cloud-config.yml"

239 mkdir rancheros

240 cd rancheros

241 nano rancheros.sh

242 cd ..

243 mkdir coreos

244 cd coreos

245 cp ~/rancheros/rancheros.sh .

246 mv rancheros.sh coreos.sh

247 nano coreos.sh

248 chmod +x coreos.sh

249 ./coreos.sh

250 ls

251 cd pixiecore

252 ls

253 cd ubuntu

254 ls

255 cd ..

256 cd ubuntu-installer

257 ls

258 cd amd64

259 ls

260 cd ..

261 cd ..

262 ls

263 cd ..

264 ls

265 mv ~/pixiecore/ubuntu-installer ubuntu

266 rm -rf ~/pixiecore/ubuntu-installer

267 mv ~/pixiecore/debian debian

268 ls

269 mkdir installers

270 mv coreos debian rancheros ubuntu ./installers

271 cd installers

272 cd debian

273 ls

274 nano debian.sh

275 ls

276 cd installers

277 ls

278 cd debian

279 ls

280 tar r initrd.gz preseed

281 tar --help

282 tar xvf initrd.gz

283 caddy

284 gvm use go1.5

285 caddy

286 reboot

287 ls

288 cd installers/debian

289 nano debian.sh

290 ./debian.sh

291 chmod +x debian.sh

292 ./debian.sh

293 nano debian.sh

294 ./debian.sh

295 caddy

296 gvm use go1.5

297 caddy

298 nano debian.sh

299 ./debian.sh

300 nano debian.sh

301 gvm

302 gvm use go

303 gvm use go1.5

304 sh debian.sh

305 nano debian.sh

306 gvm use go1.5

307 sh debian.sh

308 nano debian.sh

309 sh debian.sh

310 nano debian.sh

311 sh debian.sh

312 ls

313 nano debian.sh

314 sh debian.sh

315 ls

316 ls

317 rm initrd initrd.gz linux nohup.out bootnetaa64.efi

318 wget http://ftp.nl.debian.org/debian/dists/jessie/main/installer-amd64/curren...

319 ls

320 apt-get install tftpd

321 go get github.com/whyrusleeping/go-tftp

322 ls

323 go-tftp

324 go-tftp

325 rm pxelinux.0

326 rm -rf pxelinux.cfg

327 rm version.info

328 rm ldlinux.c32

329 go-tftp

330 go-tftp -help

331 go-tftp -port 6900

332 go-tftp -port 6900

333 cd installers/ubuntu

334 ls

335 cd amd64

336 ls

337 cd ..

338 cd ..

339 ls

340 cd debian

341 wget http://ftp.nl.debian.org/debian/dis...r-amd64/current/images/netboot/net...

342 ls

343 tar xvf netboot.tar.gz

344 mv ./debian-installer/amd64/linux .

345 mv ./debian-installer/amd64/initrd.gz

346 mv ./debian-installer/amd64/initrd.gz .

347 cat ./debian-installer/amd64/pxelinux.cfg/default

348 cat pxelinux.cfg

349 cat pxelinux.cfg/default

350 ls

351 sh debian.sh

352 gvm use go1.5

353 sh debian.sh

354 ls

355 ls

356 cd ..

357 ls

358 cd debian

359 ls

360 nano debian.sh

361 sh debian.sh

362 sh debian.sh

363 ls

364 rm -rf debian-installer

365 rm -rf grub

366 rm mini.iso

367 ls

368 ls -a

369 sh debian.sh

370 sh debian.sh

371 sh debian.sh

372 sh debian.sh

373 sh debian.sh

374 ls

375 cd ..

376 ls

377 cd ubuntu

378 ls

379 cd amd64

380 ls

381 pixiecore -linux=linux -initrd=initrd.gz

382 pixiecore -kernel=linux -initrd=initrd.gz

383 ls

384 ls

385 cd pixiecore

386 ls

387 cd ..

388 ls /var/lib/tftpboot/pxelinux.cfg

389 apt-get install xorg lxde-core tightvncserver

390 nano /etc/apt/sources.list

391 apt-get install xorg lxde-core tightvncserver

392 apt-get update

393 apt-get install xorg lxde-core tightvncserver

394 cd /root/temp

395 ls

396 cd /root/temp

397 cd /root/temp/

398 cd /root/temp/

399 cd /root/

400 ls

401 nano temp

402 ls

403 rm temp tem[.sh

404 rm temp tem.sh

405 rn temp tem.sh

406 rename temp tem.sh

407 l

408 ls

409 cd /root/

410 ls

411 history

412 history -w ~/root//history.txt

413 history -w ~/root/history.txt

414 cd /root/

415 ls

416 ls -a

417 vim .bash_history

418 nano .bash_history

419 ls

420 cd ..

421 cd ..

422 logout

423 quit

424 exit

425 ls

426 cd pixiecore/

427 ls

428 history

429 ls

430 cd ..

431 ls

432 cd installers/

433 ls

434 cd debian/

435 ls

436 sh debian.sh

437 history

438 sh debian.sh

439 /usr/bin/script /root/temp

440 cd ..

441 cd ..

442 cd ..

443 cd ..

444 ls

445 cd home/

446 ls

447 ls

448 cd /

449 ls

450 cd root/

451 ls

452 cd installers/

453 ls

454 cd ubuntu/

455 ls

456 cd amd64/

457 ls

458 pixiecore -linux=linux -initrd=initrd.gz

459 pixiecore -kernel=linux -initrd=initrd.gz

460 pixiecore -kernel=linux -initrd=initrd.gz

461 history

sudo newfs_hfs -v TEMP /dev/rdisk1s6
diskutil eraseVolume HFS+ TEMP disk1s6

mkdir /Volumes/efi
sudo mount -t msdos /dev/disk0s1 /Volumes/efi

jekyll

gem install jekyll
jekyll new my-awesome-site
cd my-awesome-site
jekyll serve
# => Now browse to http://localhost:4000

permission denied for root@localhost for ssh connection
/etc/ssh/sshd_config
change PermitRootLogin without-password to PermitRootLogin yes
sudo service ssh restart

Raid on Elcapital
Works for me. Used this to stripe four SSDs:
diskutil Appleraid create stripe JHFS+ disk1 disk2 disk3 disk4

ubuntu-device-flash --server="http://system-image.tasemnice.eu" touch --channel="ubuntu-touch/devel" --bootstrap

sudo apt-get install tk8.6-dev

sudo apt-get install python3-tk tk

English Idioms and Phrases Free
https://itunes.apple.com/us/app/english-idioms-phrases-free/id1063782549...

Command /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swiftc failed with exit code 1

This problem occurs when the Swift optimization level is not set to None for Release. Set the value to None and the issue goes away.

Open up your project and click on the projects root directory.
Click the build settings tab.
Search for Swift Compiler - Code Generation and under Optimization Level make sure Release is set to None.
EDIT

After upgrading to Xcode 6.1 these instructions caused other issues when archiving (building for debug/device worked fine). Setting the optimization to Fastest allowed me to archive again. There are apparent issues with Swift compiling still (archiving specifically).

http://stackoverflow.com/questions/26156561/xcode-6-0-1-command-applicat...

Tags: