Skip to content

Instantly share code, notes, and snippets.

@peterdemartini
peterdemartini / command.sh
Last active Jan 12, 2022
Exclude node_modules in timemachine
View command.sh
find `pwd` -type d -maxdepth 3 -name 'node_modules' | xargs -n 1 tmutil addexclusion
@nepsilon
nepsilon / speed-is-a-feature-10-tips-faster-browser-networking.md
Created Sep 6, 2016
Speed is a feature: 10 tips for faster browser networking — First published in fullweb.io issue #64
View speed-is-a-feature-10-tips-faster-browser-networking.md

Speed is a feature: 10 tips for faster browser networking

1. Minimize TCP connections

Ensure the web server uses Keep-Alive headers.

2. Reduce DNS look-ups

DNS look-ups are the first thing blocking your HTTP requests.

@nepsilon
nepsilon / git-change-commit-messages.md
Last active Jan 13, 2022
How to change your commit messages in Git? — First published in fullweb.io issue #55
View git-change-commit-messages.md

How to change your commit messages in Git?

At some point you’ll find yourself in a situation where you need edit a commit message. That commit might already be pushed or not, be the most recent or burried below 10 other commits, but fear not, git has your back 🙂.

Not pushed + most recent commit:

git commit --amend

This will open your $EDITOR and let you change the message. Continue with your usual git push origin master.

@nepsilon
nepsilon / gitignore.md
Last active Dec 13, 2019
Understand what .gitignore rule is ignoring your files — First published in fullweb.io issue #54
View gitignore.md

Understand what .gitignore rule is ignoring your files

Ready to commit, you fire your git status and you don’t see your files 🤔.

Use this command to ask Git what rule is causing this ignore:

$ git check-ignore -v filename

For instance to see what rule ignores tests.pyc:

@jamischarles
jamischarles / .npm_install_autocomplete_bash
Last active Jul 13, 2016
npm install autocompletion for bash. Provides content of `~/.npm` as autocomplete options for `npm install` https://medium.com/@jamischarles/adding-autocomplete-to-npm-install-5efd3c424067#.8w0jzkh3w
View .npm_install_autocomplete_bash
#!/usr/bin/env bash #adding this to force silly gist highlighting. REMOVE THIS
# BASH standalone npm install autocomplete. Add this to ~/.bashrc file.
_npm_install_completion () {
local words cword
if type _get_comp_words_by_ref &>/dev/null; then
_get_comp_words_by_ref -n = -n @ -w words -i cword
else
cword="$COMP_CWORD"
words=("${COMP_WORDS[@]}")
@nepsilon
nepsilon / git-grep-code.md
Last active Nov 22, 2016
How to grep search committed code in git? — First published on fullweb.io issue #47
View git-grep-code.md

How to grep search committed code in git?

Search working tree for text matching regular expression regexp:

git grep regexp 

Search working tree for lines of text matching regexp A or B:

git grep -e A --or -e B 
@nepsilon
nepsilon / a-better-setup-for-git.md
Last active Oct 19, 2020
A better setup for Git — First published in fullweb.io issue #46
View a-better-setup-for-git.md

A better setup for Git

Git default configuration is good but it can be personalized to improve your workflow efficiency. Here are some good lines to put in your ~/.gitconfig:

# The basics, who you commit as:
[user]
  name = John Doe
  email = john@doe.org
@nepsilon
nepsilon / comm-cli-tip.md
Last active Feb 19, 2017
CLI: Output the difference between 2 files — First published on fullweb.io issue #43
View comm-cli-tip.md

CLI: Output the difference between 2 files

Thinking of using diff? Try comm, its sole purpose is to compare 2 sorted files line by line.

Show lines in A.txt but NOT in B.txt:

comm -2 -3 A.txt B.txt

If the files aren’t sorted, use:

@nepsilon
nepsilon / cron-tips.md
Last active Jul 7, 2017
Better using Crontab — First published in fullweb.io issue #42
View cron-tips.md

Better using Crontab

Here are a few tips to get more out of Cron:

  • Test your scripts using Cron limited environment
  • Have it send you report to another email than root@locahost
  • Make it use another shell.
# Cron only provides a limited environment.
# To simulate it to test run your scripts
@squarism
squarism / iterm2.md
Last active Jan 17, 2022
An iTerm2 Cheatsheet
View iterm2.md

Tabs and Windows

Function Shortcut
New Tab + T
Close Tab or Window + W (same as many mac apps)
Go to Tab + Number Key (ie: ⌘2 is 2nd tab)
Go to Split Pane by Direction + Option + Arrow Key
Cycle iTerm Windows + backtick (true of all mac apps and works with desktops/mission control)