Merge branch 'master' of vps:git/vimwiki

This commit is contained in:
David Thurstenson 2017-02-18 21:59:14 -06:00
commit 225ad03238
6 changed files with 7367 additions and 21 deletions

View File

@ -1,15 +1,73 @@
=Bashrc= =Bashrc=
Current configuration can always be found at https://git.thurstylark.com/vcsh/bashrc.git Source: https://git.thurstylark.com/vcsh/bashrc.git
---- ----
==Prompt== ==Prompt==
I originally built my prompt using http://bashrcgenerator.com and, while it's a nice tool for visually building a prompt, it has several limitations on what you're able to create with it. But more importantly to me, it generates a rediculously long string, defines and resets color for every single character, uses both a color and bold escape sequence to use light/bright colors, mixes raw escape sequences and subshells running tput, and as a result is utterly unreadable and unmaintainable.
So, I replaced it:
{{{class="prettyprint"
### PROMPT ###
promptsetup() {
# Color definitions for prompt
local fg_brightred='\[$(tput setaf 9)\]'
local fg_blue='\[$(tput setaf 4)\]'
local fg_magenta='\[$(tput setaf 13)\]'
local fg_cyan='\[$(tput setaf 6)\]'
local fg_brightcyan='\[$(tput setaf 14)\]'
local reset='\[$(tput sgr0)\]'
# [hh:mm][username@hostname pwd]$
if [ -n "$SSH_CLIENT" ]; then
# Remotely, hostname is red.
PS1="${fg_blue}[\A]${fg_cyan}[${fg_brightcyan}\u${fg_cyan}@${fg_brightred}\h ${fg_cyan}\W]${reset}\$ "
elif [ -n "$VCSH_REPO_NAME" ]; then
# If in a vcsh repo env, add repo name in magenta.
PS1="${fg_blue}[\A]${fg_cyan}[${fg_brightcyan}\u${fg_cyan}@\h ${fg_magenta}$VCSH_REPO_NAME ${fg_cyan}\W]${reset}\$ "
else
# Locally, hostname is cyan.
PS1="${fg_blue}[\A]${fg_cyan}[${fg_brightcyan}\u${fg_cyan}@\h \W]${reset}\$ "
fi
}
promptsetup
}}}
I intentionally put everything in a function and call it immediately so I may use local vars for the color definitions. I didn't really want to leave them around just in case.
---- ----
==Profile== ==Profile==
Bash chooses which dotfile to source based on how it gets run. If starting from a login shell, `~/.bash_profile` will get sourced, but if there's not a command in there to source your `~/.bashrc`, you may find yourself having to `exec bash` after starting bash. This can be fixed by adding the following line to your `~/.bash_profile`:
{{{class="prettyprint"
[[ -f ~/.bashrc ]] && . ~/.bashrc
}}}
I also use `~/.bash_profile` for setting numlock while in a tty:
{{{class="prettyprint"
case $(tty) in /dev/tty[0-9]*)
setleds -D +num # (numlock for X is set in ~/.xinitrc)
;;
esac
}}}
The last thing of note in my `~/.bash_profile` is a warning:
{{{class="prettyprint"
# Temporary fix for a systemd bug related to systemd --user timers that run on login
[[ -z "$DBUS_SESSION_BUS_ADDRESS" ]] && printf "%bWARNING: \$DBUS_SESSION_BUS_ADDRESS is unset! %b\n" "$(tput bold)$(tput setab 1)" "$(tput sgr0)"
}}}
---- ----
==Weechat== ==Weechat==
@ -24,3 +82,22 @@ The alias portion of my [[Weechat]] configuration is set in the .bashrc like so:
}}} }}}
For more info, see the [[Weechat]] page. For more info, see the [[Weechat]] page.
----
==Get Dell Service Tag==
I work with Dell machines a lot, and when dealing with hardware problems, it's nice to have the service tag handy. Lucky for me, the service tag is easily retrieveable using `dmidecode(1)`, so I made a function for it.
{{{class="prettyprint"
# Print Dell Service Tag
getdst() {
if [[ "$1" = "-l" ]]; then
printf "http://www.dell.com/support/home/us/en/04/product-support/servicetag/%s\n" "$(getdst)"
else
sudo dmidecode -s system-serial-number
fi
}
}}}
As an added bonus, the `-l` option will print the url for that product's support page.

View File

