Dotfiles, utilities, and other apparatus.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

268 lines
11 KiB

2 years ago
5 years ago
2 years ago
2 years ago
1 year ago
2 years ago
1 year ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
4 years ago
  1. bpb-kit
  2. =======
  3. **The canonical copy of this repository [lives on code.p1k3.com][bpb-kit].**
  4. This repo is for dotfiles, utility scripts, and other things in my personal
  5. setup. Ideally, it includes most of the bits and pieces that make a personal
  6. machine usable for me. It occasionally serves as a testbed for things that
  7. become standalone projects, or get cycled into stuff I do for a living.
  8. I generally use Debian and Debian-like GNU/Linux systems (sometimes including
  9. Ubuntu), with the [xmonad][xmonad] tiling window manager rather than a full
  10. desktop environment like Gnome or KDE. I usually edit text in Vim, with
  11. [VimWiki][vimwiki] for notes. I maintain a website called [p1k3][p1k3] using
  12. [wrt][wrt].
  13. I have a [partially-finished book about the command line][userland] which may
  14. be relevant.
  15. status
  16. ------
  17. As of July 2022, this collection is actively maintained, although it doesn't
  18. meet the standards of quality, consistency, or documentation you'd want from a
  19. real software project.
  20. (Then again, neither do most software projects.)
  21. copying
  22. -------
  23. Except as noted below or in the body of specific files, and to the extent
  24. possible under law, I, Brennen Bearnes, waive all copyright and related or
  25. neighboring rights to the contents of bpb-kit. Go to town.
  26. a philosophical note about copying
  27. ----------------------------------
  28. In the _general case_, I've long tended to use strong copyleft licenses like
  29. the GNU General Public License. Where I have the option, I'll generally
  30. license more substantial projects with a view towards impeding the corporate
  31. capture of every available computational resource and generally throwing a
  32. little grit in the gears of capital in these latter days before it finishes
  33. murdering the entire biosphere. (No one uses my software, so this is a purely
  34. symbolic gesture.)
  35. All that said, this is a trivial repository of configuration fragments and
  36. utility scripts for a limited audience. It will do the most good if nobody has
  37. to worry about the bureaucracy of grabbing bits and pieces of it.
  38. From time to time, I _may_ incorporate code from other sources in this
  39. collection, as long as it's in the public domain or under a license that meets
  40. the Debian Free Software Guidelines. In the latter case, I'll do my best to
  41. ensure that said code is clearly marked.
  42. sources
  43. -------
  44. I have thiefed ideas and fragments of configuration from, at least, the
  45. following projects:
  46. - [Advanced Bash Scripting Guide][bash-guide], Mendel Cooper
  47. - [Learn Vimscript the Hard Way][vimscript], Steve Losh
  48. - [ArchWiki][archwiki]
  49. And people:
  50. - [Alan][alan]
  51. - Ahmon
  52. - [Ben][ben]
  53. - [Casey][casey]
  54. - [Chris][chris]
  55. - [Dave][dave]
  56. - [Jacky][jacky-alcine]
  57. - [Leah][leah]
  58. - [Lars][lars]
  59. - Mukunda
  60. - [Rob][rob]
  61. - [Todd][todd]
  62. - [Tyler][tyler]
  63. - [Victoria][victoria-drake]
  64. contents
  65. --------
  66. ### a note about languages
  67. Apart from shell, I tend to reach for Perl for smalltime local utilities. It's
  68. a language I've been comfortable in for 20 years, it offers a decent stdlib and
  69. a ton of good libraries by way of CPAN, and it's installed pretty much
  70. everywhere. It's also extremely honed for string manipulation, which in
  71. practice is the technique that glues most of my nonsense together.
  72. You might also find examples of Python, PHP, Ruby, awk, JavaScript, HTML/CSS,
  73. etc.
  74. ### shell stuff
  75. At this writing I use ZSH on personal systems and Bash when writing tutorials,
  76. doing tech support, or working on production server systems. I like to keep
  77. lots and lots of history. I think shell scripting is in many ways a nightmare
  78. for programs longer than a few lines, but I do it pretty often anyway.
  79. - [`.bashrc`](home/.bashrc)
  80. - [`.zshrc`](home/.zshrc) - nothing fancy
  81. - [`.sh_common`](home/.sh_common) - aliases and variables for both Bash and ZSH;
  82. no Bash compatibility guarantees here, since I mostly don't use custom
  83. aliases in Bash
  84. ### scripts in [home/bin/](home/bin)
  85. Scripts here fall into a handful of categories:
  86. - Short wrappers for getting (or remembering) specific behavior from other
  87. tools
  88. - Screenshot and screencast tools, used at one time in my work as a writer
  89. for DigitalOcean and Adafruit and kept because I got used to the
  90. convenience
  91. - Things for working with the [p1k3][p1k3] repo and site
  92. - Text filters and template fragments, mostly for use with Vim aliases
  93. - Stuff I use for working with my personal notes
  94. - Miscellaneous utilities
  95. Many of these are unlikely to be portable, useful, or documented.
  96. TODO: Migrate these descriptions to the scripts themselves so they can be
  97. automatically extracted.
  98. - `cheat`: a place to hang a personal cheatsheet of sorts
  99. - `chrome-incognito`: run Google Chrome in incognito mode
  100. - `dmenu_unique`: run dmenu with big fonts and vertical, only showing each entry once
  101. - `dog`: concatenate argument strings with stdin
  102. - `edit-clipboard`: edit the current text selection in `$EDITOR` (requires `xclip`)
  103. - `enterprise`: play a sound like the _USS Enterprise_ engines in TNG
  104. - `filter-decorate`: splat some text dingbats into HTML I write sometimes
  105. - `filter-exec`: replace text in-between markers with result of shell-script execution
  106. - `filter-exec-raw`: like above, but different
  107. - `filter-exec-stdin`: feed text in-between markers to standard input of a command, replace it with output
  108. - `filter-markdownify`: convert a few things in old DigitalOcean tutorials to Markdown
  109. - `filter-vertical`: verticalize a string
  110. - `firefox-fromselection`: open a selected url in firefox
  111. - `fragment-bullet`: print out a "random" dingbat character
  112. - `fragment-entry`: stub blog entry
  113. - `fragment-entry-gallery`: stub blog entry with gallery
  114. - `fragment-entry-poem`: stub blog entry with poem
  115. - `get-external-ip`: print public IP address
  116. - `gif-sel`, `gif-sel-4`, `gif-sel-15`: take an animated gif of selected screen region
  117. - `git-diff-wrapper`: use vim with `git-diff-tool`
  118. - `git-local-to-remote-status`
  119. - `grab`, `grab-sel`: take a screenshot, take a screenshot of a selected region
  120. - `json_decode.php`: decode JSON into PHP data structures
  121. - `jsonprint.pl`: pretty-print JSON with Perl
  122. - `jump-to-window`: use `wmctrl` and `dmenu` to pick a window to jump to
  123. - `listusers`: print an HTML list of users
  124. - `lynx-wrapper-edit`: edit a p1k3 entry in vim and re-render everything
  125. - `machine-status`: use `dsh` to check status on a list of machines (stub)
  126. - `mostrecent`: print the name of newest file in the current directory
  127. - `notesession`: start a tmux named session for notes
  128. - `photocp`: copy photos from various media to a home directory location
  129. - `pmwhich`: find the on-filesystem location of a Perl module
  130. - `rightnow`: print the current time in a variety of formats
  131. - `saytime`: speak the time with Festival
  132. - `snowday`: is it a snow day for the Boulder Valley School District?
  133. - `ssh-nofucks`: SSH to an address, I don't really care if the key has changed
  134. - `st`: get status using myrepos
  135. - `timelog`: parse a timelogging format (I use this to bill for contracting)
  136. - `timeslice`: aggregate some data for a given date range or file's implied date
  137. - `today`: print a date
  138. - `todaydir`: find a p1k3 dir for the current date
  139. - `uni`: search unicode codepoint names (via @chneukirchen)
  140. - `unsorted-unique`: print all lines of input once (just an `awk` one-liner)
  141. - `wip`: move a p1k3 file into a work-in-progress directory
  142. - `words`: split input into individual words
  143. - `wthr`: use unicode snowflakes to display CPU load
  144. - `xm`: call xmodmap
  145. - `xmonad.start`: personal version of xmonad startup script
  146. - `xtfix`: do a subtle color shift within the current xterm
  147. - `yank`, `put`, `put-mv`: stash a file path, copy or move it to the current directory
  148. ### fragments
  149. The [fragments](home/fragments) directory is for code snippets that I write in the
  150. course of testing some idea, checking a technique, or trying to solve a problem
  151. posed by friends.
  152. They're typically the kind of thing I'd throw in a random file called something
  153. like `test.sh` and overwrite later. It seemed useful to start collecting these
  154. instead.
  155. ### cheatsheets
  156. The [cheatsheets](home/cheatsheets) directory is mostly empty, but may become a
  157. repository of useful shorthand documentation for the increasingly-many things I
  158. use that are not discoverable or memorable enough for my deteriorating
  159. long-term memory.
  160. ### tmux
  161. I use `tmux` for terminal multiplexing (i.e., most of what GNU Screen does).
  162. In practice, this means that I rely on it for
  163. - persistent shell sessions, sometimes attached to multiple machines
  164. - putting a bunch of shell / editor buffers inside one `ssh` or `mosh`
  165. session
  166. - capturing and scrolling back through a bunch of output
  167. My [`.tmux.conf`](home/.tmux.conf) is brief, but does contain one useful
  168. snippet for correcting weird Esc-key behavior in Vim.
  169. ### vim config
  170. My Vim setup was once written to be easily copied by new users. It's gotten a
  171. bit out of hand since then.
  172. - [`vimrc`](home/.vim/vimrc) - see file for installation details
  173. - uses [Vundle][vundle] to manage plugins
  174. - pulls in a ton of plugins, some more useful than others
  175. - has a bunch of customization for [VimWiki][vimwiki]
  176. I don't use Neovim because I've never gotten it to work for my config without
  177. serious glitches. (At this writing, I had last made a serious attempt in late
  178. 2021.)
  179. ### window management
  180. - `.xmodmap`
  181. - capslock -> ctrl
  182. - `.xinitrc`
  183. - sources `.hacksrc` if it exists
  184. - `.Xresources` tweaks xterm behavior and a number of fonts
  185. - behavior changes depending on whether `.hacksrc` is linked to
  186. `.hacksrc_hi_dpi`
  187. - XMonad config -
  188. - `.xmobarrc`, `.xmonad/`
  189. - see [`bin/xmonad.start`](bin/xmonad.start) for a drop-in replacement for
  190. default XMonad startup on some Debian-like systems, including Gnome/Unity
  191. stuff and the like. Perpetually not-quite-right.
  192. building a debian package for dependencies
  193. ------------------------------------------
  194. See instructions in [ns-control](ns-control).
  195. I haven't done this for a while, so it's probably out of date.
  196. [alan]: https://github.com/acg
  197. [archwiki]: https://wiki.archlinux.org/
  198. [bash-guide]: http://www.tldp.org/LDP/abs/html/
  199. [ben]: https://github.com/benlemasurier
  200. [bpb-kit]: https://code.p1k3.com/gitea/brennen/bpb-kit
  201. [code]: https://code.p1k3.com/
  202. [casey]: https://github.com/caseydentinger/
  203. [chris]: https://github.com/frencil
  204. [dave]: https://stilldavid.com/
  205. [leah]: https://github.com/chneukirchen/
  206. [lars]: https://liw.fi/
  207. [p1k3]: https://p1k3.com/
  208. [rob]: https://github.com/robacarp/
  209. [todd]: https://uniontownlabs.org/
  210. [tyler]: https://tylercipriani.com/
  211. [jacky-alcine]: https://jacky.wtf/
  212. [userland]: https://p1k3.com/userland-book/
  213. [victoria-drake]: https://victoria.dev/
  214. [vimscript]: http://learnvimscriptthehardway.stevelosh.com/
  215. [vimwiki]: https://github.com/vimwiki/vimwiki
  216. [vundle]: https://github.com/VundleVim/Vundle.vim
  217. [wrt]: https://code.p1k3.com/gitea/brennen/wrt
  218. [xmonad]: http://xmonad.org/