Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Moving things to posix-dots

  • Loading branch information...
commit 208faae705615c945d4e6c986ce94a5221209ebe 1 parent f6ac537
@rking rking authored rkingpa@sharpsaw.org committed
View
2  ...deps
@@ -1 +1 @@
-tmux-dots
+posix-dots
View
3  .gitmodules
@@ -1,3 +0,0 @@
-[submodule ".vim/bundle/vim-eunuch"]
- path = .vim/bundle/vim-eunuch
- url = git://github.com/tpope/vim-eunuch
1  .vim/bundle/vim-eunuch
@@ -1 +0,0 @@
-Subproject commit e7750c1cbd88ac1d30a31614f810dbe64d674eb5
View
30 README.md
@@ -3,6 +3,8 @@ linux-dots
Scripts and dotfiles for working on various Linux systems (based on `...`)
+Note that this depends on `posix-dots` for completeness.
+
Much TODO to be had around here.
Context
@@ -17,31 +19,23 @@ Requires: https://github.com/sharpsaw/perl-dots (for its bin/bin-docs)
Update by having sharpsaw/perl-dots then Y@" on the next line:
jjV}k!bin-docs
-->
-* `,M` ⇒ Configure & make install, passing $DOT\&CONFIGURE\&ARGS to ./configure, and using $MAKE\&INSTALL\&SU prepended to the 'make install' command.
-* `,colortest` ⇒ Print 8- and 256-color tables.
-* `,config-kernel-install``cd /usr/src/linux && sudo make menuconfig && ,kernel-install "$@"`
-* `,gdb-bt-full``exe=$1`
-* `,i` ⇒ Package install using emerge or aptitude, whichever's available.
+* `,config-kernel-install` ⇒ make menuconfig then do a ,kernel-install. Backs up .config to ~/.backup-kernel-configs/
+* `,grub` ⇒ Mount /boot, edit /boot/grub/grub.conf, install if you don't :cq vim
* `,init-add``sudo /etc/init.d/$1 start`
* `,kernel-install` ⇒ Perform some steps to install a kernel. Set DRIVE=… to override default of /dev/sda, SUDO='' to override sudo, and MAKEFLAGS=… to override -j5.
-* `,ls`List the files belonging to a given package
-* `,s`Package search using eix or aptitude, whichever's present.
-* `,var-log`Tail -f all non-binary, non-"old" log files in /var/log
+* `,loadkeys`` echo "Doesn't seem to be a console, so loadkeys probably won't work."`
+* `,usbtree``#`
+* `,wifi`Wifi startup sequence (using dhcpcd and possibly using wpa_supplicant)
* `,xsession-errors` ⇒ A simple tail on ~/.xsession-errors. Will probably add grep -v's to filter.
-* `aptU``sudo aptitude update; sudo aptitude dist-upgrade "$@"`
* `apti` ⇒ Use aptitude or apt-get to install a package.
* `apts` ⇒ Use aptitude or apt-cache to search for a package.
-* `aptsh``aptitude show "$@"`
-* `aptu``sudo aptitude update "$@"`
-* `aptui``sudo aptitude update; sudo aptitude install "$@"`
+* `aptsh``aptitude show <args>`
+* `aptu``sudo aptitude update <args>`
+* `aptui``sudo aptitude update; sudo aptitude install <args>`
* `autounmask-write` ⇒ Runs an `emerge` when mask failures. Good as `autounmask-write !!`
-* `brogrammer``sudo useradd -m -G hax0rs $1`
+* `brogrammer``sudo useradd -m -G pair $1`
* `cat-p` ⇒ Swipe stdout from another program by pid (using strace -p)
-* `clip``xsel -b "$@"`
-* `fack` ⇒ find -iname + ack -ila
-* `finame``find . -iname "*$1*"`
-* `rm-``[ ! -s "$1" ] || (echo "File not empty, not deleting."; exit 37)`
-* `ssh-port-forward` ⇒ Just a handy script, because I find this invocation confusing. Don't forget -v.
+* `clip``xsel -b <args>`
There are some useful bits still over at: http://github.com/sharpsaw/local-dots
View
5 bin/,M
@@ -1,5 +0,0 @@
-#!/bin/sh
-## Configure & make install, passing $DOT_CONFIGURE_ARGS to ./configure, and using $MAKE_INSTALL_SU prepended to the 'make install' command.
-# TODO: Make this automatically configure for DOT_CONFIGURE_ARGS and sudo.
-( [ -e configure ] || ./autogen.sh ) && \
- ./configure $DOT_CONFIGURE_ARGS && $MAKE_INSTALL_SU make install
View
61 bin/,colortest
@@ -1,61 +0,0 @@
-#!/usr/bin/env ruby
-# Print 8- and 256-color tables.
-
-class String
- def visible_length
- # only knows about newlines and "\e[m"-escapes
- gsub(/(.*\n|\e.*?m)/, '').length
- end
-end
-
-class LineBrokenOutput
- COLUMNS = (ENV['COLUMNS'] || 80).to_i
- def initialize
- @buf = ''
- end
- def put atomic_str
- flush if COLUMNS < (@buf + atomic_str).visible_length
- @buf += atomic_str
- end
- def flush
- puts @buf
- @buf = ''
- end
-end
-
-out = LineBrokenOutput.new
-
-puts '256-color mode ("\\e[38;5;___m"):'
-[
- (0..15),
- *(16..256).each_slice(6),
-].each do |row|
- row.each do |c|
- out.put "\e[38;5;%sm%3s\e[0m " % [c, c]
- end
- out.flush
-end
-
-out.put "\n16-color mode:"
-0.upto(16) do |c|
- adjusted = 30+c
- out.put "\e[#{adjusted}m#{adjusted}\e[m "
-end
-
-out.put "\n Extras: "
-extras = {
- 'reset' => 0,
- 'bold' => 1,
- 'faint' => 2,
- 'italic' => 3,
- 'underline' => 4,
- 'blink' => 5,
- 'fastblink' => 6,
- 'reverse' => 7,
- 'concealed' => 8,
- 'strikeout' => 9,
-}
-extras.each do |key, c|
- out.put "\e[#{c}m#{key}(#{c})\e[0m "
-end
-out.flush
View
8 bin/,gdb-bt-full
@@ -1,8 +0,0 @@
-#!/bin/sh
-exe=$1
-core=$2
-if [ -z "$exe" -o -z "$core" ]; then
- echo "Should be: $(basename $0) theexe corefile"
- exit 1
-fi
-gdb $exe --core $core --batch --quiet -ex "thread apply all bt full" -ex "quit"
View
17 bin/,i
@@ -1,17 +0,0 @@
-#!/bin/bash -e
-## Package install using emerge or aptitude, whichever's available.
-has() { type $1 &>/dev/null; }
-if has emerge; then
- sudo emerge -atv "$@"
-elif has aptitude; then
- sudo aptitude install "$@"
-elif has apt-get; then
- sudo apt-get install "$@"
-elif has zypper; then
- sudo zypper -n install "$@"
-elif has brew; then
- brew install "$@"
-else
- echo "Found none of emerge, aptitude, apt-get, zypper, brew in $PATH"
- echo "Perhaps you can teach \`,i\` how to work for your system?"
-fi
View
18 bin/,ls
@@ -1,18 +0,0 @@
-#!/bin/bash -xe
-## List the files belonging to a given package
-if [ -e /etc/gentoo-release ]; then
- if ! type qlist &>/dev/null; then
- echo ",i portage-utils # for this to work."
- exit 2
- fi
- qlist "$@"
-elif type dpkg &>/dev/null; then
- dpkg -L "$@"
-elif type rpm &>/dev/null; then
- rpm -ql "$@"
-elif type brew &>/dev/null; then
- brew list "$@"
-else
- echo ",ls needs to be updated for this distro."
-fi
-
View
11 bin/,provides
@@ -1,11 +0,0 @@
-#!/bin/bash -xe
-## Show which package provides a certain file (for Apt and Portage)
-if type apt-file &>/dev/null; then
- apt-file search "$@"
-elif type e-file &>/dev/null; then
- e-file "$@"
-elif type zypper &>/dev/null; then
- zypper what-provides "$@"
-else
- echo "No apt-file or e-file found. ☹"
-fi
View
17 bin/,s
@@ -1,17 +0,0 @@
-#!/bin/bash -e
-has() { type $1 &>/dev/null; }
-## Package search using eix or aptitude, whichever's present.
-if has eix; then
- eix "$@"
-elif has aptitude; then
- aptitude search "$@"
-elif has apt-cache; then
- apt-cache search "$@"
-elif has zypper; then
- zypper search "$@"
-elif has brew; then
- brew search "$@"
-else
- echo "Found none of exi, aptitude, apt-cache, zypper, brew in $PATH"
- echo "Perhaps you can teach \`,s\` how to work for your system?"
-fi
View
11 bin/,uninstall
@@ -1,11 +0,0 @@
-#!/bin/bash -xe
-## Uninstall (for Apt and Portage)
-if type aptitude &>/dev/null; then
- sudo aptitude remove "$@"
-elif type emerge &>/dev/null; then
- ,i -C "$@"
-if type zypper &>/dev/null; then
- sudo zypper remove "$@"
-else
- echo "No apitude or emerge found. ☹"
-fi
View
12 bin/,var-log
@@ -1,12 +0,0 @@
-#!/usr/bin/env ruby
-types_lines = `sudo zsh -c 'file /var/log/**/*'`.split $/
-legible_logs = types_lines.map{|e| e.split /: +/}.reject do |log, type|
- %w(directory data compressed empty DBase COFF).find {|bad| type[bad]}
-end.map {|log, type| log }.sort_by do |log|
- case log
- when /messages$/; 2
- when /nginx/; 1
- else 0
- end
-end
-system *(%w(sudo tail -F) + legible_logs)
View
5 bin/fack
@@ -1,5 +0,0 @@
-#!/bin/sh -xe
-## find -iname + ack -ila
-for n in "$@"; do
- finame $n & ack -ila $n
-done
View
2  bin/finame
@@ -1,2 +0,0 @@
-#!/bin/sh -xe
-find . -iname "*$1*"
View
7 bin/freshsh
@@ -1,7 +0,0 @@
-#!/bin/sh -xe
-home=/tmp/$$
-if [ $# -gt 0 ]; then
- home=$1; shift
-fi
-[ -e $home ] || mkdir $home
-env -i TERM=$TERM HOME=$home $SHELL -f
View
3  bin/rm-
@@ -1,3 +0,0 @@
-#!/bin/sh -xe
-[ ! -s "$1" ] || (echo "File not empty, not deleting."; exit 37)
-rm "$1"
View
89 bin/ssh-port-forward
@@ -1,89 +0,0 @@
-#!/bin/bash -e
-## Just a handy script, because I find this invocation confusing. Don't forget -v.
-ESC=$'\033'
-NOTICE_COLOR="$ESC[32m"
-PUBLIC_HOST_COLOR="$ESC[32m"
-PUBLIC_PORT_COLOR="$ESC[34m"
-LOCAL_PORT_COLOR="$ESC[33m"
-DEFAULT_COLOR="$ESC[0m"
-
-main() {
- if [ $# = 3 ]; then
- public_addr=$1
- public_port=$2
- local_port=$3
- else
- echo $#
- clues
- prompt
- fi
- go_go_go
- kill_howto
-}
-
-go_go_go() {
- echo "Running: ssh -fNR ${PUBLIC_PORT_COLOR}$public_port${DEFAULT_COLOR}:localhost:${LOCAL_PORT_COLOR}$local_port ${PUBLIC_HOST_COLOR}$public_addr${DEFAULT_COLOR} $@"
-
- # You could skip this whole script if you could remember the following
- # args.
- # I can't.
- R_arg=$public_port:localhost:$local_port
- ssh -fNR $R_arg $public_addr "$@"
- # BTW thanks to Freenode's #gentoo's marduk for pointing out -fN !
-}
-
-clues() {
- cat <<EOT
- ${NOTICE_COLOR}Some hints:$DEFAULT_COLOR
-
- Let's say you want the current machine's port ${LOCAL_PORT_COLOR}3000${DEFAULT_COLOR}
- to be publicly accessible via your ssh account as
- ${PUBLIC_HOST_COLOR}someserver.com${DEFAULT_COLOR}:${PUBLIC_PORT_COLOR}9000${DEFAULT_COLOR}, which happens to accept
- ssh connections from a nonstandard port, ${PUBLIC_HOST_COLOR}2222${DEFAULT_COLOR}.
- Your answers would be like this:
-EOT
-
- cat <<EOT
-
- ${DEFAULT_COLOR}Public address: ${PUBLIC_HOST_COLOR}someserver.com -p 2222
- ${DEFAULT_COLOR}Public port: ${PUBLIC_PORT_COLOR}9000
- ${DEFAULT_COLOR}Local port: ${LOCAL_PORT_COLOR}3000
- $DEFAULT_COLOR
-
-EOT
-
- cat <<EOT
- …after running that you'll be able to connect to, say,
- http://${PUBLIC_HOST_COLOR}someserver.com${DEFAULT_COLOR}:${PUBLIC_PORT_COLOR}9000${DEFAULT_COLOR}
- and it will pipe into your localhost:${LOCAL_PORT_COLOR}3000${DEFAULT_COLOR}.
-EOT
-
- echo
-}
-
-prompt() {
- read -ep "${DEFAULT_COLOR}Public address: ${PUBLIC_HOST_COLOR}" public_addr
- read -ep "${DEFAULT_COLOR}Public port: ${PUBLIC_PORT_COLOR}" public_port
- read -ep "${DEFAULT_COLOR}Local port: ${LOCAL_PORT_COLOR}" local_port
- echo -n $DEFAULT_COLOR
-}
-
-kill_howto() {
- find_pid="ps aux | grep \"[s]sh..fNR.$R_arg\" | awk \"{print\\\$2}\""
- cat <<EOT
-
- ${NOTICE_COLOR}OK.$DEFAULT_COLOR
-
- Now $PUBLIC_HOST_COLOR$public_addr:$PUBLIC_PORT_COLOR$public_port$DEFAULT_COLOR tunnels into $LOCAL_PORT_COLOR$local_port$DEFAULT_COLOR.
-
- You can close it down whenever with:
-
- ${NOTICE_COLOR}kill $(eval $find_pid)$DEFAULT_COLOR
-
- Or, if you forget that PID, you can find it with something like
-
- ${NOTICE_COLOR}kill \$($find_pid)$DEFAULT_COLOR
-EOT
-}
-
-main "$@"
Please sign in to comment.
Something went wrong with that request. Please try again.