Only 3 days of absence allowed for the entire duration of the program.
The social rules are: (Courtesy of Recurse Center)
Pesto is dedicated to providing a harassment-free learning environment and community for everyone, regardless of gender, sexual orientation, disability, physical appearance, body size, race, religion, or anything else. We do not tolerate harassment in any form.
Alice: I just installed Linux on my computer!
Bob: It’s actually called GNU/Linux.
Defn: A well-actually is when you correct someone about something that’s not relevant to the conversation or tangential to what they’re trying to say.
The best rule of thumb is, if you’re not sure whether something needs to be said right now, hold off and see what happens.
Dan: What’s the command line?
Carol: Wait, you’ve never used the command line?
Defn: Feigned surprise is when you act surprised when someone doesn’t know something.
A good rule of thumb is that always know that you cannot know the entirety of a subject. Also, there are people from other educational backgrounds studying Programming. Hence, they may not know all the jargon.
Bob: What’s the name of the string copy function?
Alice: Strncpy.
Eve: (from across the room) You should use strlcpy. It’s safer.
Defn: Backseat driving is when you lob advice from across the room without joining a conversation. Because you haven’t been participating in the conversation, it’s easy to miss something important and give advice that’s not actually helpful.
Even if your advice is correct, it’s rude to bust into a conversation without asking.
If you overhear a conversation where you could be helpful, the best thing to do is to ask to join.
Carol: Windows is hard to use.
Bob: No way. Windows is so easy to use that even my mom can use it.
Defn: Subtle -isms are subtle expressions of racism, sexism, ageism, homophobia, transphobia and other kinds of bias and prejudice.
If you see racism, sexism, etc. outside of Pesto, please don’t bring it in. For example, please don’t start a discussion about the latest offensive comment from Random Tech Person Y.
The Learning Phase is the first phase of the Pesto Program. It is intended to give you a theoretical understanding of technologies that we are going to work with for the next 12 weeks
The working hours will be divided into two segments.
This Week's Project
Knowledge is a familiarity, awareness, or understanding of someone or something, such as facts, information, descriptions, or skills, which is acquired through experience or education by perceiving, discovering, or learning.
Epistemology addresses such questions as:
A thing about questions
VSCode (Editor) [Include it in path]
Extensions [Link]
For macOS
iTerm2
For Linux (Ubuntu)
Terminator or current shell
curl (cli http)
nvm (node version manager)
node using nvm
npx
yarn
git, if not available
ls |
Lists files in current directory |
mkdir graphics |
Make a directory called graphics |
cd tempdir |
Change directory to tempdir |
rmdir emptydir |
Remove directory (must be empty) |
rm file1.bak |
Remove or delete file |
clear |
clear the terminal |
man ls |
Manual (help) about command |
grep <str><files> |
grep "bad word" * |
Find which files contain a certain word |
chmod <opt> <file> |
chmod 644 *.html |
Change file permissions read only |
ps <opt> |
ps aux |
List all running processes by #ID |
kill <opt> <ID> |
kill -9 8453 |
Kill process with ID #8453 |
find |
find -iname "MyCProgram.c" |
Find files using file-name ( case in-sensitve find) |
pwd |
pwd |
tells you where you currently are |
lsof |
lsof -i :8000 |
list open files |
Signals
Signals are software interrupts.
Signals provide a way of handling asynchronous events—for example, a user at a terminal typing the interrupt key to stop a program or the next program in a pipeline terminating prematurely.
These names all begin with the three characters SIG.
Numerous conditions can generate a signal:
Disposition of the signal, or the action associated with a signal.
factorial 0 = 1
factorial n =
n * factorial (n-1)
function factorial(num) {
function loop(acc, _num) {
if (_num === 1) {
return acc;
}
return loop(acc * _num, _num - 1);
}
return loop(1, num)
}
int main() {
int product = 1;
for(int i = 2; i <= 10; i++) {
product = product * i;
if(i == 7) {
goto answer;
}
}
answer:
printf("%d", product);
}
The Language Equivalence Fallacy
According to W O Quine
no unique interpretation is possible, because a 'radical interpreter' has no way of telling which of many possible meanings the speaker has in mind.
Example: Doubling a list
def createDoubleList(ls):
i = 0
doubledList = []
while i < len(ls):
doubledList.append(2 * ls[i])
i += 1
return doubledList
def createDoubleList(ls):
doubledList = []
for el in ls:
doubledList.append(2 * el)
return doubledList
def createDoubleList(ls):
return [ 2 * el for el in ls ]
Why is everyone in such a rush? (by Peter Norvig)
Felleisen et al. give a nod to this trend in thier book How to Design Programs, when they says
"Bad programming is easy. Idiots can learn it in 21 days, even if they are dummies."
Alan Perlis once said: "A language that doesn't affect the way you think about programming, is not worth knowing".
Every powerful language has three mechanisms for accomplishing this:
Evaluating Languages
class QuickSort
{
int partition(int arr[], int low, int high)
{
int pivot = arr[high];
int i = (low-1); // index of smaller element
for (int j=low; j<high; j++)
{
if (arr[j] <= pivot)
{
i++;
int temp = arr[i];
arr[i] = arr[j];
arr[j] = temp;
}
}
int temp = arr[i+1];
arr[i+1] = arr[high];
arr[high] = temp;
return i+1;
}
}
void sort(int arr[], int low, int high)
{
if (low < high)
{
int pi = partition(arr, low, high);
sort(arr, low, pi-1);
sort(arr, pi+1, high);
}
}
quicksort :: (Ord a) => [a] -> [a]
quicksort [] = []
quicksort (x:xs) =
let smallerSorted = quicksort [a | a <- xs, a <= x]
biggerSorted = quicksort [a | a <- xs, a > x]
in smallerSorted ++ [x] ++ biggerSorted
quicksort [] = []
quicksort (x:xs) =
quicksort [a | a <- xs, a <= x]
++
[x]
++
quicksort [a | a <- xs, a > x]
A version control system, or VCS, tracks the history of changes as people and teams collaborate on projects together.
Developers can review project history to find out:
Which changes were made?
Who made the changes?
When were the changes made?
Why were changes needed?
These systems (such as CVS, Subversion, and Perforce) have a single server that contains all the versioned files, and a number of clients that check out files from that central place.
In a DVCS (such as Git, Mercurial, Bazaar or Darcs), clients don’t just check out the latest snapshot of the files; rather, they fully mirror the repository, including its full history.
Thus, if any server dies, and these systems were collaborating via that server, any of the client repositories can be copied back up to the server to restore it.
Every clone is really a full backup of all the data.
With the intent that there is One True Source
All developers work (checkout) from that source, and then add (commit) their changes
Systems are designed with the intent that one repository is as good as any other, and that
Any semantic value as to which repository should be trusted is imposed from the outside by process, not by the software itself.
Git has three main states that your files can reside in: committed, modified, and staged:
Committed means that the data is safely stored in your local database.
Modified means that you have changed the file but have not committed it to your database yet.
Staged means that you have marked a modified file in its current version to go into your next commit snapshot.
This leads us to the three main sections of a Git project: the Git directory, the working tree, and the staging area.
You modify files in your working tree.
You selectively stage just those changes you want to be part of your next commit, which adds only those changes to the staging area.
You do a commit, which takes the files as they are in the staging area and stores that snapshot permanently to your Git directory.
The basic Git workflow goes something like this:
A repository, or Git project, encompasses the entire collection of files and folders associated with a project, along with each file’s revision history.
You typically obtain a Git repository in one of two ways
You can take a local directory that is currently not under version control, and turn it into a Git repository, or
You can clone an existing Git repository from elsewhere.
Do
cd /home/user/my_project
and type:
git init
This creates a new subdirectory named .git that contains all of your necessary repository files — a Git repository skeleton.
If you want to get a copy of an existing Git repository — for example, a project you’d like to contribute to — the command you need is git clone.
The main tool you use to determine which files are in which state is the git status command.
$ git status
On branch master
Your branch is up-to-date with 'origin/master'.
nothing to commit, working directory clean
In order to begin tracking a new file, you use the command git add. To begin tracking the README file, you can run this:
$ git add README
Often, you’ll have a class of files that you don’t want Git to automatically add or even show you as being untracked.
In such cases, you can create a file listing patterns to match them named .gitignore. Here is an example .gitignore file:
$ cat .gitignore
*.[oa]
*~
To see what you’ve changed but not yet staged, type git diff with no other arguments.
If you want to see what you’ve staged that will go into your next commit, you can use git diff --staged.
The simplest way to commit is to type git commit:
$ git commit
Alternatively, you can type your commit message inline with the commit command by specifying it after a -m flag, like this:
$ git commit -m "Story 182: Fix benchmarks for speed"
[master 463dc4f] Story 182: Fix benchmarks for speed
2 files changed, 2 insertions(+)
create mode 100644 README
To remove a file from Git, you have to remove it from your tracked files (more accurately, remove it from your staging area) and then commit.
The git rm command does that, and also removes the file from your working directory so you don’t see it as an untracked file the next time around.
If you modified the file and added it to the staging area already, you must force the removal with the -f option.
If you’ve made no changes since your last commit and all you’ll change is your commit message.
Forking and cloning and the difference between them.
How to create repositories.
What are README files?
How to read other people's repositories.
Why commit often and in a logically coherent units
Conventions to follow during a commit
Searching through a commit
git log --author="Arfat Salman"
git log --grep="db"
Separate subject from body with a blank line
Do not end the subject line with a period
Capitalize the subject line and each paragraph
Use the imperative mood in the subject line
Wrap lines at 72 characters
Use the body to explain what and why you have done something. In most cases, you can leave out details about how a change has been made.
https://gist.github.com/jaseemabid/1321592