Просмотр исходного кода

Another omnibus update

Switch to use tangle/file everywhere. Lots of cleanup.

Also define option predicates via the makefile option of:

make option NAME=whatever

Which defines the options in options/whatever.el and
options/no-whatever.el

Switch from using osx-p to macos-p now for osx.

There were a few other changes that snuck in that I was too
lazy to split apart. But all this should make this all simpler.

It also means you can edit source blocks in emacs sanely.
cray
Mitch Tishmack 9 лет назад
Родитель
Сommit
3c6b41fed4
44 измененных файлов: 552 добавлений и 447 удалений
  1. +12
    -4
      Makefile
  2. +101
    -57
      bin.org
  3. +0
    -23
      defaults.el
  4. +20
    -15
      dotprofile.org
  5. +20
    -15
      emacs.org
  6. +9
    -3
      etangle
  7. +73
    -73
      git.org
  8. +5
    -1
      haskell.org
  9. +5
    -1
      misc.org
  10. +149
    -143
      nix.org
  11. +1
    -0
      options/bsd.el
  12. +1
    -0
      options/emacs.el
  13. +1
    -0
      options/git.el
  14. +1
    -0
      options/haskell.el
  15. +1
    -0
      options/linux.el
  16. +1
    -0
      options/macos.el
  17. +1
    -0
      options/mosh.el
  18. +1
    -0
      options/nix.el
  19. +1
    -0
      options/no-bsd.el
  20. +1
    -0
      options/no-emacs.el
  21. +1
    -0
      options/no-git.el
  22. +1
    -0
      options/no-haskell.el
  23. +1
    -0
      options/no-linux.el
  24. +1
    -0
      options/no-macos.el
  25. +1
    -0
      options/no-mosh.el
  26. +1
    -0
      options/no-nix.el
  27. +1
    -0
      options/no-perl.el
  28. +1
    -0
      options/no-tmux.el
  29. +1
    -0
      options/no-vim.el
  30. +1
    -0
      options/no-x.el
  31. +1
    -0
      options/no-zsh.el
  32. +1
    -0
      options/perl.el
  33. +1
    -0
      options/tmux.el
  34. +1
    -0
      options/vim.el
  35. +1
    -0
      options/x.el
  36. +1
    -0
      options/zsh.el
  37. +0
    -23
      osx-nonix.el
  38. +0
    -23
      osx.el
  39. +5
    -1
      perl.org
  40. +105
    -21
      readme.org
  41. +0
    -22
      tangle.el
  42. +7
    -4
      tmux.org
  43. +6
    -3
      vim.org
  44. +9
    -15
      x.org

+ 12
- 4
Makefile Просмотреть файл

@@ -1,6 +1,5 @@
# Makefile is here to make it possible to use this whole shebang # Makefile is here to make it possible to use this whole shebang
# outside of emacs. # outside of emacs.
.PHONY: tangle tangle-next
DEST:=$(HOME) DEST:=$(HOME)
LAST:=$(shell cat .last || echo 0) LAST:=$(shell cat .last || echo 0)
NEXT:=$(shell l=$(LAST); ((l=l+1)); echo $$l) NEXT:=$(shell l=$(LAST); ((l=l+1)); echo $$l)
@@ -8,7 +7,10 @@ NEXTGEN:=$(PWD)/generation/$(NEXT)
LASTGEN:=$(PWD)/generation/$(LAST) LASTGEN:=$(PWD)/generation/$(LAST)
TANGLERS:=$(shell ls -d *.org) TANGLERS:=$(shell ls -d *.org)
GEN:=$(LAST) GEN:=$(LAST)
OPTIONS:=
OPTS:=
HOST:=$(shell uname -n)
USEROPTS:=$(OPTS):$(HOST)
NAME:=default


INSTALLDIRS=tmp $(NEXTGEN) $(LASTGEN) generation/$(GEN) INSTALLDIRS=tmp $(NEXTGEN) $(LASTGEN) generation/$(GEN)


