| @@ -1,18 +1,3 @@ | |||
| .vagrant | |||
| .checksum | |||
| common/.profile | |||
| git/.gitconfig | |||
| emacs/.emacs.d/workgroups | |||
| emacs/.emacs.d/desktop | |||
| emacs/.emacs.d/ac-comphist.dat | |||
| emacs/.emacs.d/elpa | |||
| emacs/.emacs.d/emacs.el | |||
| emacs/.emacs.d/emacs.elc | |||
| emacs/.emacs.d/url | |||
| emacs/.emacs.d/.emacs.desktop.lock | |||
| emacs/.emacs.d/tramp | |||
| emacs/.emacs.d/projectile-bookmarks.eld | |||
| emacs/.emacs.d/.python-environments | |||
| last | |||
| .last | |||
| tmp | |||
| generation | |||
| @@ -2,11 +2,11 @@ | |||
| # outside of emacs. | |||
| .PHONY: tangle tangle-next | |||
| DEST:=$(HOME) | |||
| LAST:=$(shell cat last || echo 0) | |||
| LAST:=$(shell cat .last || echo 0) | |||
| NEXT:=$(shell l=$(LAST); ((l=l+1)); echo $$l) | |||
| NEXTGEN:=$(PWD)/generation/$(NEXT) | |||
| LASTGEN:=$(PWD)/generation/$(LAST) | |||
| TANGLERS:=readme.org | |||
| TANGLERS:=readme.org emacs.org | |||
| GEN:=$(LAST) | |||
| OPTIONS:= | |||
| @@ -46,7 +46,7 @@ tangle-next: | |||
| $(MAKE) generation | |||
| $(MAKE) next | |||
| $(MAKE) copy GEN=$(NEXT) | |||
| @echo $(NEXT) > last | |||
| @echo $(NEXT) > .last | |||
| copy: | |||
| cd $(PWD)/generation/$(GEN) && find . -type f -exec rm -f $(DEST)/{} \; | |||
| @@ -54,10 +54,11 @@ copy: | |||
| tangle: tmp | |||
| /usr/bin/env emacs --script ./etangle $(TANGLERS) | |||
| /usr/bin/env emacs --script (byte-compile-file (concat user-emacs-directory "init.el") | |||
| @echo | |||
| clean: | |||
| -rm -fr tmp | |||
| nuke: clean | |||
| -rm -fr last generation | |||
| -rm -fr .last generation | |||
| @@ -1,14 +0,0 @@ | |||
| # common/.profile.d/00-prelude.sh | |||
| # -*- mode: Shell-script; -*- | |||
| # Common .profile | |||
| # | |||
| # This file is generated from dotdee and managed from stow. | |||
| # | |||
| # Manual editing discouraged. | |||
| # Common variables for use later | |||
| _uname=$(uname) | |||
| _uname_n=$(uname -n) | |||
| _hostname=$(hostname) | |||
| export _uname _uname_n _hostname | |||
| @@ -1,3 +0,0 @@ | |||
| # common/.profile.d/01-ps1.sh | |||
| # Default if not already overridden | |||
| _host=${_host:=${_uname_n}} | |||
| @@ -1,3 +0,0 @@ | |||
| # common/.profile.d/10-path.sh | |||
| PATH="${PATH}:${HOME}/bin" | |||
| export PATH | |||
| @@ -1,42 +0,0 @@ | |||
| # common/.profile.d/20-functions-path.sh | |||
| # cat out a : separated env variable | |||
| # variable is the parameter | |||
| cat_env() | |||
| { | |||
| set | grep '^'"$1"'=' > /dev/null 2>&1 && eval "echo \$$1" | tr ':' ' | |||
| ' | awk '!/^\s+$/' | awk '!/^$/' | |||
| } | |||
| # Convert a line delimited input to : delimited | |||
| to_env() | |||
| { | |||
| awk '!a[$0]++' < /dev/stdin | tr -s ' | |||
| ' ':' | sed -e 's/\:$//' | awk 'NF > 0' | |||
| } | |||
| # Unshift a new value onto the env var | |||
| # first arg is ENV second is value to unshift | |||
| # basically prepend value to the ENV variable | |||
| unshift_env() | |||
| { | |||
| new=$(eval "echo $2; echo \$$1" | to_env) | |||
| eval "$1=${new}; export $1" | |||
| } | |||
| # Opposite of above, but echos what was shifted off | |||
| shift_env() | |||
| { | |||
| first=$(cat_env "$1" | head -n 1) | |||
| rest=$(cat_env "$1" | awk '{if (NR!=1) {print}}' | to_env) | |||
| eval "$1=$rest; export $1" | |||
| echo "${first}" | |||
| } | |||
| # push $2 to $1 on the variable | |||
| push_env() | |||
| { | |||
| have=$(cat_env "$1") | |||
| new=$(printf "%s | |||
| %s" "$have" "$2" | to_env) | |||
| eval "$1=$new; export $1" | |||
| } | |||
| @@ -1,92 +0,0 @@ | |||
| # common/.profile.d/20-functions.sh | |||
| # Remove a line matched in $HOME/.ssh/known_hosts for when there are legit | |||
| # host key changes. | |||
| nukehost() | |||
| { | |||
| if [ -z "$1" ]; then | |||
| echo "Usage: nukehost <hostname>" | |||
| echo " Removes <hostname> from ssh known_host file." | |||
| else | |||
| sed -i -e "/$1/d" ~/.ssh/known_hosts | |||
| fi | |||
| } | |||
| # Cheap copy function to make copying a file via ssh from one host | |||
| # to another less painful, use pipeviewer to give some idea as to progress. | |||
| ssh-copyfile() | |||
| { | |||
| if [ -z "$1" -o -z "$2" ]; then | |||
| echo "Usage: copy source:/file/location destination:/file/location" | |||
| else | |||
| srchost="$(echo "$1" | awk -F: '{print $1}')" | |||
| src="$(echo "$1" | awk -F: '{print $2}')" | |||
| dsthost="$(echo "$2" | awk -F: '{print $1}')" | |||
| dst="$(echo "$2" | awk -F: '{print $2}')" | |||
| size=$(ssh "$srchost" du -hs "$src" 2> /dev/null) | |||
| size=$(echo "${size}" | awk '{print $1}') | |||
| echo "Copying $size to $dst" | |||
| ssh "$srchost" "/bin/cat \$src" 2> /dev/null | pv -cb -N copied - | ssh "$dsthost" "/bin/cat - > \$dst" 2> /dev/null | |||
| fi | |||
| } | |||
| # extract function to automate being lazy at extracting archives. | |||
| extract() | |||
| { | |||
| if [ -f "$1" ]; then | |||
| case ${1} in | |||
| *.tar.bz2|*.tbz2|*.tbz) bunzip2 -c "$1" | tar xvf -;; | |||
| *.tar.gz|*.tgz) gunzip -c "$1" | tar xvf -;; | |||
| *.tz|*.tar.z) zcat "$1" | tar xvf -;; | |||
| *.tar.xz|*.txz|*.tpxz) xz -d -c "$1" | tar xvf -;; | |||
| *.bz2) bunzip2 "$1";; | |||
| *.gz) gunzip "$1";; | |||
| *.jar|*.zip) unzip "$1";; | |||
| *.rar) unrar x "$1";; | |||
| *.tar) tar -xvf "$1";; | |||
| *.z) uncompress "$1";; | |||
| *.rpm) rpm2cpio "$1" | cpio -idv;; | |||
| *) echo "Unable to extract <$1> Unknown extension." | |||
| esac | |||
| else | |||
| print "File <$1> does not exist." | |||
| fi | |||
| } | |||
| # Tcsh compatibility so I can be a lazy bastard and paste things directly | |||
| # if/when I need to. | |||
| setenv() | |||
| { | |||
| export "$1=$2" | |||
| } | |||
| # Just to be lazy, set/unset the DEBUG env variable used in my scripts | |||
| debug() | |||
| { | |||
| if [ -z "$DEBUG" ]; then | |||
| if [ -z "$1" ]; then | |||
| echo Setting DEBUG to "$1" | |||
| setenv DEBUG "$1" | |||
| else | |||
| echo Setting DEBUG to default | |||
| setenv DEBUG default | |||
| fi | |||
| else | |||
| echo Unsetting DEBUG | |||
| unset DEBUG | |||
| fi | |||
| } | |||
| login_shell() | |||
| { | |||
| [ "$-" = "*i*" ] | |||
| } | |||
| # Yeah, sick of using the web browser for this crap | |||
| # Use is NUM FROM TO and boom get the currency converted from goggle. | |||
| cconv() | |||
| { | |||
| curl -L --silent\ | |||
| "https://www.google.com/finance/converter?a=$1&from=$2&to=$3" \ | |||
| | grep converter_result \ | |||
| | perl -pe 's|[<]\w+ \w+[=]\w+[>]||g;' -e 's|[<][/]span[>]||' | |||
| } | |||
| @@ -1,17 +0,0 @@ | |||
| # common/.profile.d/99-alias.sh | |||
| alias s="\$(which ssh)" | |||
| alias quit='exit' | |||
| alias cr='reset; clear' | |||
| alias a=ag | |||
| alias n=noglob | |||
| alias l=ls | |||
| alias L='ls -dal' | |||
| alias cleandir="find . -type f \( -name '*~' -o -name '#*#' -o -name '.*~' -o -name '.#*#' -o -name 'core' -o -name 'dead.letter*' \) | grep -v auto-save-list | xargs -t rm" | |||
| # Prefer less for paging duties. | |||
| which less > /dev/null 2>&1 | |||
| if [ $? -eq 0 ]; then | |||
| alias T="\$(which less) -f +F" | |||
| else | |||
| alias T="\$(which tail) -f" | |||
| fi | |||
| @@ -1,43 +1,9 @@ | |||
| #+BABEL: :cache yes | |||
| #+PROPERTY: header-args :tangle yes :comments no | |||
| #+TITLE: Emacs Configuration | |||
| #+AUTHOR: Mitch Tishmack | |||
| #+STARTUP: hidestars | |||
| #+STARTUP: odd | |||
| * readme | |||
| This is my emacs configuration file. I don't encourage anyone to use this verbatim, | |||
| but if you wanted to this is how you would do so: | |||
| *** Clone this repo | |||
| #+BEGIN_SRC sh :tangle no | |||
| git clone https://github.com/mitchty/dotfiles | |||
| #+END_SRC | |||
| *** Preferably backup your emacs configuration | |||
| Always good to back things up, just in case you hate how I did things. | |||
| #+BEGIN_SRC sh :tangle no | |||
| tar cvf ~/.emacs-backup.tar ~/.emacs.d ~/.emacs | |||
| #+END_SRC | |||
| *** Remove/move your old configuration | |||
| This is up to you to do right, just an example. | |||
| #+BEGIN_SRC sh :tangle no | |||
| rm -fr ~/.emacs.d ~/.emacs | |||
| #+END_SRC | |||
| *** Lastly copy necessary files | |||
| #+BEGIN_SRC sh :tangle no | |||
| mkdir ~/.emacs.d | |||
| cp dotfiles/init.el dotfiles/emacs.org ~/.emacs.d | |||
| #+END_SRC | |||
| #+BABEL: :cache yes | |||
| #+PROPERTY: header-args :tangle tmp/.emacs.d/init.el :cache yes :padline no :mkdirp yes :comments no | |||
| * prelude | |||
| @@ -85,18 +51,18 @@ This configuration is using *use-package* extensively. Install it straight away. | |||
| ) | |||
| #+END_SRC | |||
| *** always babel tangle and byte compile emacs.org | |||
| *** always babel tangle and byte compile emacs.org to init.el | |||
| Add a save hook to always tangle and byte compile emacs.org file when we save it. | |||
| #+BEGIN_SRC emacs-lisp | |||
| #+BEGIN_SRC emacs-lisp :tangle no | |||
| (defun tangle-init () | |||
| "If the current buffer is 'emacs.org' the code-blocks are | |||
| tangled, and the tangled file is compiled." | |||
| (when (string/ends-with (buffer-file-name) ".emacs.d/emacs.org") | |||
| (let ((prog-mode-hook nil)) | |||
| (org-babel-tangle) | |||
| (byte-compile-file (concat user-emacs-directory "emacs.el"))) | |||
| (byte-compile-file (concat user-emacs-directory "init.el"))) | |||
| ) | |||
| ) | |||
| @@ -1,5 +0,0 @@ | |||
| ;;-*-mode: emacs-lisp; coding: utf-8;-*- | |||
| ;; I'm normally just using recent emacs here, so a basic org mode is | |||
| ;; already installed. Makes this even simpler. | |||
| (require 'org) | |||
| (org-babel-load-file "~/.emacs.d/emacs.org") | |||
| @@ -1,8 +0,0 @@ | |||
| # emacs/.profile.d/99-alias-emacs.sh | |||
| alias e=emacs | |||
| alias de=emacs --debug-init -nw | |||
| alias ec=emacsclient | |||
| alias ect=emacsclient -t | |||
| alias oec=emacsclient -n -c | |||
| alias stope=emacsclient -t -e "(save-buffers-kill-emacs)(kill-emacs)" | |||
| alias kille=emacsclient -e "(kill-emacs)" | |||
| @@ -1,3 +1,5 @@ | |||
| ;;-*-mode: emacs-lisp; coding: utf-8;-*- | |||
| ;; Copyright: 2016 Mitchell Tishmack | |||
| ;; Tangle an org mode file with babel using emacs. | |||
| (let ((default-directory "~/.emacs.d")) | |||
| (normal-top-level-add-subdirs-to-load-path)) | |||
| @@ -21,4 +21,3 @@ | |||
| ;; Language specific | |||
| (setq haskell-p nil) | |||
| (setq perl-p nil) | |||
| (setq ruby-p nil) | |||
| @@ -21,4 +21,3 @@ | |||
| ;; Language specific | |||
| (setq haskell-p t) | |||
| (setq perl-p t) | |||
| (setq ruby-p nil) | |||
| @@ -1,17 +1,17 @@ | |||
| #+TITLE: Dotfiles Everywhere | |||
| #+TITLE: My Solution To Dotfile Management | |||
| #+AUTHOR: Mitch Tishmack | |||
| #+STARTUP: hidestars | |||
| #+STARTUP: odd | |||
| #+BABEL: :cache yes | |||
| #+PROPERTY: header-args :tangle yes :comments no :padline no | |||
| #+PROPERTY: header-args :tangle yes :cache yes :comments no :padline no | |||
| In the long long ago (2015), I used xstow and update-dotdee to construct my | |||
| dotfiles from tiny pieces of files. | |||
| I have since evolved to this setup. Originally the intention was to make it easy | |||
| for me to compile dotfiles based on certain parameters. Aka, my dotfiles are the | |||
| same for x, y, and z, whatever those are, but for certain cases z should have | |||
| one section be different or added etc... as the case may be. | |||
| I have since evolved to this setup. Originally the intention was to make it | |||
| easy for me to compile dotfiles based on certain parameters. Aka, my dotfiles | |||
| are the same for x, y, and z, whatever those are, but for certain cases z | |||
| should have one section be different or added etc... as the case may be. | |||
| Aka it was just a glorified program or templating system. | |||
| @@ -20,34 +20,57 @@ why not just do the same for the dotfiles. Bonus, now I can have ALL | |||
| my dotfiles in one logical file that can build itself. | |||
| So now if you want to look at my dotfiles, they're all in here. With one | |||
| caveat that my emacs configuration is not. That is still separate, I might | |||
| change that at some point in the future, but that day is not today. | |||
| caveat that my emacs configuration is not. That is still separate. Mostly | |||
| because it is large enough that it can be on its own. | |||
| * Use | |||
| * Use/Abuse | |||
| Use of this setup is simple. There really is one step: | |||
| - make | |||
| Use of this setup is simple. There really is one step in general: | |||
| ??? HOW ??? | |||
| #+BEGIN_SRC sh :tangle no | |||
| make | |||
| #+END_SRC | |||
| But lets say you want to export things to another directory than $HOME. No | |||
| worries, just specify DEST: | |||
| #+BEGIN_SRC sh :tangle no | |||
| make DEST=/some/other/directory | |||
| #+END_SRC | |||
| But wait, what if you want to export things for an os you're not using? No | |||
| worries, just copy options.el to name.el and specify that as OPTIONS too: | |||
| #+BEGIN_SRC sh :tangle no | |||
| make DEST=/some/other/directory OPTIONS=osx | |||
| #+END_SRC | |||
| Well the Makefile is pretty basic, start there. But generally here is how | |||
| the sausage is being made. | |||
| Want to copy a specific generation to somewhere else? Or maybe you tested | |||
| installing to some DEST, and want to copy that to $HOME? No worries: | |||
| There are a couple helper scripts: | |||
| - etangle, aka emacs tangle, which is just a wrapper around emacs+org for | |||
| the commandline/makefile to use. | |||
| - ddiff, a rather stupid shell script that recursively diffs directory a | |||
| to directory b, ignoring files that do not exist in directory b but | |||
| exist in a (aka new files). | |||
| #+BEGIN_SRC sh :tangle no | |||
| make copy GEN=N | |||
| #+END_SRC | |||
| Where N is the generation you want to copy. | |||
| ** How does it work? | |||
| It is really rather simple, the makefile isn't that complex. Look at that | |||
| for details. | |||
| NOTE: Removal of files is YOUR job, not this thing. One could | |||
| This isn't intended to cover everything. This could be considered a template | |||
| for how you could setup your files in a similar way. Look at this org mode | |||
| file for details. | |||
| NOTE: Removal of files is YOUR job, not this tools. One could | |||
| theoretically look at what changed between two generations and | |||
| remove that. BUT that sounds janky and error prone. Removal of | |||
| remove that way. BUT that sounds janky and error prone. Removal of | |||
| files is the users job, not this setup. | |||
| ** Explanation of what is happening | |||
| The prelude controls org variables that change how files get tangled to files. | |||
| The file options.el controls predicates that change how files get tangled to files. | |||
| This allows me to tangle files that would be useful for linux/bsd/etc... | |||
| without affecting the existing files. | |||
| @@ -66,7 +89,49 @@ The general idea is this (look at Makefile for details): | |||
| Note, the destination can be anywhere, not just $HOME. This allows one to | |||
| compile/tangle files that can then be trivially rsynced to remote machines, | |||
| or to tar/xz the files as needed. The key here is emacs is only required | |||
| to generate config files. | |||
| to generate config files, not necessarily to use them. | |||
| ** How would I use this? | |||
| Should be easy enough to either clone this repo or copy things to a new repo | |||
| and hack in what you need. Your call. | |||
| But, say you have a heading, take .profile which comes up next, under the | |||
| heading you would just add: | |||
| #+BEGIN_SRC org :tangle no | |||
| :PROPERTIES: | |||
| :header-args: :tangle tmp/.profile :comments no :padline no :cache yes :mkdirp yes | |||
| :END: | |||
| #+END_SRC | |||
| Then any source blocks for that heading will go to tmp/.profile. Its important | |||
| that you put everything into ./tmp! This is used to generate things before a | |||
| generation is built. It gives the Makefile a chance to know if the tangling | |||
| worked or not. | |||
| But lets say you don't need to have lots of sub headings, or even control | |||
| a file in multiple subparts that have predicates to control things. | |||
| Pretty simple, just add a source block like normal: | |||
| #+BEGIN_SRC org :tangle no | |||
| ,#+BEGIN_SRC conf :tangle tmp/.example.conf | |||
| put contents here! | |||
| ,#+END_SRC | |||
| #+END_SRC | |||
| ** TODO | |||
| - [ ] Auto load-file options.el to make code blocks editable in their major | |||
| modes. | |||
| - [ ] Need to have some way to autocleanup old generations. Rm works for now | |||
| so meh. | |||
| - [ ] Need to add the ability to detect that make is generating a pointless | |||
| new generation. Aka generation N and generation N-1 are the same, just leave | |||
| N and don't increment. | |||
| - [ ] Maybe checksum file contents somehow and use that? | |||
| - [ ] More? For now its functional. | |||
| * ~/.profile | |||
| :PROPERTIES: | |||
| @@ -76,14 +141,14 @@ to generate config files. | |||
| ** PS1 | |||
| #+BEGIN_SRC sh | |||
| # -*- mode: Shell-script; -*- | |||
| # Common .profile | |||
| # | |||
| # DO NOT EDIT, managed by org mode | |||
| _uname=$(uname) | |||
| _uname_n=$(uname -n) | |||
| _hostname=$(hostname) | |||
| export _uname _uname_n _hostname | |||
| # -*- mode: Shell-script; -*- | |||
| # Common .profile | |||
| # | |||
| # DO NOT EDIT, managed by org mode | |||
| _uname=$(uname) | |||
| _uname_n=$(uname -n) | |||
| _hostname=$(hostname) | |||
| export _uname _uname_n _hostname | |||
| #+END_SRC | |||
| OSX uses hostname -s for getting hostname | |||
| @@ -417,6 +482,14 @@ if [ $? -eq 0 ]; then | |||
| else | |||
| alias T="\$(which tail) -f" | |||
| fi | |||
| alias e=emacs | |||
| alias de=emacs --debug-init -nw | |||
| alias ec=emacsclient | |||
| alias ect=emacsclient -t | |||
| alias oec=emacsclient -n -c | |||
| alias stope=emacsclient -t -e "(save-buffers-kill-emacs)(kill-emacs)" | |||
| alias kille=emacsclient -e "(kill-emacs)" | |||
| #+END_SRC | |||
| *** osx | |||
| @@ -1708,7 +1781,7 @@ rsync \ | |||
| "${base_git}/" "${remote}:${remote_svn}" | |||
| echo "done rsyncing ${base_git} to ${remote}:${remote_svn}" | |||
| #+END_SRC | |||
| * Git | |||
| * git | |||
| ** ~/.gitconfig | |||
| General git configuration. | |||
| @@ -1800,7 +1873,7 @@ Common crap/build artifacts that git should always ignore. | |||
| *.hi | |||
| #+END_SRC | |||
| * X | |||
| * x | |||
| ** ~/.Xdefaults | |||
| X defaults, just urxvt for the moment. Slightly linux/bsd only but not really. | |||
| @@ -1886,7 +1959,7 @@ I can't remember why I did all this effort. But I'll remove it some year I bet. | |||
| *color14: brightcyan | |||
| *color15: #f9f9f9 | |||
| #+END_SRC | |||
| * Zsh | |||
| * zsh | |||
| ** ~/.zprofile | |||
| Make sure that zsh sources ~/.profile correctly on login. | |||
| @@ -2076,7 +2149,7 @@ PROMPT="%(!.#.$) " # $ as a user # as root | |||
| RPROMPT='${vcs_info_msg_0_} ${PWD/#$HOME/~}' | |||
| #+END_SRC | |||
| * Tmux | |||
| * tmux | |||
| ** ~/.tmux.conf | |||
| Tmux configuration. Pretty boring in most ways. | |||
| @@ -2234,7 +2307,7 @@ bind C-y run "tmux save-buffer - | xclip -i" | |||
| # set-option -g status-right-length 55; \ | |||
| # set-option -g status-right '#(rainbarf --remaining --bolt --bright --width 25) %a %H:%M:%S'; " | |||
| #+END_SRC | |||
| * Vim | |||
| * vim | |||
| ** ~/.vimrc | |||
| What remains of my days from being a vim user. | |||
| @@ -1,2 +0,0 @@ | |||
| install: --no-ri --no-rdoc | |||
| update: --no-ri --no-rdoc | |||
| @@ -1,63 +0,0 @@ | |||
| #!/usr/bin/env ruby | |||
| #-*-mode: Ruby; coding: utf-8;-*- | |||
| require 'time' | |||
| Maid.rules do | |||
| RUN_TIME = Time.now | |||
| DAY_SECONDS = 60 * 60 * 24 | |||
| WEEK = DAY_SECONDS * 7 | |||
| ONE_WEEK_AGO = (RUN_TIME - WEEK) | |||
| TWO_WEEKS_AGO = (RUN_TIME - WEEK * 2) | |||
| THREE_MONTHS_AGO = (RUN_TIME - (DAY_SECONDS * 93)) | |||
| # Nuke crap > say 2 weeks should be fine. | |||
| def clean_download_dir | |||
| dir('~/Downloads/*').each do |path| | |||
| trash path if File.mtime(path) < TWO_WEEKS_AGO | |||
| end | |||
| end | |||
| case %x/uname -s/.chomp | |||
| when 'Darwin' | |||
| rule '/Library/Caches/Homebrew/' do | |||
| dir('/Library/Caches/Homebrew/*.tar.*').each do |path| | |||
| trash path if File.mtime(path) < THREE_MONTHS_AGO | |||
| end | |||
| dir('/Library/Caches/Homebrew/*.tgz').each do |path| | |||
| trash path if File.mtime(path) < THREE_MONTHS_AGO | |||
| end | |||
| dir('/Library/Caches/Homebrew/*.tbz').each do |path| | |||
| trash path if File.mtime(path) < THREE_MONTHS_AGO | |||
| end | |||
| dir('/Library/Caches/Homebrew/*.bz2').each do |path| | |||
| trash path if File.mtime(path) < THREE_MONTHS_AGO | |||
| end | |||
| dir('/Library/Caches/Homebrew/*.gz').each do |path| | |||
| trash path if File.mtime(path) < THREE_MONTHS_AGO | |||
| end | |||
| dir('/Library/Caches/Homebrew/*.xz').each do |path| | |||
| trash path if File.mtime(path) < THREE_MONTHS_AGO | |||
| end | |||
| end | |||
| rule '~/Downloads' do | |||
| clean_download_dir | |||
| end | |||
| rule '~/Library/Caches' do | |||
| dir('~/Library/Caches/Google/Chrome/Default/Cache/*').each do |path| | |||
| trash path if File.mtime(path) < THREE_MONTHS_AGO | |||
| end | |||
| dir('~/Library/Caches/Google/Chrome/PnaclTranslationCache/*').each do |path| | |||
| trash path if File.mtime(path) < THREE_MONTHS_AGO | |||
| end | |||
| dir('~/Library/Caches/Firefox/Profiles/*.default/Cache/*').each do |path| | |||
| trash path if File.mtime(path) < THREE_MONTHS_AGO | |||
| end | |||
| end | |||
| when 'Linux' | |||
| rule 'Clean Download dir' do | |||
| clean_download_dir | |||
| end | |||
| end | |||
| end | |||
| @@ -1,2 +0,0 @@ | |||
| # ruby/.profile.d/99-alias-ruby.sh | |||
| alias r=ruby | |||
| @@ -1,19 +0,0 @@ | |||
| #-*-mode: Ruby; coding: utf-8;-*- | |||
| Pry.config.prompt = [ | |||
| proc {|obj, nesting, _| | |||
| nesting == 0 ? "#{obj}> " : "#{obj}:#{nesting}> " | |||
| }, | |||
| proc {''} | |||
| ] | |||
| def load_pry_debugstuff | |||
| if Gem::Specification::find_all_by_name('pry-debugger').size > 0 | |||
| require 'pry-debugger' | |||
| Pry.commands.alias_command 'c', 'continue' | |||
| Pry.commands.alias_command 's', 'step' | |||
| Pry.commands.alias_command 'n', 'next' | |||
| end | |||
| end | |||
| load_pry_debugstuff | |||