| @@ -1,6 +1,5 @@ | |||
| # Makefile is here to make it possible to use this whole shebang | |||
| # outside of emacs. | |||
| .PHONY: tangle tangle-next | |||
| DEST:=$(HOME) | |||
| LAST:=$(shell cat .last || echo 0) | |||
| NEXT:=$(shell l=$(LAST); ((l=l+1)); echo $$l) | |||
| @@ -8,7 +7,10 @@ NEXTGEN:=$(PWD)/generation/$(NEXT) | |||
| LASTGEN:=$(PWD)/generation/$(LAST) | |||
| TANGLERS:=$(shell ls -d *.org) | |||
| GEN:=$(LAST) | |||
| OPTIONS:= | |||
| OPTS:= | |||
| HOST:=$(shell uname -n) | |||
| USEROPTS:=$(OPTS):$(HOST) | |||
| NAME:=default | |||
| INSTALLDIRS=tmp $(NEXTGEN) $(LASTGEN) generation/$(GEN) | |||
| @@ -27,6 +29,7 @@ diff: generation/$(GEN) | |||
| next: diff | |||
| .PHONY: tangle-next | |||
| tangle-next: | |||
| $(MAKE) tangle | |||
| $(MAKE) generation | |||
| @@ -38,12 +41,17 @@ copy: | |||
| cd $(PWD)/generation/$(GEN) && find . -type f -exec rm -f $(DEST)/{} \; | |||
| cd $(PWD)/generation/$(GEN) && cp -r . $(DEST) | |||
| .PHONY: tangle | |||
| tangle: tmp | |||
| /usr/bin/env emacs --script ./etangle $(TANGLERS) | |||
| @echo | |||
| USEROPTS=$(USEROPTS) /usr/bin/env emacs --script ./etangle $(TANGLERS) | |||
| clean: | |||
| -rm -fr tmp | |||
| nuke: clean | |||
| -rm -fr .last generation | |||
| .PHONY: option | |||
| option: | |||
| echo "(setq $(NAME)-p t)" > options/$(NAME).el | |||
| echo "(setq $(NAME)-p nil)" > options/no-$(NAME).el | |||
| @@ -3,17 +3,21 @@ | |||
| #+STARTUP: hidestars | |||
| #+STARTUP: odd | |||
| #+BABEL: :cache yes | |||
| #+PROPERTY: header-args :cache yes :padline no :mkdirp yes :comments no | |||
| #+PROPERTY: header-args :cache yes | |||
| #+PROPERTY: header-args :padline no | |||
| #+PROPERTY: header-args :mkdirp yes | |||
| #+PROPERTY: header-args :comments no | |||
| #+PROPERTY: header-args :replace yes | |||
| #+PROPERTY: header-args :tangle-mode (identity #o755) | |||
| ~/bin files and other shenanigans | |||
| * ~/bin/cidr | |||
| A stupid script I wrote ages ago to help me be lazy with cidr | |||
| notation for stuff. Setup the wrong netmask a few times and | |||
| you too, will wish for something similar. | |||
| #+BEGIN_SRC perl :mkdirp yes :tangle tmp/bin/cidr :results replace :tangle-mode (identity #o755) | |||
| #+BEGIN_SRC perl :tangle tmp/bin/cidr | |||
| #!/usr/bin/env perl | |||
| # | |||
| # Convert input ip/cidr|netmask|hexnetmask to useable network information. | |||
| @@ -159,7 +163,6 @@ foreach my $arg (@ARGV){ | |||
| #+END_SRC | |||
| * ~/bin/dns | |||
| Just a silly dns script that slighly mimics the old host utility | |||
| of yore. Can also do reverse lookups. | |||
| @@ -171,7 +174,7 @@ $ dns 216.58.216.206 | |||
| ord31s21-in-f206.1e100.net is 216.58.216.206 | |||
| ord31s21-in-f206.1e100.net is also ord31s21-in-f206.1e100.net | |||
| #+BEGIN_SRC perl :mkdirp yes :tangle tmp/bin/dns :results replace :tangle-mode (identity #o755) | |||
| #+BEGIN_SRC perl :tangle tmp/bin/dns | |||
| #!/usr/bin/env perl | |||
| # | |||
| # Stupid script to help with dns information. Solaris 9/8 lack the host utility. | |||
| @@ -211,10 +214,9 @@ exit 0; | |||
| #+END_SRC | |||
| * ~/bin/ts | |||
| Stupid simple timestamp script that just takes input, and prefixes a timestamp to to output. Thats it. | |||
| #+BEGIN_SRC perl :mkdirp yes :tangle tmp/bin/ts :results replace :tangle-mode (identity #o755) | |||
| #+BEGIN_SRC perl :tangle tmp/bin/ts | |||
| #!/usr/bin/env perl | |||
| # | |||
| # Timestamp stdin and then print to stdout and flush. | |||
| @@ -237,7 +239,6 @@ while(<STDIN>){ | |||
| #+END_SRC | |||
| * ~/bin/diskhog | |||
| Old script I wrote after I had to figure out where space was used and it was mostly all in a directory with a ton of small files. | |||
| Written in anger. Not all that useful nominally. | |||
| @@ -264,7 +265,7 @@ $ diskhog -n 4 /tmp | |||
| 420.57k /private/tmp/sysp.xml | |||
| 161.17k /private/tmp/KSOutOfProcessFetcher.12572.ppfIhqX0vjaTSb8AJYobDV7Cu68= | |||
| #+BEGIN_SRC perl :mkdirp yes :tangle tmp/bin/diskhog :results replace :tangle-mode (identity #o755) | |||
| #+BEGIN_SRC perl :tangle tmp/bin/diskhog | |||
| #!/usr/bin/env perl | |||
| # | |||
| # Find out who is hogging disk space and where. | |||
| @@ -419,7 +420,6 @@ if ($debug){ | |||
| #+END_SRC | |||
| * ~/bin/ifinfo | |||
| I don't remember now why I wrote this but its just a simpler view | |||
| of interfaces on a system. | |||
| @@ -433,7 +433,7 @@ bridge100@1500 192.168.64.1/24 a:b:c:d:e:f | |||
| Comes in slightly handy, no guarantees it parses ifconfig right tho. | |||
| #+BEGIN_SRC perl :mkdirp yes :tangle tmp/bin/ifinfo :results replace :tangle-mode (identity #o755) | |||
| #+BEGIN_SRC perl :tangle tmp/bin/ifinfo | |||
| #!/usr/bin/env perl | |||
| # | |||
| # Because ifconfig output is... overly verbose. | |||
| @@ -649,33 +649,33 @@ if (scalar(@output) < 1){ | |||
| Mostly because I use iso8601 timestamps and its nice to use them | |||
| generally without depending on gnu date. | |||
| #+BEGIN_SRC perl :mkdirp yes :tangle tmp/bin/iso8601 :results replace :tangle-mode (identity #o755) | |||
| #!/usr/bin/env perl | |||
| #-*-mode: Perl; coding: utf-8;-*- | |||
| use strict; | |||
| use warnings; | |||
| use POSIX qw(strftime); | |||
| use Getopt::Long; | |||
| my $short = 0; | |||
| GetOptions('short' => \$short, | |||
| 's' => \$short | |||
| ); | |||
| #+BEGIN_SRC perl :tangle tmp/bin/iso8601 | |||
| #!/usr/bin/env perl | |||
| #-*-mode: Perl; coding: utf-8;-*- | |||
| use strict; | |||
| use warnings; | |||
| use POSIX qw(strftime); | |||
| use Getopt::Long; | |||
| my $short = 0; | |||
| GetOptions('short' => \$short, | |||
| 's' => \$short | |||
| ); | |||
| my $now = time; | |||
| if ($short) { | |||
| print strftime('%Y%m%dT%H%M%SZ', (gmtime $now)) . "\n"; | |||
| } else { | |||
| print strftime('%Y-%m-%dT%H:%M:%SZ', (gmtime $now)) . "\n"; | |||
| } | |||
| exit 0; | |||
| my $now = time; | |||
| if ($short) { | |||
| print strftime('%Y%m%dT%H%M%SZ', (gmtime $now)) . "\n"; | |||
| } else { | |||
| print strftime('%Y-%m-%dT%H:%M:%SZ', (gmtime $now)) . "\n"; | |||
| } | |||
| exit 0; | |||
| #+END_SRC | |||
| * ~/bin/whoson | |||
| Basically getent passwd $username/$uid to show who is on a system. | |||
| #+BEGIN_SRC perl :mkdirp yes :tangle tmp/bin/whoson :results replace :tangle-mode (identity #o755) | |||
| #+BEGIN_SRC perl :tangle tmp/bin/whoson | |||
| #!/usr/bin/env perl | |||
| # | |||
| # Because i'm lazy and sick of typing in getent passwd $someusername/uid | |||
| @@ -713,7 +713,7 @@ foreach my $user (keys %users){ | |||
| Silly wrapper perl script that makes it easier to get at the gecos string for a $user/$uid. | |||
| #+BEGIN_SRC perl :mkdirp yes :tangle tmp/bin/gecos :results replace :tangle-mode (identity #o755) | |||
| #+BEGIN_SRC perl :tangle tmp/bin/gecos | |||
| #!/usr/bin/env perl | |||
| # | |||
| # Dumb wrapper to get the gecos information from a uid/username. | |||
| @@ -735,7 +735,7 @@ foreach my $input (@ARGV){ | |||
| Stupid perl script to mimic hatimerun for systems that don't have it. | |||
| #+BEGIN_SRC perl :mkdirp yes :tangle tmp/bin/hatimerun :results replace :tangle-mode (identity #o755) | |||
| #+BEGIN_SRC perl :tangle tmp/bin/hatimerun | |||
| #!/usr/bin/env perl | |||
| # | |||
| # hatimerun in perl, sorta | |||
| @@ -804,7 +804,7 @@ if ($@){ | |||
| Silly perl based ptree alike implementation. Mad old code that should be avoided at all costs but it works and I'm not fixing it unless I need to. | |||
| #+BEGIN_SRC perl :mkdirp yes :tangle tmp/bin/ptree.pl :results replace :tangle-mode (identity #o755) | |||
| #+BEGIN_SRC perl :tangle tmp/bin/ptree.pl | |||
| #!/usr/bin/env perl | |||
| # | |||
| # ptree for linux/darwin/solaris. I got sick of ps and pstree on linux. | |||
| @@ -982,7 +982,7 @@ exit 0; | |||
| Just find out if a port responds to anything tcp related or not. | |||
| #+BEGIN_SRC perl :mkdirp yes :tangle tmp/bin/portchk :results replace :tangle-mode (identity #o755) | |||
| #+BEGIN_SRC perl :tangle tmp/bin/portchk | |||
| #!/usr/bin/env perl | |||
| # | |||
| # Dumb wrapper to get the gecos information from a uid/username. | |||
| @@ -1000,6 +1000,49 @@ foreach my $input (@ARGV){ | |||
| } | |||
| #+END_SRC | |||
| * ~/bin/nix-update | |||
| More for nix on macos, but just merges NixOS/nipkgs origin/master to the current branch in a tmux window and watches it. | |||
| #+BEGIN_SRC sh :tangle (tangle/file "bin/nix-update" (bound-and-true-p nix-p)) | |||
| #!/usr/bin/env sh | |||
| #-*-mode: Shell-script; coding: utf-8;-*- | |||
| # File: tmux-nix.sh | |||
| # Copyright: 2017 Mitch Tishmack | |||
| # Description: instantiate tmux nix session | |||
| export script=$(basename "$0") | |||
| export dir=$(cd "$(dirname "$0")"; pwd) | |||
| export iam=${dir}/${script} | |||
| set -e | |||
| session=nix | |||
| cd ~/src/github.com/NixOS/nixpkgs | |||
| if ! tmux has-session -t ${session}; then | |||
| tmux new-session -d -s ${session} -n nix | |||
| tmux send-keys -t ${session}:0 'sleep 30 | |||
| while true; do | |||
| blah=$(nix-env -iA --dry-run stdboth nixpkgs.default | grep /nix); echo "${blah}" | head -n $(echo "$LINES - 2" | bc); echo "${blah}" | grep -c /nix | ts | |||
| echo "${blah}" | grep /nix > /dev/null 2>&1 | |||
| if [ $? -eq 0 ]; then | |||
| sleep 60 | |||
| clear | |||
| else | |||
| exit 0 | |||
| fi | |||
| done | |||
| ' C-m | |||
| tmux split-window -v -t ${session}:0 | |||
| tmux send-keys -t ${session}:0.1 'git fetch --all && git merge origin/master && | |||
| time nix-env -iA nixpkgs.default && nix-env -u --leq && exit 0 | |||
| ' C-m | |||
| tmux select-window -t ${session}:0 | |||
| fi | |||
| tmux attach -t ${session} | |||
| #+END_SRC | |||
| * ~/bin/notify | |||
| OSX only really, just fires off a notification when its ran. | |||
| @@ -1008,8 +1051,7 @@ Example: | |||
| notify "some command" "not ok" | |||
| First param is the message, second title of the notification. | |||
| #+BEGIN_SRC sh :mkdirp yes :tangle (when (eq osx-p t) "tmp/bin/notify") :results replace :tangle-mode (identity #o755) | |||
| #+BEGIN_SRC sh :tangle (tangle/file "bin/notify" (bound-and-true-p macos-p)) | |||
| #!/bin/sh | |||
| message=${1:="no message"} | |||
| title='' | |||
| @@ -1025,25 +1067,27 @@ osascript -e "${notification}" | |||
| * ~/bin/today | |||
| Stupid ruby script I wrote to highlight the week/day in a calendar. | |||
| #+BEGIN_SRC ruby :mkdirp yes :tangle tmp/bin/today :results replace :tangle-mode (identity #o755) | |||
| #!/usr/bin/env ruby | |||
| cal, today, week_color, day_color, reset = %x(cal).split(%r(\n)), Time.now.day, %x(tput sgr0;tput setab 4;tput setaf 7), %x(tput sgr0; tput setab 0;tput setaf 7;tput bold), %x(tput sgr0) | |||
| done=false | |||
| cal.each do |line| | |||
| if done then | |||
| puts line | |||
| next | |||
| end | |||
| if(line =~ /^(.*\s+?)#{today}(\s+?.*)$/ or | |||
| line =~ /^(.*\s+?)#{today}$/ or | |||
| line =~ /^()#{today}(\s+?.*)$/ or | |||
| line =~ /^#{today}$/ ) then | |||
| puts "#{week_color}#{$1}#{day_color}#{today}#{week_color}#{$2}#{reset}" | |||
| done=true | |||
| else | |||
| puts line | |||
| Stupid ruby script I wrote to highlight the week/day in a calendar. I don't remember why I wrote it. | |||
| TODO: why the hell is :mkdirp yes needed here but nowhere else? | |||
| #+BEGIN_SRC ruby :tangle tmp/bin/today :mkdirp yes | |||
| #!/usr/bin/env ruby | |||
| cal, today, week_color, day_color, reset = %x(cal).split(%r(\n)), Time.now.day, %x(tput sgr0;tput setab 4;tput setaf 7), %x(tput sgr0; tput setab 0;tput setaf 7;tput bold), %x(tput sgr0) | |||
| done=false | |||
| cal.each do |line| | |||
| if done then | |||
| puts line | |||
| next | |||
| end | |||
| if(line =~ /^(.*\s+?)#{today}(\s+?.*)$/ or | |||
| line =~ /^(.*\s+?)#{today}$/ or | |||
| line =~ /^()#{today}(\s+?.*)$/ or | |||
| line =~ /^#{today}$/ ) then | |||
| puts "#{week_color}#{$1}#{day_color}#{today}#{week_color}#{$2}#{reset}" | |||
| done=true | |||
| else | |||
| puts line | |||
| end | |||
| end | |||
| end | |||
| #+END_SRC | |||
| @@ -1,23 +0,0 @@ | |||
| ;;-*-mode: emacs-lisp; coding: utf-8;-*- | |||
| ;; All these variables control what/how readme.org gets tangled | |||
| ;; into dotfiles. Off by default set to t to turn them on as | |||
| ;; needed. | |||
| ;; OS types | |||
| (setq bsd-p nil) | |||
| (setq linux-p nil) | |||
| (setq osx-p nil) | |||
| ;; Optional things | |||
| (setq nix-p nil) | |||
| (setq tmux-p nil) | |||
| (setq git-p nil) | |||
| (setq emacs-p nil) | |||
| (setq vim-p nil) | |||
| (setq zsh-p nil) | |||
| (setq mosh-p nil) | |||
| (setq x-p nil) | |||
| ;; Language specific | |||
| (setq haskell-p nil) | |||
| (setq perl-p nil) | |||
| @@ -3,7 +3,12 @@ | |||
| #+STARTUP: hidestars | |||
| #+STARTUP: odd | |||
| #+BABEL: :cache yes | |||
| #+PROPERTY: header-args :cache yes :padline no :mkdirp yes :comments no :tangle tmp/.profile | |||
| #+PROPERTY: header-args :cache yes | |||
| #+PROPERTY: header-args :padline no | |||
| #+PROPERTY: header-args :mkdirp yes | |||
| #+PROPERTY: header-args :comments no | |||
| #+PROPERTY: header-args :replace yes | |||
| #+PROPERTY: header-args :tangle tmp/.profile | |||
| ~/.profile setup in all its peculiarities. | |||
| @@ -22,7 +27,7 @@ | |||
| OSX uses hostname -s for getting hostname | |||
| #+BEGIN_SRC sh :tangle (when (eq osx-p t) "tmp/.profile") | |||
| #+BEGIN_SRC sh :tangle (tangle/file ".profile" (bound-and-true-p macos-p)) | |||
| _host=$(hostname -s) | |||
| #+END_SRC | |||
| @@ -34,7 +39,7 @@ _host=${_host:=${_uname_n}} | |||
| * PATH | |||
| ** haskell | |||
| #+BEGIN_SRC sh :tangle (when (eq haskell-p t) "tmp/.profile") | |||
| #+BEGIN_SRC sh :tangle (tangle/file ".profile" (bound-and-true-p haskell-p)) | |||
| PATH="${PATH}:${HOME}/.cabal/bin" | |||
| #+END_SRC | |||
| ** General | |||
| @@ -188,7 +193,7 @@ cconv() | |||
| #+END_SRC | |||
| ** git | |||
| #+BEGIN_SRC sh :tangle (when (eq git-p t) "tmp/.profile") | |||
| #+BEGIN_SRC sh :tangle (tangle/file ".profile" (bound-and-true-p git-p)) | |||
| maybe_git_repo() | |||
| { | |||
| # assume https if input doesn't contain a protocol | |||
| @@ -230,7 +235,7 @@ bb() | |||
| } | |||
| #+END_SRC | |||
| ** haskell | |||
| #+BEGIN_SRC sh :tangle (when (eq haskell-p t) "tmp/.profile") | |||
| #+BEGIN_SRC sh :tangle (tangle/file ".profile" (bound-and-true-p haskell-p)) | |||
| hmap() | |||
| { | |||
| ghc -e "interact ($*)" | |||
| @@ -247,7 +252,7 @@ hmapw() | |||
| } | |||
| #+END_SRC | |||
| ** nix | |||
| #+BEGIN_SRC sh :tangle (when (eq nix-p t) "tmp/.profile") | |||
| #+BEGIN_SRC sh :tangle (tangle/file ".profile" (bound-and-true-p nix-p)) | |||
| mk_nix_shell() | |||
| { | |||
| cabal2nix --sha256="0" . \ | |||
| @@ -289,7 +294,7 @@ nix-off() { | |||
| Workaround stupid ssl crap with recent nix. | |||
| #+BEGIN_SRC sh :tangle (when (and (eq nix-p t) (eq osx-p t)) "tmp/.profile") | |||
| #+BEGIN_SRC sh :tangle (tangle/file ".profile" (and (bound-and-true-p nix-p) (bound-and-true-p macos-p))) | |||
| if [ ! -e ${HOME}/.nonix ]; then | |||
| SSL_CERT_FILE="${HOME}/.nix-profile/etc/ssl/certs/ca-bundle.crt" | |||
| GIT_SSL_CAINFO=$SSL_CERT_FILE | |||
| @@ -298,7 +303,7 @@ if [ ! -e ${HOME}/.nonix ]; then | |||
| fi | |||
| #+END_SRC | |||
| #+BEGIN_SRC sh :tangle (when (eq nix-p t) "tmp/.profile") | |||
| #+BEGIN_SRC sh :tangle (tangle/file ".profile" (bound-and-true-p nix-p)) | |||
| if [ ! -e ${HOME}/.nonix ]; then | |||
| nix_env_setup | |||
| fi | |||
| @@ -311,7 +316,7 @@ TODO Add linux ca-bundle detection | |||
| set -xg SSL_CERT_FILE /etc/ssl/certs/ca-certificates.crt | |||
| ** tmux | |||
| #+BEGIN_SRC sh :tangle (when (eq tmux-p t) "tmp/.profile") | |||
| #+BEGIN_SRC sh :tangle (tangle/file ".profile" (bound-and-true-p tmux-p)) | |||
| t() | |||
| { | |||
| if [ -z "$1" ]; then | |||
| @@ -324,7 +329,7 @@ t() | |||
| } | |||
| #+END_SRC | |||
| ** x | |||
| #+BEGIN_SRC sh :tangle (when (eq x-p t) "tmp/.profile") | |||
| #+BEGIN_SRC sh :tangle (tangle/file ".profile" (bound-and-true-p x-p)) | |||
| modmap() | |||
| { | |||
| [ -f "${HOME}/.Xmodmap" ] && xmodmap "${HOME}/.Xmodmap" | |||
| @@ -361,24 +366,24 @@ alias kille=emacsclient -e "(kill-emacs)" | |||
| #+END_SRC | |||
| ** osx | |||
| #+BEGIN_SRC sh :tangle (when (eq osx-p t) "tmp/.profile") | |||
| #+BEGIN_SRC sh :tangle (tangle/file ".profile" (bound-and-true-p macos-p)) | |||
| alias o='open -a' | |||
| #+END_SRC | |||
| ** git | |||
| #+BEGIN_SRC sh :tangle (when (eq git-p t) "tmp/.profile") | |||
| #+BEGIN_SRC sh :tangle (tangle/file ".profile" (bound-and-true-p git-p)) | |||
| alias g=git | |||
| #+END_SRC | |||
| ** haskell | |||
| #+BEGIN_SRC sh :tangle (when (eq haskell-p t) "tmp/.profile") | |||
| #+BEGIN_SRC sh :tangle (tangle/file ".profile" (bound-and-true-p haskell-p)) | |||
| alias ghce="ghc -e ':l ~/.ghc.hs' -e" | |||
| #+END_SRC | |||
| ** mosh | |||
| #+BEGIN_SRC sh :tangle (when (eq mosh-p t) "tmp/.profile") | |||
| #+BEGIN_SRC sh :tangle (tangle/file ".profile" (bound-and-true-p mosh-p)) | |||
| alias m=mosh | |||
| #+END_SRC | |||
| ** tmux | |||
| #+BEGIN_SRC sh :tangle (when (eq tmux-p t) "tmp/.profile") | |||
| #+BEGIN_SRC sh :tangle (tangle/file ".profile" (bound-and-true-p tmux-p)) | |||
| alias tl='tmux ls' | |||
| #+END_SRC | |||
| @@ -3,29 +3,22 @@ | |||
| #+STARTUP: hidestars | |||
| #+STARTUP: odd | |||
| #+BABEL: :cache yes | |||
| #+PROPERTY: header-args :tangle tmp/.emacs.d/init.el :cache yes :padline no :mkdirp yes :comments no | |||
| #+PROPERTY: header-args :cache yes | |||
| #+PROPERTY: header-args :padline no | |||
| #+PROPERTY: header-args :mkdirp yes | |||
| #+PROPERTY: header-args :comments no | |||
| #+PROPERTY: header-args :results replace | |||
| #+PROPERTY: header-args :tangle tmp/.emacs.d/init.el | |||
| * prelude | |||
| Startup related tasks/setup that might be used later on. | |||
| *** tangle functions | |||
| Duplicated from tangle.el just to make using org easier. | |||
| TODO: make this stuff work sanely in emacs org mode and | |||
| via external tangling. Not tangled for now. | |||
| #+BEGIN_SRC emacs-lisp :tangle no | |||
| (defun tangle/yn (p) (if (bound-and-true-p p) "yes" "no")) | |||
| (defun tangle/file (p file) (if (bound-and-true-p p) (concat "tmp/" file) "no")) | |||
| #+END_SRC | |||
| *** emacs package setup | |||
| Setup the builtin emacs package manager. | |||
| #+BEGIN_SRC emacs-lisp | |||
| #+BEGIN_SRC emacs-lisp :tangle tmp/.emacs.d/init.el :mkdirp yes | |||
| (require 'package) | |||
| (package-initialize) | |||
| #+END_SRC | |||
| @@ -38,6 +31,18 @@ Add in the standard package archive urls. | |||
| (add-to-list 'package-archives '("marmalade" . "http://marmalade-repo.org/packages/") t) | |||
| #+END_SRC | |||
| *** tangle functions | |||
| Duplicated from tangle.el just to make using org easier. | |||
| TODO: make this stuff work sanely in emacs org mode and | |||
| via external tangling. Not tangled for now. | |||
| #+BEGIN_SRC emacs-lisp | |||
| (defun tangle/yn (p) (if (bound-and-true-p p) "yes" "no")) | |||
| (defun tangle/file (file p) (if (bound-and-true-p p) (concat "tmp/" file) "no")) | |||
| #+END_SRC | |||
| *** emacs gc speedup | |||
| #+BEGIN_SRC emacs-lisp | |||
| @@ -717,7 +722,7 @@ setups. | |||
| Not tangled into the config intentionally. | |||
| #+BEGIN_SRC emacs-lisp :tangle=no | |||
| #+BEGIN_SRC emacs-lisp :tangle no | |||
| (defun pkg-config-add-lib-cflags (pkg-config-lib) | |||
| "This function will add necessary header file path of a | |||
| specified by `pkg-config-lib' to `flycheck-clang-include-path', which make it | |||
| @@ -4,12 +4,18 @@ | |||
| (require 'org-install) | |||
| (require 'org) | |||
| (load-file "./tangle.el") | |||
| (defun tangle/yn (p) (if (bound-and-true-p p) "yes" "no")) | |||
| (defun tangle/file (file p) (if (eval p) (concat "tmp/" file) "no")) | |||
| (load-defaults-or-options) | |||
| (if (getenv "USEROPTS") | |||
| (dolist (fnam (split-string (getenv "USEROPTS") ":")) | |||
| (if (not (member fnam '("" nil))) | |||
| (load-file (concat "./options/" fnam ".el")) | |||
| )) | |||
| ) | |||
| ;; Iterate through all the files given and tangle them | |||
| (dolist | |||
| (file command-line-args-left) | |||
| (princ file) | |||
| (print (format "tangling: %s" file)) | |||
| (org-babel-tangle-file file)) | |||
| @@ -3,41 +3,42 @@ | |||
| #+STARTUP: hidestars | |||
| #+STARTUP: odd | |||
| #+BABEL: :cache yes | |||
| #+PROPERTY: header-args :cache yes :padline no :comments no | |||
| #+PROPERTY: header-args :cache yes | |||
| #+PROPERTY: header-args :padline no | |||
| #+PROPERTY: header-args :mkdirp yes | |||
| #+PROPERTY: header-args :comments no | |||
| #+PROPERTY: header-args :replace yes | |||
| General git configuration split out into sections mostly. | |||
| * ~/.gitconfig | |||
| :PROPERTIES: | |||
| :header-args: :tangle tmp/.gitconfig :comments no :padline no :cache yes :mkdirp yes | |||
| :END: | |||
| ** pager | |||
| #+BEGIN_SRC conf :tangle (when (eq git-p t) "tmp/.gitconfig") | |||
| [pager] | |||
| color = true | |||
| #+BEGIN_SRC conf :tangle (tangle/file ".gitconfig" (bound-and-true-p git-p)) | |||
| [pager] | |||
| color = true | |||
| #+END_SRC | |||
| ** color | |||
| #+BEGIN_SRC conf :tangle (when (eq git-p t) "tmp/.gitconfig") | |||
| [color] | |||
| status = auto | |||
| diff = auto | |||
| branch = auto | |||
| [color "status"] | |||
| added = green | |||
| changed = blue | |||
| untracked = red | |||
| [color "branch"] | |||
| current = green | |||
| local = blue | |||
| remote = red | |||
| [color "diff"] | |||
| meta = blue bold | |||
| frag = black reverse | |||
| old = red reverse | |||
| new = green reverse | |||
| #+BEGIN_SRC conf :tangle (tangle/file ".gitconfig" (bound-and-true-p git-p)) | |||
| [color] | |||
| status = auto | |||
| diff = auto | |||
| branch = auto | |||
| [color "status"] | |||
| added = green | |||
| changed = blue | |||
| untracked = red | |||
| [color "branch"] | |||
| current = green | |||
| local = blue | |||
| remote = red | |||
| [color "diff"] | |||
| meta = blue bold | |||
| frag = black reverse | |||
| old = red reverse | |||
| new = green reverse | |||
| #+END_SRC | |||
| ** alias | |||
| #+BEGIN_SRC conf :tangle (when (eq git-p t) "tmp/.gitconfig") | |||
| #+BEGIN_SRC conf :tangle (tangle/file ".gitconfig" (bound-and-true-p git-p)) | |||
| [alias] | |||
| begin = !git init && git commit --allow-empty -m 'Initial empty commit' | |||
| up = !git pull --rebase && git push | |||
| @@ -76,7 +77,7 @@ General git configuration split out into sections mostly. | |||
| churn = !git log --all -M -C --name-only --format='format:' "$@" | sort | grep -v '^$' | uniq -c | sort -r | awk 'BEGIN {print "count,file"} {print $1 "," $2}' | egrep -v '^\\s+$' | |||
| # help the gc a bit and get a bit more space back for a local clone | |||
| trim = !git reflog expire --expire=now --all && git gc --prune=now | |||
| # default remote | |||
| # default remote, note depends on the repo having been git cloned | |||
| defremote = !git branch -rvv | egrep 'HEAD' | awk '{print $1}' | sed -e 's|/HEAD||g' | |||
| # short sha | |||
| short = rev-parse --short | |||
| @@ -90,48 +91,56 @@ General git configuration split out into sections mostly. | |||
| # kinda/sorta git pull -r without the git pull nonsense | |||
| cleanmerged = !sh -c "git branch --merged | grep -Ev '^(. master|\*)' | xargs -n1 git branch -d" | |||
| prune = !sh -c 'git cleanmerged; git fetch -p; git trim' | |||
| # My defremote hack depends on $remote/HEAD to point to somewhere | |||
| # which it may not if the git repo wasn't cloned | |||
| fixhead = !sh -c "rem=${0:-origin} && branch=${1:-master} && git symbolic-ref refs/remotes/$rem/HEAD refs/remotes/$rem/${branch}" | |||
| # push branch while setting the upstream to the default remote | |||
| pbr = !git push --set-upstream $(git defremote) $(git bn) | |||
| p = !sh -c 'git branch ${1:-$(git defremote)}pr$0@$(iso8601 -s) $(git ls-remote -q ${1:-$(git defremote)} | grep refs/pull-requests/$0/from | cut -c1-8)' | |||
| # Pull all the commits missed from a git pull --depth N clone | |||
| unshallow = pull --unshallow | |||
| #+END_SRC | |||
| ** github | |||
| #+BEGIN_SRC conf :tangle (when (eq git-p t) "tmp/.gitconfig") | |||
| [github] | |||
| user = mitchty | |||
| #+BEGIN_SRC conf :tangle (tangle/file ".gitconfig" (bound-and-true-p git-p)) | |||
| [github] | |||
| user = mitchty | |||
| #+END_SRC | |||
| ** credential | |||
| #+BEGIN_SRC conf :tangle (when (eq git-p t) "tmp/.gitconfig") | |||
| [credential] | |||
| helper = netrc -v -f ~/.netrc.gpg -f ~/.netrc | |||
| #+BEGIN_SRC conf :tangle (tangle/file ".gitconfig" (bound-and-true-p git-p)) | |||
| [credential] | |||
| helper = netrc -v -f ~/.netrc.gpg -f ~/.netrc | |||
| #+END_SRC | |||
| ** advice | |||
| #+BEGIN_SRC conf :tangle (when (eq git-p t) "tmp/.gitconfig") | |||
| [advice] | |||
| statushints = false | |||
| #+BEGIN_SRC conf :tangle (tangle/file ".gitconfig" (bound-and-true-p git-p)) | |||
| [advice] | |||
| statushints = false | |||
| #+END_SRC | |||
| ** gui | |||
| #+BEGIN_SRC conf :tangle (tangle/file 'git-p ".gitconfig") | |||
| [gui] | |||
| fontui = -family Monaco -size 8 -weight normal -slant roman -underline 0 -overstrike 0 | |||
| fontdiff = -family Monaco -size 8 -weight normal -slant roman -underline 0 -overstrike 0 | |||
| #+BEGIN_SRC conf :tangle (tangle/file ".gitconfig" (bound-and-true-p git-p)) | |||
| [gui] | |||
| fontui = -family Monaco -size 8 -weight normal -slant roman -underline 0 -overstrike 0 | |||
| fontdiff = -family Monaco -size 8 -weight normal -slant roman -underline 0 -overstrike 0 | |||
| #+END_SRC | |||
| ** http | |||
| #+BEGIN_SRC conf :tangle (when (eq git-p t) "tmp/.gitconfig") | |||
| [http] | |||
| postBuffer = 209715200 | |||
| #+BEGIN_SRC conf :tangle (tangle/file ".gitconfig" (bound-and-true-p git-p)) | |||
| [http] | |||
| postBuffer = 209715200 | |||
| #+END_SRC | |||
| ** push | |||
| #+BEGIN_SRC conf :tangle (when (eq git-p t) "tmp/.gitconfig") | |||
| [push] | |||
| default = simple | |||
| #+BEGIN_SRC conf :tangle (tangle/file ".gitconfig" (bound-and-true-p git-p)) | |||
| [push] | |||
| default = simple | |||
| #+END_SRC | |||
| ** url rewrites | |||
| #+BEGIN_SRC conf :tangle (tangle/file 'git-p ".gitconfig") | |||
| [url "https://github.com/"] | |||
| insteadOf = git://github.com/ | |||
| #+BEGIN_SRC conf :tangle (tangle/file ".gitconfig" (bound-and-true-p git-p)) | |||
| [url "https://github.com/"] | |||
| insteadOf = git://github.com/ | |||
| #+END_SRC | |||
| ** username/email | |||
| #+BEGIN_SRC conf :tangle (tangle/file 'git-p ".gitconfig") | |||
| [user] | |||
| name = Mitch Tishmack | |||
| email = mitch.tishmack@gmail.com | |||
| #+BEGIN_SRC conf :tangle (tangle/file ".gitconfig" (bound-and-true-p git-p)) | |||
| [user] | |||
| name = Mitch Tishmack | |||
| email = mitch.tishmack@gmail.com | |||
| #+END_SRC | |||
| *** for cray | |||
| @@ -142,24 +151,21 @@ General git configuration split out into sections mostly. | |||
| #+END_SRC | |||
| * ~/.gitignore | |||
| :PROPERTIES: | |||
| :header-args: :tangle tmp/.gitignore :comments no :padline no :cache yes :mkdirp yes | |||
| :END: | |||
| Common crap/build artifacts that git should always ignore. | |||
| #+BEGIN_SRC conf :tangle no | |||
| .*~ | |||
| *~ | |||
| .\#* | |||
| \#* | |||
| \#*\# | |||
| .\#*\# | |||
| .DS_Store | |||
| *.pyc | |||
| *.rbc | |||
| *.elc | |||
| *.swp | |||
| *.[oa] | |||
| *.hi | |||
| #+BEGIN_SRC conf :tangle (tangle/file ".gitignore" (bound-and-true-p git-p)) | |||
| .*~ | |||
| ,*~ | |||
| .\#* | |||
| \#* | |||
| \#*\# | |||
| .\#*\# | |||
| .DS_Store | |||
| ,*.pyc | |||
| ,*.rbc | |||
| ,*.elc | |||
| ,*.swp | |||
| ,*.[oa] | |||
| ,*.hi | |||
| #+END_SRC | |||
| @@ -3,7 +3,11 @@ | |||
| #+STARTUP: hidestars | |||
| #+STARTUP: odd | |||
| #+BABEL: :cache yes | |||
| #+PROPERTY: header-args :cache yes :padline no :mkdirp yes :comments no | |||
| #+PROPERTY: header-args :cache yes | |||
| #+PROPERTY: header-args :padline no | |||
| #+PROPERTY: header-args :mkdirp yes | |||
| #+PROPERTY: header-args :comments no | |||
| #+PROPERTY: header-args :replace yes | |||
| Haskell setup. | |||
| @@ -1,23 +0,0 @@ | |||
| ;;-*-mode: emacs-lisp; coding: utf-8;-*- | |||
| ;; All these variables control what/how readme.org gets tangled | |||
| ;; into dotfiles. Off by default set to t to turn them on as | |||
| ;; needed. | |||
| ;; OS types | |||
| (setq bsd-p nil) | |||
| (setq linux-p nil) | |||
| (setq osx-p t) | |||
| ;; Optional things | |||
| (setq nix-p nil) | |||
| (setq tmux-p t) | |||
| (setq git-p t) | |||
| (setq emacs-p t) | |||
| (setq vim-p nil) | |||
| (setq zsh-p t) | |||
| (setq mosh-p t) | |||
| (setq x-p t) | |||
| ;; Language specific | |||
| (setq haskell-p t) | |||
| (setq perl-p t) | |||
| @@ -1,23 +0,0 @@ | |||
| ;;-*-mode: emacs-lisp; coding: utf-8;-*- | |||
| ;; All these variables control what/how readme.org gets tangled | |||
| ;; into dotfiles. Off by default set to t to turn them on as | |||
| ;; needed. | |||
| ;; OS types | |||
| (setq bsd-p nil) | |||
| (setq linux-p nil) | |||
| (setq osx-p t) | |||
| ;; Optional things | |||
| (setq nix-p t) | |||
| (setq tmux-p t) | |||
| (setq git-p t) | |||
| (setq emacs-p t) | |||
| (setq vim-p nil) | |||
| (setq zsh-p t) | |||
| (setq mosh-p t) | |||
| (setq x-p t) | |||
| ;; Language specific | |||
| (setq haskell-p t) | |||
| (setq perl-p t) | |||
| @@ -3,7 +3,11 @@ | |||
| #+STARTUP: hidestars | |||
| #+STARTUP: odd | |||
| #+BABEL: :cache yes | |||
| #+PROPERTY: header-args :cache yes :padline no :mkdirp yes :comments no | |||
| #+PROPERTY: header-args :cache yes | |||
| #+PROPERTY: header-args :padline no | |||
| #+PROPERTY: header-args :mkdirp yes | |||
| #+PROPERTY: header-args :comments no | |||
| #+PROPERTY: header-args :replace yes | |||
| Stuff that didn't fit anywhere else. | |||
| @@ -3,41 +3,161 @@ | |||
| #+STARTUP: hidestars | |||
| #+STARTUP: odd | |||
| #+BABEL: :cache yes | |||
| #+PROPERTY: header-args :tangle tmp/.nixpkgs/config.nix :cache yes :padline no :mkdirp yes :comments no | |||
| #+PROPERTY: header-args :cache yes | |||
| #+PROPERTY: header-args :padline no | |||
| #+PROPERTY: header-args :mkdirp yes | |||
| #+PROPERTY: header-args :comments no | |||
| #+PROPERTY: header-args :replace yes | |||
| Nix user config.nix setup. | |||
| #+BEGIN_SRC conf :tangle (when (eq nix-p t) "tmp/.nixpkgs/config.nix") | |||
| let | |||
| pkgs = import <nixpkgs> {}; | |||
| in | |||
| { | |||
| packageOverrides = pkgs: with pkgs; | |||
| let in rec { | |||
| custom-pybugz = with python34Packages; buildPythonPackage rec { | |||
| name = "pybugz-${version}"; | |||
| version = "0.13"; | |||
| src = pkgs.fetchgit { | |||
| url = https://github.com/williamh/pybugz.git; | |||
| rev = "4dec396d43061c1def9aa19601c89c8aa00742b3"; | |||
| sha256 = "1s21jma83cyynmv3696hbrgy0d3sq4j027iplhnw22q2237bk1xd"; | |||
| #+BEGIN_SRC conf :mkdirp yes :tangle (tangle/file ".nixpkgs/config.nix" (bound-and-true-p nix-p)) | |||
| let | |||
| pkgs = import <nixpkgs> {}; | |||
| in | |||
| { | |||
| packageOverrides = pkgs: with pkgs; | |||
| let in rec { | |||
| custom-pybugz = with python34Packages; buildPythonPackage rec { | |||
| name = "pybugz-${version}"; | |||
| version = "0.13"; | |||
| src = pkgs.fetchgit { | |||
| url = https://github.com/williamh/pybugz.git; | |||
| rev = "4dec396d43061c1def9aa19601c89c8aa00742b3"; | |||
| sha256 = "1s21jma83cyynmv3696hbrgy0d3sq4j027iplhnw22q2237bk1xd"; | |||
| }; | |||
| # TODO: Fix this, something to do with how its using unittest | |||
| doCheck = false; | |||
| buildInputs = [ pkgs.glibcLocales ]; | |||
| propagatedBuildInputs = [ six ]; | |||
| }; | |||
| custom-pinentry = pinentry.override { gtk2 = null; qt4 = null; ncurses = null; }; | |||
| custom-youtube-dl = python27Packages.youtube-dl.override { pandoc = null; }; | |||
| # 3 unit tests fail on both 27 pylint and 35 pylint, so ignore it | |||
| # custom-pylint = python35Packages.pylint.override { doCheck = false; }; | |||
| custom-git = git.override { | |||
| pythonSupport = false; | |||
| svnSupport = true; | |||
| guiSupport = false; | |||
| sendEmailSupport = true; | |||
| }; | |||
| # TODO: Fix this, something to do with how its using unittest | |||
| doCheck = false; | |||
| buildInputs = [ pkgs.glibcLocales ]; | |||
| propagatedBuildInputs = [ six ]; | |||
| }; | |||
| custom-pinentry = pinentry.override { gtk2 = null; qt4 = null; ncurses = null; }; | |||
| custom-youtube-dl = python27Packages.youtube-dl.override { pandoc = null; }; | |||
| # 3 unit tests fail on both 27 pylint and 35 pylint, so ignore it | |||
| custom-pylint = python35Packages.pylint.override { doCheck = false; }; | |||
| custom-git = git.override { | |||
| pythonSupport = false; | |||
| svnSupport = true; | |||
| guiSupport = false; | |||
| sendEmailSupport = true; | |||
| default = buildEnv { | |||
| name = "default"; | |||
| ignoreCollisions = true; | |||
| paths = [ | |||
| ack | |||
| ansible | |||
| aria | |||
| aspell | |||
| aspellDicts.en | |||
| bazaarTools | |||
| cacert | |||
| clang | |||
| clang-analyzer | |||
| cloc | |||
| cscope | |||
| ctags | |||
| curl | |||
| custom-git | |||
| custom-pinentry | |||
| custom-pybugz | |||
| # custom-pylint | |||
| custom-youtube-dl | |||
| diffutils | |||
| docbook5 | |||
| duply | |||
| emacs | |||
| entr | |||
| gcc | |||
| gdbm | |||
| ghostscript | |||
| gist | |||
| gitAndTools.git-extras | |||
| gitAndTools.gitFull | |||
| gnumake | |||
| gnupg | |||
| gnupg1compat | |||
| gnutar | |||
| graphviz-nox | |||
| haskellPackages.ShellCheck | |||
| haskellPackages.bake | |||
| haskellPackages.cabal-dependency-licenses | |||
| haskellPackages.ghc-core | |||
| haskellPackages.ghc-mod | |||
| haskellPackages.hasktags | |||
| haskellPackages.hindent | |||
| haskellPackages.hoogle | |||
| haskellPackages.hspec | |||
| haskellPackages.idris | |||
| haskellPackages.intero | |||
| haskellPackages.network | |||
| haskellPackages.pandoc | |||
| haskellPackages.shake | |||
| haskellPackages.stack | |||
| htop | |||
| imagemagick | |||
| iperf | |||
| jq | |||
| keychain | |||
| lastpass-cli | |||
| less | |||
| llvm | |||
| mercurial | |||
| moreutils | |||
| mosh | |||
| multimarkdown | |||
| multitail | |||
| mutt | |||
| munge | |||
| mr | |||
| nox | |||
| openssl | |||
| p7zip | |||
| patchutils | |||
| pbzip2 | |||
| pigz | |||
| pixz | |||
| pkgconfig | |||
| poppler_utils | |||
| postgresql | |||
| pv | |||
| python27Packages.bugzilla | |||
| python27Packages.flake8 | |||
| python27Packages.howdoi | |||
| python27Packages.pip | |||
| python27Packages.pyflakes | |||
| python27Packages.virtualenv | |||
| readline | |||
| rlwrap | |||
| rsync | |||
| rtags | |||
| gmp | |||
| silver-searcher | |||
| sloccount | |||
| sqlite | |||
| sshpass | |||
| subversionClient | |||
| texlive.combined.scheme-full | |||
| tmux | |||
| tree | |||
| unrar | |||
| unzip | |||
| upx | |||
| wakelan | |||
| watch | |||
| wget | |||
| xz | |||
| zlib | |||
| # If I ever come up with some linux only stuff or figure out xhyve | |||
| # ] ++ stdenv.lib.optionals stdenv.isLinux [ | |||
| # ] ++ stdenv.lib.optionals stdenv.isDarwin [ | |||
| # xhyve | |||
| ]; | |||
| }; | |||
| }; | |||
| <<<<<<< HEAD | |||
| default = buildEnv { | |||
| name = "default"; | |||
| @@ -153,4 +273,8 @@ in | |||
| }; | |||
| allowUnfree = true; | |||
| } | |||
| ======= | |||
| allowUnfree = true; | |||
| } | |||
| >>>>>>> origin/master | |||
| #+END_SRC | |||
| @@ -0,0 +1 @@ | |||
| (setq bsd-p t) | |||
| @@ -0,0 +1 @@ | |||
| (setq emacs-p t) | |||
| @@ -0,0 +1 @@ | |||
| (setq git-p t) | |||
| @@ -0,0 +1 @@ | |||
| (setq haskell-p t) | |||
| @@ -0,0 +1 @@ | |||
| (setq linux-p t) | |||
| @@ -0,0 +1 @@ | |||
| (setq macos-p t) | |||
| @@ -0,0 +1 @@ | |||
| (setq mosh-p t) | |||
| @@ -0,0 +1 @@ | |||
| (setq nix-p t) | |||
| @@ -0,0 +1 @@ | |||
| (setq bsd-p nil) | |||
| @@ -0,0 +1 @@ | |||
| (setq emacs-p nil) | |||
| @@ -0,0 +1 @@ | |||
| (setq git-p nil) | |||
| @@ -0,0 +1 @@ | |||
| (setq haskell-p nil) | |||
| @@ -0,0 +1 @@ | |||
| (setq linux-p nil) | |||
| @@ -0,0 +1 @@ | |||
| (setq macos-p nil) | |||
| @@ -0,0 +1 @@ | |||
| (setq mosh-p nil) | |||
| @@ -0,0 +1 @@ | |||
| (setq nix-p nil) | |||
| @@ -0,0 +1 @@ | |||
| (setq perl-p nil) | |||
| @@ -0,0 +1 @@ | |||
| (setq tmux-p nil) | |||
| @@ -0,0 +1 @@ | |||
| (setq vim-p nil) | |||
| @@ -0,0 +1 @@ | |||
| (setq x-p nil) | |||
| @@ -0,0 +1 @@ | |||
| (setq zsh-p nil) | |||
| @@ -0,0 +1 @@ | |||
| (setq perl-p t) | |||
| @@ -0,0 +1 @@ | |||
| (setq tmux-p t) | |||
| @@ -0,0 +1 @@ | |||
| (setq vim-p t) | |||
| @@ -0,0 +1 @@ | |||
| (setq x-p t) | |||
| @@ -0,0 +1 @@ | |||
| (setq zsh-p t) | |||
| @@ -3,7 +3,11 @@ | |||
| #+STARTUP: hidestars | |||
| #+STARTUP: odd | |||
| #+BABEL: :cache yes | |||
| #+PROPERTY: header-args :cache yes :padline no :mkdirp yes :comments no | |||
| #+PROPERTY: header-args :cache yes | |||
| #+PROPERTY: header-args :padline no | |||
| #+PROPERTY: header-args :mkdirp yes | |||
| #+PROPERTY: header-args :comments no | |||
| #+PROPERTY: header-args :replace yes | |||
| Mostly old holdovers from the days of perl, just perlcritic and perltidy configuration. | |||
| @@ -21,16 +21,35 @@ 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. Mostly | |||
| because it is large enough that it can be on its own. | |||
| because it is large enough that it can stand on its own. | |||
| * Use/Abuse | |||
| Use of this setup is simple. There really is one step in general: | |||
| Use of this setup is somewhat simple or straightforward. | |||
| There really is one step in general: | |||
| #+BEGIN_SRC sh :tangle no | |||
| make | |||
| #+END_SRC | |||
| ** Emacs functions to add to init.el | |||
| For all this to work in emacs so you can edit source blocks you'll need | |||
| add the following two functions otherwise you'll get an error every time | |||
| you try to edit the source block. | |||
| #+BEGIN_SRC emacs-lisp :tangle no | |||
| (defun tangle/yn (p) (if (bound-and-true-p p) "yes" "no")) | |||
| (defun tangle/file (file p) (if (eval p) (concat "tmp/" file) "no")) | |||
| #+END_SRC | |||
| This is also all the "magique" that this whole stupid repo entails. | |||
| But how would you control how things get exported? Well that is done | |||
| via files with simple *(setq predicate-p t)* lines inside them. These | |||
| are all the *options/name.el* files comprise of. | |||
| But lets say you want to export things to another directory than $HOME. No | |||
| worries, just specify DEST: | |||
| @@ -38,15 +57,55 @@ worries, just specify DEST: | |||
| 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: | |||
| But wait, what if you want to export things for an os you're not using? | |||
| Easy, just create a couple options files like so: | |||
| #+BEGIN_SRC sh :tangle no | |||
| name=option | |||
| echo "(setq ${name}-p t)" > options/${name}.el | |||
| echo "(setq ${name}-p nil)" > options/no-${name}.el | |||
| #+END_SRC | |||
| And then provide the *name* (without the .el extension) to make via *OPTS*: | |||
| #+BEGIN_SRC sh :tangle no | |||
| make DEST=/some/other/directory OPTIONS=osx | |||
| make DEST=/some/other/directory OPTS=macos | |||
| #+END_SRC | |||
| This lets you customize things to a ludicrous degree at runtime like so: | |||
| #+BEGIN_SRC sh :tangle no | |||
| make OPTS=no-nix:linux:tmux:git:no-zsh | |||
| #+END_SRC | |||
| Etc... | |||
| I wouldn't do this exactly, while you could, thats just too much to need to | |||
| remember to type. The simplest way to do things is to just create an | |||
| *options/$(uname -n).el* file with all the options you need defined. Note that | |||
| in the or *BEGIN_SRC* lines you can use elisp to control when/how something should or | |||
| should not get tangled. | |||
| Example use of tangle/file, note the final option is just elisp and we just | |||
| use *bound-and-true-p* to detect if we have a predicate or not. | |||
| #+BEGIN_SRC emacs-lisp :tangle no | |||
| (tangle/file "some/file/name" (bound-and-true-p macos-p)) | |||
| (tangle/file "some/file/name" (bound-and-true-p foo-p)) | |||
| (tangle/file "some/file/name" (and (bound-and-true-p first-p) (bound-and-true-p second-p))) | |||
| #+END_SRC | |||
| By default the makefile will add an option with the name of the system its | |||
| running on's *uname -n*. To override this behavior use the *USEROPTS* variable | |||
| instead, or invoke things with a null *HOST* like so: | |||
| #+BEGIN_SRC sh :tangle no | |||
| make HOST= | |||
| #+END_SRC | |||
| 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: | |||
| installing to some *DEST*, and want to copy that to *$HOME*? No worries: | |||
| #+BEGIN_SRC sh :tangle no | |||
| make copy GEN=N | |||
| @@ -54,6 +113,35 @@ installing to some DEST, and want to copy that to $HOME? No worries: | |||
| Where N is the generation you want to copy. | |||
| Note, to ensure this doesn't by default overwrite hand edited files, a | |||
| diff is run across the files that would be copied to and what the tangled | |||
| version contains. | |||
| Example, I've commented out some .gitignore lines in *~/.gitignore* manually | |||
| and then tried to tangle a new generation over the top. | |||
| #+BEGIN_SRC sh :tangle no | |||
| ./ddiff /Users/me/src/github.com/mitchty/dotfiles/generation/291 /Users/me | |||
| --- .gitignore 2017-03-04 12:49:17.000000000 -0600 | |||
| +++ /Users/me/.gitignore 2017-03-04 14:00:24.000000000 -0600 | |||
| @@ -8,6 +8,6 @@ | |||
| *.pyc | |||
| *.rbc | |||
| *.elc | |||
| -*.swp | |||
| -*.[oa] | |||
| -*.hi | |||
| +#*.swp | |||
| +#*.[oa] | |||
| +#*.hi | |||
| differences between /Users/me/src/github.com/mitchty/dotfiles/generation/291 and /Users/me | |||
| #+END_SRC | |||
| This is an attempt to ensure that we don't accidentally overwrite files that may | |||
| have customizations on it. | |||
| To force it just run *make copy GEN=N* with *N* as the number to force a copy for. | |||
| ** How does it work? | |||
| It is really rather simple, the [[file:Makefile][Makefile]] isn't that complex. Look at that | |||
| @@ -70,8 +158,6 @@ files is the users job, not this setup. | |||
| ** Explanation of what is happening | |||
| The file [[file:defaults.el][defaults.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. | |||
| @@ -97,16 +183,16 @@ 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 as an example, under an org mode | |||
| heading you would just add: | |||
| heading you would just add to your *BEGIN_SRC* definition like so: | |||
| #+BEGIN_SRC org :tangle no | |||
| :PROPERTIES: | |||
| :header-args: :tangle tmp/.profile :comments no :padline no :cache yes :mkdirp yes | |||
| :END: | |||
| #+BEGIN_SRC text :tangle no | |||
| #+BEGIN_SRC sh :tangle .profile | |||
| stuff | |||
| #+END_SRC | |||
| #+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 | |||
| 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. | |||
| @@ -114,12 +200,10 @@ 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 | |||
| #+BEGIN_SRC text :tangle no | |||
| #+BEGIN_SRC conf :tangle tmp/.example.conf | |||
| put contents here! | |||
| ,#+END_SRC | |||
| #+END_SRC | |||
| #+END_SRC | |||
| * External Tanglers | |||
| @@ -149,7 +233,7 @@ Language specific | |||
| | perl | [[file:perl.org][perl.org]] | | |||
| * TODO | |||
| - [ ] Figure out some way to make code blocks editable with :tangle, it sucks not being able to edit blocks as they are. | |||
| - [X] Figure out some way to make code blocks editable with :tangle, it sucks not being able to edit blocks as they are. | |||
| - [ ] 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? | |||
| @@ -2,12 +2,15 @@ | |||
| #+AUTHOR: Mitch Tishmack | |||
| #+STARTUP: hidestars | |||
| #+STARTUP: odd | |||
| #+BABEL: :cache yes | |||
| #+PROPERTY: header-args :cache yes :padline no :mkdirp yes :comments no | |||
| #+PROPERTY: header-args :cache yes | |||
| #+PROPERTY: header-args :padline no | |||
| #+PROPERTY: header-args :mkdirp yes | |||
| #+PROPERTY: header-args :comments no | |||
| #+PROPERTY: header-args :replace yes | |||
| Tmux configuration. Pretty boring in most ways. | |||
| #+BEGIN_SRC conf :tangle (tangle/file tmux-p ".tmux.conf") | |||
| #+BEGIN_SRC conf :tangle (tangle/file ".tmux.conf" (bound-and-true-p tmux-p)) | |||
| # Setup vi mode by default | |||
| set-window-option -g mode-keys vi | |||
| set-window-option -g aggressive-resize on | |||
| @@ -144,7 +147,7 @@ Tmux configuration. Pretty boring in most ways. | |||
| Only set xclip for x setup. | |||
| #+BEGIN_SRC conf :tangle (eq (tangle/file tmux-p ".tmux.conf") (tangle/file x-p ".tmux.conf")) | |||
| #+BEGIN_SRC conf :tangle (tangle/file ".tmux.conf" (and (bound-and-true-p tmux-p) (bound-and-true-p x-p))) | |||
| bind C-p run "tmux set-buffer \"$(xclip -o)\"; tmux paste-buffer" | |||
| bind C-y run "tmux save-buffer - | xclip -i" | |||
| #+END_SRC | |||
| @@ -2,12 +2,15 @@ | |||
| #+AUTHOR: Mitch Tishmack | |||
| #+STARTUP: hidestars | |||
| #+STARTUP: odd | |||
| #+BABEL: :cache yes | |||
| #+PROPERTY: header-args :cache yes :padline no :mkdirp yes :comments no :tangle tmp/.vimrc | |||
| #+PROPERTY: header-args :cache yes | |||
| #+PROPERTY: header-args :padline no | |||
| #+PROPERTY: header-args :mkdirp yes | |||
| #+PROPERTY: header-args :comments no | |||
| #+PROPERTY: header-args :replace yes | |||
| What remains of my days from being a vim user. | |||
| #+BEGIN_SRC conf :tangle tmp/.vimrc :results replace | |||
| #+BEGIN_SRC conf :tangle tmp/.vimrc | |||
| set nocompatible | |||
| set backspace=indent,eol,start | |||
| set history=50 " keep 50 lines of command line history | |||
| @@ -2,19 +2,19 @@ | |||
| #+AUTHOR: Mitch Tishmack | |||
| #+STARTUP: hidestars | |||
| #+STARTUP: odd | |||
| #+BABEL: :cache yes | |||
| #+PROPERTY: header-args :cache yes :padline no :mkdirp yes :comments no | |||
| #+PROPERTY: header-args :cache yes | |||
| #+PROPERTY: header-args :padline no | |||
| #+PROPERTY: header-args :mkdirp yes | |||
| #+PROPERTY: header-args :comments no | |||
| #+PROPERTY: header-args :replace yes | |||
| X related configuration, nothing overly huge to be honest just stupid configuration. | |||
| * ~/.Xdefaults | |||
| :PROPERTIES: | |||
| :header-args: :tangle (when (eq x-p t) "tmp/.Xdefaults") :comments no :padline no :cache yes :mkdirp yes | |||
| :END: | |||
| X defaults, just urxvt for the moment. Slightly linux/bsd only but not really. | |||
| #+BEGIN_SRC conf | |||
| #+BEGIN_SRC conf (tangle/file ".Xdefaults" (bound-and-true-p x-p)) | |||
| ! urxvt generalish stuff | |||
| ! | |||
| urxvt*termName: rxvt-256color | |||
| @@ -35,30 +35,24 @@ urxvt*allowWindowOps: true | |||
| #+END_SRC | |||
| * ~/.Xmodmap | |||
| :PROPERTIES: | |||
| :header-args: :tangle (when (eq x-p t) "tmp/.Xmodmap") :comments no :padline no :cache yes :mkdirp yes | |||
| :END: | |||
| Swap around left/right clicks basically. | |||
| #+BEGIN_SRC conf :tangle (when (not (and (eq x-p t) (eq osx-p t))) "tmp/.Xmodmap") | |||
| #+BEGIN_SRC conf :tangle (tangle/file ".Xmodmap" (not (and (bound-and-true-p x-p) (bound-and-true-p macos-p)))) | |||
| pointer = 3 2 1 4 5 | |||
| #+END_SRC | |||
| OSX is odd/inverted cause reasons (who cares why). | |||
| #+BEGIN_SRC conf :tangle (when (and (eq x-p t) (eq osx-p t)) "tmp/.Xmodmap") | |||
| #+BEGIN_SRC conf :tangle (tangle/file ".Xmodmap" (and (bound-and-true-p x-p) (bound-and-true-p macos-p))) | |||
| pointer = 1 2 3 4 5 | |||
| #+END_SRC | |||
| * ~/.Xresources | |||
| :PROPERTIES: | |||
| :header-args: :tangle (when (eq x-p t) "tmp/.Xresources") :comments no :padline no :cache yes :mkdirp yes | |||
| :END: | |||
| I can't remember why I did all this effort. But I'll remove it some year I bet. | |||
| #+BEGIN_SRC conf | |||
| #+BEGIN_SRC conf :tangle (tangle/file ".Xresources" (bound-and-true-p x-p)) | |||
| #define brightblack #ffffff | |||
| #define normblack #f9f9f9 | |||
| #define normgreen #00cc33 | |||