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 / 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 / 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 / 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 / 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 / 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 / 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 / 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 / config-editor.md
Created October 5, 2017 05:00
Configure git editor

Set which editor git should use.

This is the program that will open during a commit with no -m flag, a merge, a rebase, etc...

Select from any installed editor. Examples:

  • emacs: emacs
  • vi: vi or vim
@nnja
nnja / pretty-log-alias.md
Created October 5, 2017 05:38
Create an alias for pretty logs

Set up a pretty git log

run:

git config --global alias.lg "log --graph --pretty=format:'%C(auto)%h -%d %s %Cgreen(%cr) %C(bold blue)<%an>%Creset'"

to use:

git lg