Skip to content

Instantly share code, notes, and snippets.

@YKV
YKV / publickey-git-error.markdown
Created April 19, 2018 22:40 — forked from adamjohnson/publickey-git-error.markdown
Fix "Permission denied (publickey)" error when pushing with Git

"Help, I keep getting a 'Permission Denied (publickey)' error when I push!"

This means, on your local machine, you haven't made any SSH keys. Not to worry. Here's how to fix:

  1. Open git bash (Use the Windows search. To find it, type "git bash") or the Mac Terminal. Pro Tip: You can use any *nix based command prompt (but not the default Windows Command Prompt!)
  2. Type cd ~/.ssh. This will take you to the root directory for Git (Likely C:\Users\[YOUR-USER-NAME]\.ssh\ on Windows)
  3. Within the .ssh folder, there should be these two files: id_rsa and id_rsa.pub. These are the files that tell your computer how to communicate with GitHub, BitBucket, or any other Git based service. Type ls to see a directory listing. If those two files don't show up, proceed to the next step. NOTE: Your SSH keys must be named id_rsa and id_rsa.pub in order for Git, GitHub, and BitBucket to recognize them by default.
  4. To create the SSH keys, type ssh-keygen -t rsa -C "your_email@example.com". Th
@YKV
YKV / hackerrank.swift
Created October 31, 2016 03:24
HackerRank Swift stdin stdout
import Foundation
//MARK: STDIN STDOUT
func readData() -> NSData {
return NSFileHandle.fileHandleWithStandardInput().availableData
}
func readString() -> String {
return String(data: readData(), encoding:NSUTF8StringEncoding)!.stringByTrimmingCharactersInSet(NSCharacterSet.whitespaceAndNewlineCharacterSet())
}
Q1
What is it mean when you say a language is object-oriented and why could it be considered an improvement over a procedural language?
Object oriented language means that all actions that people do can be explain besed on any object like human.
Human has head, arms, leags which are our features(tools) and can walk, eat, listen which our actions. Procedural language can be described as promitive and basics.
Q2
What are structures and why are they useful?
Structures helps to keep data elements in specific schema, in this case we won't mix them up. Every data will have specific type and will belong to to specific entity.
Q3
@YKV
YKV / gitCollaboration.txt
Created June 27, 2016 23:33
Git Collaboration & Merge Conflicts (Pair Exercise)
Question 1: During this linear process, where Dev B changed the document after Dev A had already committed and pushed their change to the remote (github), what extra step(s) could Developer B have taken to completely avoid this merge conflict?
The Dev B could work on separate branch or make pull request first to avoid merging conflicts
Question 2: Given your answer in Q1, does this mean that merge conflicts can be completely (always) avoided in the real world? Why or why not?
If two developers work on the same file simultaneously merge conflict cannot be avoided.
@YKV
YKV / r&q.txt
Created June 27, 2016 22:14
Readings & Questions
Q1
Explain a scenario when you would fork a project vs. create a branch of a project
To protect the main project from malicious attacks from other contributors Fork feature is the best help for the company.
With Fork feature the vendor can check the entire code of contributor and will be able to accept it or not.
Q2
What is the difference between fgets and scanf
fgets can read from any file, when scanf can only reads standard input
Q3
//Write a command that will output the number of times the cat command was used previously
history | grep -o "cat" | wc -l
//Write a command to output a count of all words in the unix dictionary file that begin with the letter "a"
grep "^a" /usr/share/dict/words | wc -l
//What operating system (OS) vendor and version is your vagrant box running?
Darwin Kernel Version 15.5.0: Tue Apr 19 18:36:36 PDT 2016; root:xnu-3248.50.21~8/RELEASE_X86_64
//What operating system (OS) vendor and version is your vagrant box running?
//Write a command that will output the number of times the cat command was used previously
history | grep -o "cat" | wc -l
//Write a command to output a count of all words in the unix dictionary file that begin with the letter "a"
grep "^a" /usr/share/dict/words | wc -l
//Return all the words in the dictionary that start with "a" and end with "s"
cat /usr/share/dict/words | grep "^a" | grep "s$"
//Using one unix command, download & save the following page:https://www.lighthouselabs.ca/index.html