Skip to content

Instantly share code, notes, and snippets.

View nnja's full-sized avatar
🐝
I'm a busy bee and may be slow to respond.

Nina Zakharenko nnja

🐝
I'm a busy bee and may be slow to respond.
View GitHub Profile
@nnja
nnja / less.md
Created October 5, 2017 04:54
A cheatsheet for using less on the command line

Tips for using less on the command line.

To navigate:

  • f = for next page
  • b = for previous page

To search:

  • /<query>
@nnja
nnja / aliases.sh
Created October 2, 2017 01:46
Command line aliases for git
alias ga='git add'
alias gp='git push'
alias gpu='git pull'
alias gs='git status'
alias gd='git diff'
alias gds='git diff --staged'
alias gm='git commit -m'
alias gc='git checkout'
@nnja
nnja / post-merge
Created October 2, 2017 01:19
Git Hook: Example post-merge hook that checks for updates to requirements.txt
#!/usr/bin/env python
import sys
import subprocess
diff_requirements = 'git diff ORIG_HEAD HEAD --exit-code -- requirements.txt'
exit_code = subprocess.call(diff_requirements.split())
if exit_code == 1:
print 'The requirements file has changed! Remember to install new dependencies.'
else:
@nnja
nnja / install-git-completion.md
Created September 22, 2017 04:33
Installing Git Completion

Attribution: These instructions are borrowed from bobthecow.

OS X / macOS

By far the easiest way to install both Git and git-completion is via Homebrew, so you should pick that one.

Homebrew

  1. Install homebrew
@nnja
nnja / ipython_info.py
Created March 16, 2017 20:32
Print IPython Version and Executable
import os, sys, IPython
print(os.environ['VIRTUAL_ENV'])
print(sys.executable)
print(IPython.__file__)
print(sys.path)
@nnja
nnja / gist:4c61ae4410f2295db2ed81c740c30019
Created March 13, 2017 21:05
Update SSH_AUTH_SOCK in tmux session
alias fixssh='eval $(tmux showenv -s SSH_AUTH_SOCK)'
Or for tmux that does not have showenv -s:
alias fixssh='export $(tmux showenv SSH_AUTH_SOCK)'
@nnja
nnja / init-osx.el
Created December 10, 2016 00:14
emacs config for playing nicely with osx
;;; OSX specific settings
;;; Borrowed heavily from https://github.com/rejeep/emacs
(defun live-copy-from-osx ()
(shell-command-to-string "pbpaste"))
(defun live-paste-to-osx (text &optional push)
(let ((process-connection-type nil))
(let ((proc (start-process "pbcopy" "*Messages*" "pbcopy")))
(process-send-string proc text)
@nnja
nnja / pr.md
Created November 3, 2016 16:27 — forked from piscisaureus/pr.md
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = [email protected]:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

@nnja
nnja / gist:9136152c163091614e70defcf3753d06
Created May 26, 2016 20:25
How to access the raw markdown source for a github wiki page
https://raw.github.com/wiki/user/repo/page.md?login=login&token=token
@nnja
nnja / how-to-rebase.md
Created May 26, 2016 20:24
How to Rebase

When many different people are working on a project simultaneously, pull requests can go stale quickly. A "stale" pull request is one that is no longer up to date with the main line of development, and it needs to be updated before it can be merged into the project. The most common reason why pull requests go stale is due to conflicts: if two pull requests both modify similar lines in the same file, and one pull request gets merged, the unmerged pull request will now have a conflict. Sometimes, a pull request can go stale without conflicts: perhaps changes in a different file in the codebase require corresponding changes in your pull request to conform to the new architecture, or perhaps the branch was created when someone had accidentally merged failing unit tests to the master branch. Regardless of the reason, if your pull request has gone stale, you will need to rebase your branch onto the latest version of the master branch before it can be merged.

What is a rebase?