@ -123,7 +123,7 @@ git checkout -f
vim -u /tmp/vimwiki/html-template/srv-vimrc -c VimwikiAll2HTML -c q /tmp/vimwiki/index.wiki vim -u /tmp/vimwiki/html-template/srv-vimrc -c VimwikiAll2HTML -c q /tmp/vimwiki/index.wiki
cp /tmp/vimwiki/html-template/slate.bootstrap.min.css /srv/wiki/ cp /tmp/vimwiki/html-template/slate.bootstrap.css /srv/wiki/
rm -rf /tmp/vimwiki rm -rf /tmp/vimwiki
}}} }}}

View File

@ -93,10 +93,10 @@ This allows you to replace any instance of the full `xinput(1)` command with `ma
I want the default PulseAudio sink to change to HDMI when HDMI is plugged in, and back to analog when disconnected. I want the default PulseAudio sink to change to HDMI when HDMI is plugged in, and back to analog when disconnected.
Changing the default sink in pulse is as easy as running `pacmd set-default-sink <sink id>` where `<sink id>` is the id of the desired sink. Unfortunately, this is another situation where the id might change unexpectedly. We also don't have an easy interface to determine the id number from a name like we did with `xinput(1)`, so we're forced to parse the output of `pacmd list short` like so: Changing the default sink in pulse is as easy as running `pacmd set-default-sink <sink id>` where `<sink id>` is the id of the desired sink. Unfortunately, this is another situation where the id might change unexpectedly. We also don't have an easy interface to determine the id number from a name like we did with `xinput(1)`, so we're forced to parse the output of `pactl list sinks short` like so:
{{{class="prettyprint" {{{class="prettyprint"
pacmd set-default-sink $(pacmd list short | grep "hdmi" | grep -o "^\S\+") pacmd set-default-sink $(pactl list sinks short | grep "hdmi" | grep -o "^\S\+")
}}} }}}
This command lists all sinks in short form, then greps for a line containing "hdmi", uses grep to only print the first character (the sink id), then sets the default sink with `pacmd(1)`. Since this will also need to be run any time the display configuration changes, a function is, again, appropriate: This command lists all sinks in short form, then greps for a line containing "hdmi", uses grep to only print the first character (the sink id), then sets the default sink with `pacmd(1)`. Since this will also need to be run any time the display configuration changes, a function is, again, appropriate:
@ -105,11 +105,11 @@ This command lists all sinks in short form, then greps for a line containing "hd
setpasink() { setpasink() {
# setpasink <name> # setpasink <name>
# Find a unique string in the output of `pacmd list short` to use for <name> # Find a unique string in the output of `pacmd list short` to use for <name>
pacmd set-default-sink $(pacmd list short | grep "$1" | grep -o "^\S\+") pacmd set-default-sink $(pactl list sinks short | grep "$1" | grep -o "^\S\+")
} }
}}} }}}
This allows you to change the default PulseAudio sink with `setpasink <name>` where `<name>` is any arbitrary string that is unique to the line that corresponds to the desired sink in the output of `pacmd list short`. This allows you to change the default PulseAudio sink with `setpasink <name>` where `<name>` is any arbitrary string that is unique to the line that corresponds to the desired sink in the output of `pactl list sinks short`.
---- ----

View File

@ -20,7 +20,7 @@
<link rel="stylesheet" href="https://cdn.rawgit.com/afeld/bootstrap-toc/v0.4.1/dist/bootstrap-toc.min.css"> <link rel="stylesheet" href="https://cdn.rawgit.com/afeld/bootstrap-toc/v0.4.1/dist/bootstrap-toc.min.css">
<!-- Slate theme --> <!-- Slate theme -->
<link rel="stylesheet" href="https://wiki.thurstylark.com/slate.bootstrap.min.css"> <link rel="stylesheet" href="https://wiki.thurstylark.com/slate.bootstrap.css">
<!-- Latest compiled and minified JavaScript --> <!-- Latest compiled and minified JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
@ -101,15 +101,16 @@ $("table").addClass("table table-condensed table-hover");
<div class="container-fluid"> <div class="container-fluid">
<br/> <br/>
<div class="row"> <div class="row">
<div class="col-md-2 col-md-offset-1"> <div class="col-md-2">
<nav id="toc" data-spy="affix" data-toggle="toc" class="affix well well-sm pull-right"></nav> <nav id="toc" data-spy="affix" data-toggle="toc" class="affix well well-sm pull-right">Index</nav>
</div><!--col-md-1--> </div><!--col-md-1-->
<div class="col-md-6"> <div class="col-md-9">
<div class="well"> <div class="well">
%content% %content%
</div><!--well--> </div><!--well-->
</div> <!--col-md-8 --> </div> <!--col-md-8 -->
</div> <!-- row --> </div> <!-- row -->
<hr/>
</div><!--container-fluid--> </div><!--container-fluid-->
</body> </body>
</html> </html>

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long