Skip to content

Instantly share code, notes, and snippets.

💭
Alive and healthy

Amy Pellegrini amypellegrini

💭
Alive and healthy
Block or report user

Report or block amypellegrini

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@amypellegrini
amypellegrini / README.md
Created Aug 10, 2019
Save your bash history for learning purposes
View README.md

Save your bash history for learning purposes

Very often I find myself trying to learn something new which requires from me to run easy-to-forget console/terminal commands.

Sometimes I have to trial-and-error using different commands until I finally get it, which means I may have some difficulty trying to remember what I did next time I want to do it again.

To avoid this I find very useful to save my command line history so I can replay back everything I did step by step.

@amypellegrini
amypellegrini / make-file-executable.md
Last active Jun 20, 2019
Make file executable in UNIX-style command line
View make-file-executable.md

Make file executable in UNIX-style command line

Recently I started to learn Python. My first experiment consisted of a simple script named script.py to print the classic "Hello World!" message. To make the file executable, I added the shebang at the top of the file.

Contents in script.py:

#!/usr/bin/env python3
View keybase.md

Keybase proof

I hereby claim:

  • I am amypellegrini on github.
  • I am amypellegrini (https://keybase.io/amypellegrini) on keybase.
  • I have a public key ASCj0KljOByEIgUNDMwkfXxa0t2XAI-bAtmY1crdA_eEVgo

To claim this, I am signing this object:

View git-cheatsheet.md

Git cheat sheet

Git rebase, fixup, and autosquash

  1. Copy commit to fix hash
  2. Commit your changes using --fixup [hash] instead of commit message
  3. git rebase -i [base/branch] --autosquash

[Delete multiple branches using a string match pattern][1]

@amypellegrini
amypellegrini / findShort.js
Created Nov 14, 2016
Shortest string exercise from codewars
View findShort.js
// Shortest Word
function findShort(str) {
return str.split(' ').sort((a, b) => {
return a.length < b.length ? -1 : 1;
})[0].length;
}
@amypellegrini
amypellegrini / distance.js
Last active Oct 27, 2016
Distance formula in Node.js
View distance.js
let x1 = process.argv[2],
y1 = process.argv[3],
x2 = process.argv[4],
y2 = process.argv[5];
/**
* Return the distance between two points for the given coordinates.
*
* @param {Number} x1 - x coordinate for the first point.
* @param {Number} y1 - y coordinate for the fisrt point.
@amypellegrini
amypellegrini / 01-directory-structure.md
Created Aug 30, 2016 — forked from tracker1/01-directory-structure.md
Anatomy of a JavaScript/Node project.
View 01-directory-structure.md

Directory structure for JavaScript/Node Projects

While the following structure is not an absolute requirement or enforced by the tools, it is a recommendation based on what the JavaScript and in particular Node community at large have been following by convention.

Beyond a suggested structure, no tooling recommendations, or sub-module structure is outlined here.

Directories

  • lib/ is intended for code that can run as-is
  • src/ is intended for code that needs to be manipulated before it can be used
You can’t perform that action at this time.