Here is my git cheat sheet ! Because I don’t like git I never remember how to do X or Y with it so I need to write down simple commands ! (I am used to darcs and mercurial but with the “git trend” I need to learn it and use it).
Undo uncommited changes on a tracked file
$ git reset --hard
Get the latest version before working
$ git pull
Make a commit containing all tracked files
$ git commit -m "Commit message" -a
Send the commit to the repository
$ git push
I am learning mutt and I am lost. If you are like me, you may like the following cheat sheet!
I am using it through imap, it may be different with local mailbox.
Case is important !
- Change folder : Y
- Filter the display : l (for limit) and then a filter like this
- ~d <2w : ~d for date and <2w for “less than 2 weeks” no space in <2w !
- ~b “hello mate” : ~b is for body and the string is something to find in the body
- ~f email@example.com : ~f for from and you can make an expression
- ~s “Urgent” : ~s stands for subject and use a pattern
- Delete messages with filter : D with a filter, if you used limit before it will propose by default the filter of limit
- Delete a message : d (it will be marked as Deleted)
Deleted messages will be removed when you change the folder or if you exit. Pressing $ can do it manually.
I may add new things in the future, as they come for me, if I find new features useful.
How to repeat a command n time
repeat 5 curl http://localhost/counter_add.php
How to expand recursively
If you want to find every file ending by .lisp in the folder and subfolder you can use the following syntax. Using ****** inside a pattern while do a recursive globbing.
Work with temp files
If you want to work on some command outputs without having to manage temporary files, zsh can do it for you with the following syntax: =(command that produces stdout).
In the example we will use emacs to open the list of the files in our personal folder.
emacs =(find ~ -type f)
This syntax will produce a temp file that will be removed when emacs exits.
here is my ~/.zshrc, very simple (I didn’t pasted the aliases I have), I have a 1000 lines history that skips duplicates.
HISTFILE=~/.histfile HISTSIZE=1000 SAVEHIST=1000 setopt hist_ignore_all_dups setopt appendhistory bindkey -e zstyle :compinstall filename '/home/solene/.zshrc' autoload -Uz compinit compinit export LANGUAGE=fr_FR.UTF-8 export LANG=fr_FR.UTF-8 export LC_ALL=fr_FR.UTF-8 export LC_CTYPE=fr_FR.UTF-8 export LC_MESSAGES=fr_FR.UTF-8
Here is a dump of my emacs config file. That may be useful for some emacs users who begin.
If you doesn’t want to have your_filename.txt~ files with a tilde at the end (this is a default backup file), add this
; I don't want to have backup files everywhere with filename~ name (setq backup-inhibited t) (setq auto-save-default nil)
To have parenthesis highlighting on match, which is very useful, you will need this
; show match parenthesis (show-paren-mode 1)
I really like this one. It will save the cursor position in every file you edit. When you edit it again, you start exactly where you leaved the last time.
; keep the position of the cursor after editing (setq save-place-file "~/.emacs.d/saveplace") (setq-default save-place t) (require 'saveplace)`
If you write in utf–8 (which is very common now) you should add this.
; utf8 (prefer-coding-system 'utf-8)
Emacs modes are used depending on the extension of a file. Sometime you need to edit files with a custom extension but you want to use a mode for it. So, you just need to add some line like this to get your mode automatically when you load the file.
; associate extension - mode (add-to-list 'auto-mode-alist '("\\.md\\'" . markdown-mode)) (add-to-list 'auto-mode-alist '("\\.tpl$" . html-mode))
My Org-mode part in the config file
(require 'org) (define-key global-map "\C-ca" 'org-agenda) (setq org-log-done t) (setq org-agenda-files (list "~/Org/work.org" "~/Org/home.org"))
Stop mixing tabs and space when indenting
(setq indent-tabs-mode nil)