@@ -27,6 +29,7 @@ diff: generation/$(GEN)


next: diff next: diff


.PHONY: tangle-next
tangle-next: tangle-next:
$(MAKE) tangle $(MAKE) tangle
$(MAKE) generation $(MAKE) generation
@@ -38,12 +41,17 @@ copy:
cd $(PWD)/generation/$(GEN) && find . -type f -exec rm -f $(DEST)/{} \; cd $(PWD)/generation/$(GEN) && find . -type f -exec rm -f $(DEST)/{} \;
cd $(PWD)/generation/$(GEN) && cp -r . $(DEST) cd $(PWD)/generation/$(GEN) && cp -r . $(DEST)


.PHONY: tangle
tangle: tmp tangle: tmp
/usr/bin/env emacs --script ./etangle $(TANGLERS)
@echo
USEROPTS=$(USEROPTS) /usr/bin/env emacs --script ./etangle $(TANGLERS)


clean: clean:
-rm -fr tmp -rm -fr tmp


nuke: clean nuke: clean
-rm -fr .last generation -rm -fr .last generation

.PHONY: option
option:
echo "(setq $(NAME)-p t)" > options/$(NAME).el
echo "(setq $(NAME)-p nil)" > options/no-$(NAME).el

+ 101
- 57
bin.org Просмотреть файл

@@ -3,17 +3,21 @@
#+STARTUP: hidestars #+STARTUP: hidestars
#+STARTUP: odd #+STARTUP: odd
#+BABEL: :cache yes #+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 files and other shenanigans


* ~/bin/cidr * ~/bin/cidr

A stupid script I wrote ages ago to help me be lazy with 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 notation for stuff. Setup the wrong netmask a few times and
you too, will wish for something similar. 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 #!/usr/bin/env perl
# #
# Convert input ip/cidr|netmask|hexnetmask to useable network information. # Convert input ip/cidr|netmask|hexnetmask to useable network information.
@@ -159,7 +163,6 @@ foreach my $arg (@ARGV){
#+END_SRC #+END_SRC


* ~/bin/dns * ~/bin/dns

Just a silly dns script that slighly mimics the old host utility Just a silly dns script that slighly mimics the old host utility
of yore. Can also do reverse lookups. 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 216.58.216.206
ord31s21-in-f206.1e100.net is also ord31s21-in-f206.1e100.net 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 #!/usr/bin/env perl
# #
# Stupid script to help with dns information. Solaris 9/8 lack the host utility. # Stupid script to help with dns information. Solaris 9/8 lack the host utility.
@@ -211,10 +214,9 @@ exit 0;
#+END_SRC #+END_SRC


* ~/bin/ts * ~/bin/ts

Stupid simple timestamp script that just takes input, and prefixes a timestamp to to output. Thats it. 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 #!/usr/bin/env perl
# #
# Timestamp stdin and then print to stdout and flush. # Timestamp stdin and then print to stdout and flush.
@@ -237,7 +239,6 @@ while(<STDIN>){
#+END_SRC #+END_SRC


* ~/bin/diskhog * ~/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. 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. Written in anger. Not all that useful nominally.
@@ -264,7 +265,7 @@ $ diskhog -n 4 /tmp
420.57k /private/tmp/sysp.xml 420.57k /private/tmp/sysp.xml
161.17k /private/tmp/KSOutOfProcessFetcher.12572.ppfIhqX0vjaTSb8AJYobDV7Cu68= 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 #!/usr/bin/env perl
# #
# Find out who is hogging disk space and where. # Find out who is hogging disk space and where.
@@ -419,7 +420,6 @@ if ($debug){
#+END_SRC #+END_SRC


* ~/bin/ifinfo * ~/bin/ifinfo

I don't remember now why I wrote this but its just a simpler view I don't remember now why I wrote this but its just a simpler view
of interfaces on a system. 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. 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 #!/usr/bin/env perl
# #
# Because ifconfig output is... overly verbose. # 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 Mostly because I use iso8601 timestamps and its nice to use them
generally without depending on gnu date. 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 #+END_SRC


* ~/bin/whoson * ~/bin/whoson


Basically getent passwd $username/$uid to show who is on a system. 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 #!/usr/bin/env perl
# #
# Because i'm lazy and sick of typing in getent passwd $someusername/uid # 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. 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 #!/usr/bin/env perl
# #
# Dumb wrapper to get the gecos information from a uid/username. # 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. 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 #!/usr/bin/env perl
# #
# hatimerun in perl, sorta # 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. 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 #!/usr/bin/env perl
# #
# ptree for linux/darwin/solaris. I got sick of ps and pstree on linux. # 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. 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 #!/usr/bin/env perl
# #
# Dumb wrapper to get the gecos information from a uid/username. # Dumb wrapper to get the gecos information from a uid/username.
@@ -1000,6 +1000,49 @@ foreach my $input (@ARGV){
} }
#+END_SRC #+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 * ~/bin/notify


OSX only really, just fires off a notification when its ran. OSX only really, just fires off a notification when its ran.
@@ -1008,8 +1051,7 @@ Example:
notify "some command" "not ok" notify "some command" "not ok"


First param is the message, second title of the notification. 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 #!/bin/sh
message=${1:="no message"} message=${1:="no message"}
title='' title=''
@@ -1025,25 +1067,27 @@ osascript -e "${notification}"


* ~/bin/today * ~/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
#+END_SRC #+END_SRC

+ 0
- 23
defaults.el Просмотреть файл

@@ -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)

+ 20
- 15
dotprofile.org Просмотреть файл

@@ -3,7 +3,12 @@
#+STARTUP: hidestars #+STARTUP: hidestars
#+STARTUP: odd #+STARTUP: odd
#+BABEL: :cache yes #+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. ~/.profile setup in all its peculiarities.


@@ -22,7 +27,7 @@


OSX uses hostname -s for getting hostname 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) _host=$(hostname -s)
#+END_SRC #+END_SRC


@@ -34,7 +39,7 @@ _host=${_host:=${_uname_n}}


* PATH * PATH
** haskell ** 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" PATH="${PATH}:${HOME}/.cabal/bin"
#+END_SRC #+END_SRC
** General ** General
@@ -188,7 +193,7 @@ cconv()
#+END_SRC #+END_SRC


** git ** 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() maybe_git_repo()
{ {
# assume https if input doesn't contain a protocol # assume https if input doesn't contain a protocol
@@ -230,7 +235,7 @@ bb()
} }
#+END_SRC #+END_SRC
** haskell ** 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() hmap()
{ {
ghc -e "interact ($*)" ghc -e "interact ($*)"
@@ -247,7 +252,7 @@ hmapw()
} }
#+END_SRC #+END_SRC
** nix ** 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() mk_nix_shell()
{ {
cabal2nix --sha256="0" . \ cabal2nix --sha256="0" . \
@@ -289,7 +294,7 @@ nix-off() {


Workaround stupid ssl crap with recent nix. 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 if [ ! -e ${HOME}/.nonix ]; then
SSL_CERT_FILE="${HOME}/.nix-profile/etc/ssl/certs/ca-bundle.crt" SSL_CERT_FILE="${HOME}/.nix-profile/etc/ssl/certs/ca-bundle.crt"
GIT_SSL_CAINFO=$SSL_CERT_FILE GIT_SSL_CAINFO=$SSL_CERT_FILE
@@ -298,7 +303,7 @@ if [ ! -e ${HOME}/.nonix ]; then
fi fi
#+END_SRC #+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 if [ ! -e ${HOME}/.nonix ]; then
nix_env_setup nix_env_setup
fi fi
@@ -311,7 +316,7 @@ TODO Add linux ca-bundle detection
set -xg SSL_CERT_FILE /etc/ssl/certs/ca-certificates.crt set -xg SSL_CERT_FILE /etc/ssl/certs/ca-certificates.crt


** tmux ** 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() t()
{ {
if [ -z "$1" ]; then if [ -z "$1" ]; then
@@ -324,7 +329,7 @@ t()
} }
#+END_SRC #+END_SRC
** x ** 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() modmap()
{ {
[ -f "${HOME}/.Xmodmap" ] && xmodmap "${HOME}/.Xmodmap" [ -f "${HOME}/.Xmodmap" ] && xmodmap "${HOME}/.Xmodmap"
@@ -361,23 +366,23 @@ alias kille=emacsclient -e "(kill-emacs)"
#+END_SRC #+END_SRC


** osx ** 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' alias o='open -a'
#+END_SRC #+END_SRC
** git ** 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 alias g=git
#+END_SRC #+END_SRC
** haskell ** 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" alias ghce="ghc -e ':l ~/.ghc.hs' -e"
#+END_SRC #+END_SRC
** mosh ** 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 alias m=mosh
#+END_SRC #+END_SRC


** tmux ** 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' alias tl='tmux ls'
#+END_SRC #+END_SRC

+ 20
- 15
emacs.org Просмотреть файл

@@ -3,29 +3,22 @@
#+STARTUP: hidestars #+STARTUP: hidestars
#+STARTUP: odd #+STARTUP: odd
#+BABEL: :cache yes #+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 * prelude


Startup related tasks/setup that might be used later on. 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 *** emacs package setup


Setup the builtin emacs package manager. Setup the builtin emacs package manager.


#+BEGIN_SRC emacs-lisp
#+BEGIN_SRC emacs-lisp :tangle tmp/.emacs.d/init.el :mkdirp yes
(require 'package) (require 'package)
(package-initialize) (package-initialize)
#+END_SRC #+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) (add-to-list 'package-archives '("marmalade" . "http://marmalade-repo.org/packages/") t)
#+END_SRC #+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 *** emacs gc speedup


#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
@@ -717,7 +722,7 @@ setups.


Not tangled into the config intentionally. 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) (defun pkg-config-add-lib-cflags (pkg-config-lib)
"This function will add necessary header file path of a "This function will add necessary header file path of a
specified by `pkg-config-lib' to `flycheck-clang-include-path', which make it specified by `pkg-config-lib' to `flycheck-clang-include-path', which make it


+ 9
- 3
etangle Просмотреть файл

@@ -4,12 +4,18 @@
(require 'org-install) (require 'org-install)
(require 'org) (require 'org)


(load-file "./tangle.el")
(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"))


(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 ;; Iterate through all the files given and tangle them
(dolist (dolist
(file command-line-args-left) (file command-line-args-left)
(princ file)
(print (format "tangling: %s" file))
(org-babel-tangle-file file)) (org-babel-tangle-file file))

+ 73
- 73
git.org Просмотреть файл

@@ -3,41 +3,42 @@
#+STARTUP: hidestars #+STARTUP: hidestars
#+STARTUP: odd #+STARTUP: odd
#+BABEL: :cache yes #+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. General git configuration split out into sections mostly.


* ~/.gitconfig * ~/.gitconfig
:PROPERTIES:
:header-args: :tangle tmp/.gitconfig :comments no :padline no :cache yes :mkdirp yes
:END:
** pager ** 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 #+END_SRC
** color ** 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 #+END_SRC
** alias ** 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] [alias]
begin = !git init && git commit --allow-empty -m 'Initial empty commit' begin = !git init && git commit --allow-empty -m 'Initial empty commit'
up = !git pull --rebase && git push 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+$' 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 # 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 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' defremote = !git branch -rvv | egrep 'HEAD' | awk '{print $1}' | sed -e 's|/HEAD||g'
# short sha # short sha
short = rev-parse --short short = rev-parse --short
@@ -84,75 +85,74 @@ General git configuration split out into sections mostly.
bcs = log --pretty="%H" --first-parent --no-merges bcs = log --pretty="%H" --first-parent --no-merges
find-merge = !sh -c "commit=$0 && branch=${1:-HEAD} && (git rev-list $commit..$branch --ancestry-path | cat -n; git rev-list $commit..$branch --first-parent | cat -n) | sort -k2 | uniq -f1 -d | sort -n | tail -1 | cut -f2" find-merge = !sh -c "commit=$0 && branch=${1:-HEAD} && (git rev-list $commit..$branch --ancestry-path | cat -n; git rev-list $commit..$branch --first-parent | cat -n) | sort -k2 | uniq -f1 -d | sort -n | tail -1 | cut -f2"
show-merge = !sh -c "merge=$(git find-merge $0 $1) && [ -n \"$merge\" ] && git show $merge" show-merge = !sh -c "merge=$(git find-merge $0 $1) && [ -n \"$merge\" ] && git show $merge"
# 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 # push branch while setting the upstream to the default remote
pbr = !git push --set-upstream $(git defremote) $(git bn) 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)' 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)'
# 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'
# Pull all the commits missed from a git pull --depth N clone
unshallow = pull --unshallow
#+END_SRC #+END_SRC
** github ** 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 #+END_SRC
** credential ** 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 #+END_SRC
** advice ** 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 #+END_SRC
** gui ** 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 #+END_SRC
** http ** 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 #+END_SRC
** push ** 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 #+END_SRC
** url rewrites ** 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 #+END_SRC
** username/email ** 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 #+END_SRC


* ~/.gitignore * ~/.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. 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 #+END_SRC

+ 5
- 1
haskell.org Просмотреть файл

@@ -3,7 +3,11 @@
#+STARTUP: hidestars #+STARTUP: hidestars
#+STARTUP: odd #+STARTUP: odd
#+BABEL: :cache yes #+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. Haskell setup.




+ 5
- 1
misc.org Просмотреть файл

@@ -3,7 +3,11 @@
#+STARTUP: hidestars #+STARTUP: hidestars
#+STARTUP: odd #+STARTUP: odd
#+BABEL: :cache yes #+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. Stuff that didn't fit anywhere else.




+ 149
- 143
nix.org Просмотреть файл

@@ -3,154 +3,160 @@
#+STARTUP: hidestars #+STARTUP: hidestars
#+STARTUP: odd #+STARTUP: odd
#+BABEL: :cache yes #+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. 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 :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 ];
}; };
# 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-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;
};
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
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
# 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
];
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
];
};
}; };
};
allowUnfree = true;
}
allowUnfree = true;
}
#+END_SRC #+END_SRC

+ 1
- 0
options/bsd.el Просмотреть файл

@@ -0,0 +1 @@
(setq bsd-p t)

+ 1
- 0
options/emacs.el Просмотреть файл

@@ -0,0 +1 @@
(setq emacs-p t)

+ 1
- 0
options/git.el Просмотреть файл

@@ -0,0 +1 @@
(setq git-p t)

+ 1
- 0
options/haskell.el Просмотреть файл

@@ -0,0 +1 @@
(setq haskell-p t)

+ 1
- 0
options/linux.el Просмотреть файл

@@ -0,0 +1 @@
(setq linux-p t)

+ 1
- 0
options/macos.el Просмотреть файл

@@ -0,0 +1 @@
(setq macos-p t)

+ 1
- 0
options/mosh.el Просмотреть файл

@@ -0,0 +1 @@
(setq mosh-p t)

+ 1
- 0
options/nix.el Просмотреть файл

@@ -0,0 +1 @@
(setq nix-p t)

+ 1
- 0
options/no-bsd.el Просмотреть файл

@@ -0,0 +1 @@
(setq bsd-p nil)

+ 1
- 0
options/no-emacs.el Просмотреть файл

@@ -0,0 +1 @@
(setq emacs-p nil)

+ 1
- 0
options/no-git.el Просмотреть файл

@@ -0,0 +1 @@
(setq git-p nil)

+ 1
- 0
options/no-haskell.el Просмотреть файл

@@ -0,0 +1 @@
(setq haskell-p nil)

+ 1
- 0
options/no-linux.el Просмотреть файл

@@ -0,0 +1 @@
(setq linux-p nil)

+ 1
- 0
options/no-macos.el Просмотреть файл

@@ -0,0 +1 @@
(setq macos-p nil)

+ 1
- 0
options/no-mosh.el Просмотреть файл

@@ -0,0 +1 @@
(setq mosh-p nil)

+ 1
- 0
options/no-nix.el Просмотреть файл

@@ -0,0 +1 @@
(setq nix-p nil)

+ 1
- 0
options/no-perl.el Просмотреть файл

@@ -0,0 +1 @@
(setq perl-p nil)

+ 1
- 0
options/no-tmux.el Просмотреть файл

@@ -0,0 +1 @@
(setq tmux-p nil)

+ 1
- 0
options/no-vim.el Просмотреть файл

@@ -0,0 +1 @@
(setq vim-p nil)

+ 1
- 0
options/no-x.el Просмотреть файл

@@ -0,0 +1 @@
(setq x-p nil)

+ 1
- 0
options/no-zsh.el Просмотреть файл

@@ -0,0 +1 @@
(setq zsh-p nil)

+ 1
- 0
options/perl.el Просмотреть файл

@@ -0,0 +1 @@
(setq perl-p t)

+ 1
- 0
options/tmux.el Просмотреть файл

@@ -0,0 +1 @@
(setq tmux-p t)

+ 1
- 0
options/vim.el Просмотреть файл

@@ -0,0 +1 @@
(setq vim-p t)

+ 1
- 0
options/x.el Просмотреть файл

@@ -0,0 +1 @@
(setq x-p t)

+ 1
- 0
options/zsh.el Просмотреть файл

@@ -0,0 +1 @@
(setq zsh-p t)

+ 0
- 23
osx-nonix.el Просмотреть файл

@@ -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)

+ 0
- 23
osx.el Просмотреть файл

@@ -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)

+ 5
- 1
perl.org Просмотреть файл

@@ -3,7 +3,11 @@
#+STARTUP: hidestars #+STARTUP: hidestars
#+STARTUP: odd #+STARTUP: odd
#+BABEL: :cache yes #+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. Mostly old holdovers from the days of perl, just perlcritic and perltidy configuration.




+ 105
- 21
readme.org Просмотреть файл

@@ -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 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 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/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 #+BEGIN_SRC sh :tangle no
make make
#+END_SRC #+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 (bound-and-true-p 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 But lets say you want to export things to another directory than $HOME. No
worries, just specify DEST: worries, just specify DEST:


@@ -38,15 +57,55 @@ worries, just specify DEST:
make DEST=/some/other/directory make DEST=/some/other/directory
#+END_SRC #+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 #+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 #+END_SRC


Want to copy a specific generation to somewhere else? Or maybe you tested 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 #+BEGIN_SRC sh :tangle no
make copy GEN=N 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. 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? ** How does it work?


It is really rather simple, the [[file:Makefile][Makefile]] isn't that complex. Look at that 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 ** 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... This allows me to tangle files that would be useful for linux/bsd/etc...
without affecting the existing files. 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. and hack in what you need. Your call.


But, say you have a heading, take .profile as an example, under an org mode 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 #+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 generation is built. It gives the Makefile a chance to know if the tangling
worked or not. 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. a file in multiple subparts that have predicates to control things.


Pretty simple, just add a source block like normal: 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! put contents here!
,#+END_SRC


#+END_SRC
#+END_SRC #+END_SRC


* External Tanglers * External Tanglers
@@ -149,7 +233,7 @@ Language specific
| perl | [[file:perl.org][perl.org]] | | perl | [[file:perl.org][perl.org]] |


* TODO * 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 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. - [ ] 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? - [ ] Maybe checksum file contents somehow and use that?


+ 0
- 22
tangle.el Просмотреть файл

@@ -1,22 +0,0 @@
;;-*-mode: emacs-lisp; coding: utf-8;-*-
;; File: tangle.el

;; Load the default options used or what was passed in as OPTIONS
(defun load-defaults-or-options ()
(load-file (if (getenv "OPTIONS")
(concat (concat "./" (getenv "OPTIONS")) ".el")
"./defaults.el")))

;; Define functions we use in :tangle blocks

;; tangle/yn
;; tangle to "yes" or "no" if the predicate given exists and defined as t.
;;
;; Iff predicate is bound, and t, "yes"
;; rest is "no"
(defun tangle/yn (p) (load-defaults-or-options) (if (bound-and-true-p p) "yes" "no"))

;; tangle/file
;; tangle to filename if predicate is bound and t
;; Note, prepends tmp/ to the filename to conform to match expected layout
(defun tangle/file (p file) (load-defaults-or-options) (if (bound-and-true-p p) (concat "tmp/" file) "no"))

+ 7
- 4
tmux.org Просмотреть файл

@@ -2,12 +2,15 @@
#+AUTHOR: Mitch Tishmack #+AUTHOR: Mitch Tishmack
#+STARTUP: hidestars #+STARTUP: hidestars
#+STARTUP: odd #+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. 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 # Setup vi mode by default
set-window-option -g mode-keys vi set-window-option -g mode-keys vi
set-window-option -g aggressive-resize on set-window-option -g aggressive-resize on
@@ -144,7 +147,7 @@ Tmux configuration. Pretty boring in most ways.


Only set xclip for x setup. 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 (and (bound-and-true-p tmux-p) (bound-and-true x-p)))
bind C-p run "tmux set-buffer \"$(xclip -o)\"; tmux paste-buffer" bind C-p run "tmux set-buffer \"$(xclip -o)\"; tmux paste-buffer"
bind C-y run "tmux save-buffer - | xclip -i" bind C-y run "tmux save-buffer - | xclip -i"
#+END_SRC #+END_SRC

+ 6
- 3
vim.org Просмотреть файл

@@ -2,12 +2,15 @@
#+AUTHOR: Mitch Tishmack #+AUTHOR: Mitch Tishmack
#+STARTUP: hidestars #+STARTUP: hidestars
#+STARTUP: odd #+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. 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 nocompatible
set backspace=indent,eol,start set backspace=indent,eol,start
set history=50 " keep 50 lines of command line history set history=50 " keep 50 lines of command line history


+ 9
- 15
x.org Просмотреть файл

@@ -2,19 +2,19 @@
#+AUTHOR: Mitch Tishmack #+AUTHOR: Mitch Tishmack
#+STARTUP: hidestars #+STARTUP: hidestars
#+STARTUP: odd #+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. X related configuration, nothing overly huge to be honest just stupid configuration.


* ~/.Xdefaults * ~/.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. 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 generalish stuff
! !
urxvt*termName: rxvt-256color urxvt*termName: rxvt-256color
@@ -35,30 +35,24 @@ urxvt*allowWindowOps: true
#+END_SRC #+END_SRC


* ~/.Xmodmap * ~/.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. 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 pointer = 3 2 1 4 5
#+END_SRC #+END_SRC


OSX is odd/inverted cause reasons (who cares why). 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 pointer = 1 2 3 4 5
#+END_SRC #+END_SRC


* ~/.Xresources * ~/.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. 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 brightblack #ffffff
#define normblack #f9f9f9 #define normblack #f9f9f9
#define normgreen #00cc33 #define normgreen #00cc33


Загрузка…
Отмена
Сохранить