From: Simon Ruderich Date: Sat, 2 Jun 2018 11:44:06 +0000 (+0200) Subject: Merge branch 'misc' X-Git-Url: https://ruderich.org/simon/gitweb/?p=config%2Fdotfiles.git;a=commitdiff_plain;h=c0ae7152026890b30acaa87498e3950b2ad1164e;hp=f7a8615b16edb9065f10f89560c995e05c823cc5 Merge branch 'misc' --- diff --git a/misc/.gitignore b/misc/.gitignore new file mode 100644 index 0000000..2f5d841 --- /dev/null +++ b/misc/.gitignore @@ -0,0 +1,7 @@ +/ghc/ghci_history +/ghc/x86_64-linux-*/ +/lftp/rl_history +/maxima/maxout.gnuplot_pipes +/psql/history +/psql/psqlrc +/sqlite/sqliterc diff --git a/misc/Makefile b/misc/Makefile new file mode 100644 index 0000000..23d5991 --- /dev/null +++ b/misc/Makefile @@ -0,0 +1,4 @@ +all: + @./setup.sh + +.PHONY: all diff --git a/misc/gdb/README b/misc/gdb/README new file mode 100644 index 0000000..dd2cdbe --- /dev/null +++ b/misc/gdb/README @@ -0,0 +1,34 @@ +README +====== + +Useful gdb commands. + + +`info files` +------------ + +List all (ELF) sections of the running program including address ranges. + +Example output: + + (gdb) info files + Symbols from "/bin/ls". + Unix child process: + Using the running image of child Thread 0x7ffff7fe87a0 (LWP 25058). + While running this, GDB does not access memory from... + Local exec file: + `/bin/ls', file type elf64-x86-64. + Entry point: 0x404880 + 0x0000000000400238 - 0x0000000000400254 is .interp + 0x0000000000400254 - 0x0000000000400274 is .note.ABI-tag + 0x0000000000400274 - 0x0000000000400298 is .note.gnu.build-id + [...] + 0x000000000061afe8 - 0x000000000061b348 is .got.plt + 0x000000000061b360 - 0x000000000061b57c is .data + 0x000000000061b580 - 0x000000000061c300 is .bss + 0x00007ffff7ddd1c8 - 0x00007ffff7ddd1ec is .note.gnu.build-id in /lib64/ld-linux-x86-64.so.2 + 0x00007ffff7ddd1f0 - 0x00007ffff7ddd2a8 is .hash in /lib64/ld-linux-x86-64.so.2 + 0x00007ffff7ddd2a8 - 0x00007ffff7ddd380 is .gnu.hash in /lib64/ld-linux-x86-64.so.2 + 0x00007ffff7ddd380 - 0x00007ffff7ddd608 is .dynsym in /lib64/ld-linux-x86-64.so.2 + 0x00007ffff7ddd608 - 0x00007ffff7ddd784 is .dynstr in /lib64/ld-linux-x86-64.so.2 + [...] diff --git a/misc/gdb/gdbinit b/misc/gdb/gdbinit new file mode 100644 index 0000000..59b79c0 --- /dev/null +++ b/misc/gdb/gdbinit @@ -0,0 +1,37 @@ +# GDB (GNU debugger) configuration file. + +# Copyright (C) 2011-2012 Simon Ruderich +# +# This file is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This file is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this file. If not, see . + + +# Save command history. +set history save on +# And save more entries. +set history size 10000 + + +# Set prompt. Bold green "gdb" in parentheses. Trailing whitespace is +# necessary. +set extended-prompt (\[\e[01;32m\]gdb\e[00m\]) + + +# Default output base is 16 (hex). +set output-radix 16 + +# Always disassemble next command/instruction. Very useful when debugging code +# without debug information. +set disassemble-next-line on + +# vim: ft=gdb diff --git a/misc/ghc/ghci b/misc/ghc/ghci new file mode 100644 index 0000000..0584d16 --- /dev/null +++ b/misc/ghc/ghci @@ -0,0 +1,20 @@ +-- ghci configuration file. + +-- Copyright (C) 2014 Simon Ruderich +-- +-- This file is free software: you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation, either version 3 of the License, or +-- (at your option) any later version. +-- +-- This file is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this file. If not, see . + + +-- Don't display loaded modules in prompt. +:set prompt "ghci> " diff --git a/misc/lftp/rc b/misc/lftp/rc new file mode 100644 index 0000000..ac70f49 --- /dev/null +++ b/misc/lftp/rc @@ -0,0 +1,70 @@ +# lftp configuration file. + +# Copyright (C) 2007-2013 Simon Ruderich +# +# This file is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This file is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this file. If not, see . + + +# SETTINGS + +# Display all files (including hidden ones) with `ls`. +set ftp:list-options -a + +# Enable colors in interactive mode. Used by e.g. directory listings (which +# use $LS_COLORS). +set color:use-color auto + +# Use a colorized prompt. Hostname in bold green, current directory in bold +# blue. +set cmd:prompt "lftp \[\e[01;32m\]\h\[\e[00m\]:\[\e[01;34m\]\w\[\e[00m\] % " + + +# Store passwords in the bookmarks file. +set bmk:save-passwords yes + +# Don't store current directory of each server in ~/.lftp/cwd_history. +set cmd:save-cwd-history no +# Don't store transfer logs in ~/.lftp/transfer_log. +set xfer:log no + + +# No retries after a failed connection, prevents (long) delays e.g. for +# automated jobs. +set net:max-retries 1 + +# If SSL is used make sure the data connection is encrypted as well. This +# should be the default behavior!. +set ftp:ssl-protect-data yes +set ftp:ssl-protect-fxp yes +# Same for control connections (default). +set ftp:ssl-protect-list yes +# Make sure SSL is not dropped after a successful login (default). +set ftp:ssl-use-ccc no +# And verify the certificate and hostname, otherwise encryption doesn't matter +# (default). +set ssl:check-hostname yes +set ssl:verify-certificate yes + + +# ALIASES + +# Create "sync" command which syncs local directories with remote ones and +# transfers all missing/outdated files. Local files which don't exist anymore +# are removed on the server. +alias sync mirror --verbose --reverse --delete --dereference + +# Create commands to go up directories. +alias .. cd .. +alias ... cd ../.. +alias .... cd ../../.. diff --git a/misc/maxima/maxima-init.lisp b/misc/maxima/maxima-init.lisp new file mode 100644 index 0000000..fefdadd --- /dev/null +++ b/misc/maxima/maxima-init.lisp @@ -0,0 +1,24 @@ +; Maxima (computer algebra system) configuration file, lisp part. +; +; Also have a look at maxima/maxima-init.mac. + +; Copyright (C) 2011-2012 Simon Ruderich +; +; This file is free software: you can redistribute it and/or modify +; it under the terms of the GNU General Public License as published by +; the Free Software Foundation, either version 3 of the License, or +; (at your option) any later version. +; +; This file is distributed in the hope that it will be useful, +; but WITHOUT ANY WARRANTY; without even the implied warranty of +; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +; GNU General Public License for more details. +; +; You should have received a copy of the GNU General Public License +; along with this file. If not, see . + + +; Set directory for temporary files to ~/.maxima (used for plotting for +; example). Thanks to rootzlevel in #faui2k9 on IRCnet (2011-05-28 21:52 CET). +(setf *maxima-tempdir* + (namestring (merge-pathnames ".maxima/" (user-homedir-pathname)))) diff --git a/misc/maxima/maxima-init.mac b/misc/maxima/maxima-init.mac new file mode 100644 index 0000000..1dedac1 --- /dev/null +++ b/misc/maxima/maxima-init.mac @@ -0,0 +1,46 @@ +/* + * Maxima (computer algebra system) configuration file, Maxima part. + * + * Also have a look at maxima/maxima-init.lisp. + * + * Notes: + * + * Solve Ax = b, thanks to Florian. + * + * A : matrix([1,2,0],[0,2,3],[0,0,4])$ + * b : matrix([1],[3],[5])$ + * linsolve_by_lu(A,b); + */ + +/* + * Copyright (C) 2011-2012 Simon Ruderich + * + * This file is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This file is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this file. If not, see . + */ + + +/* CUSTOM FUNCTIONS */ + +/* Didn't find any euclid norm in Maxima, so here it is. */ +norm(x) := sqrt(transpose(x) . x); + +/* Maxima's mat_norm() can't calculate the 2-norm. Thanks to Wolfgang Lindner + * (http://www.ma.utexas.edu/pipermail/maxima/2007/006300.html) for an + * improved version. */ +mat_norm2(x) := sqrt(lmax(eigenvalues(transpose(conjugate(x)) . x)[1])); + +/* Shortcut to perform lu factorization. */ +lu(x) := block(x : lu_factor(x), get_lu_factors(x)); + +/* vim: ft=maxima */ diff --git a/misc/mysql/my.cnf b/misc/mysql/my.cnf new file mode 100644 index 0000000..2c2f29b --- /dev/null +++ b/misc/mysql/my.cnf @@ -0,0 +1,21 @@ +# MySQL client configuration file. + +# Copyright (C) 2009-2013 Simon Ruderich +# +# This file is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This file is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this file. If not, see . + + +[mysql] +# Always use the pager. +pager diff --git a/misc/perl/perlcriticrc b/misc/perl/perlcriticrc new file mode 100644 index 0000000..6fb1f06 --- /dev/null +++ b/misc/perl/perlcriticrc @@ -0,0 +1,62 @@ +# perlcritic configuration file + +# Copyright (C) 2012 Simon Ruderich +# +# This file is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This file is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this file. If not, see . + + +# Be strict about errors in ~/.perlcriticrc. +profile-strictness = fatal + +# Display all errors/warnings by default. +severity = brutal + +# Use colored output. +color = 1 + + +# IMHO 'x' is more readable than q{x}, so ignore this warning. +[-ValuesAndExpressions::ProhibitNoisyQuotes] +# Same for '', ignore it too. +[-ValuesAndExpressions::ProhibitEmptyQuotes] + +# I know how /s, /x and /m work (and expect that from others), ignore these +# warnings. +[-RegularExpressions::RequireDotMatchAnything] +[-RegularExpressions::RequireExtendedFormatting] +[-RegularExpressions::RequireLineBoundaryMatching] + +# I prefer exact line numbers in errors, allow die instead of croak. I don't +# develop perl modules so it shouldn't be a problem. +[-ErrorHandling::RequireCarping] + +# IMHO "print $FH ..." is readable enough, "print {$FH} ..." is not necessary. +[-InputOutput::RequireBracedFileHandleWithPrint] + +# Don't require checks for print's return value. I check the return value of +# other functions like open() or close(), but checking every print is just a +# waste of time. +[InputOutput::RequireCheckedSyscalls] +functions = :builtins +exclude_functions = print + +# IMHO punctuation variables are more readable than their English counterparts +# (and faster in some cases). So allow the ones I use often. +[Variables::ProhibitPunctuationVars] +allow = $0 $! $? $. $@ $/ $" $+ $- + +# Allow the usage of ".." when '..' occurs inside the string, e.g. in strings +# like ".. '..' ..". +[ValuesAndExpressions::ProhibitInterpolationOfLiterals] +allow_if_string_contains_single_quote = 1 diff --git a/misc/psql/psqlrc.in b/misc/psql/psqlrc.in new file mode 100644 index 0000000..23cc2d9 --- /dev/null +++ b/misc/psql/psqlrc.in @@ -0,0 +1,52 @@ +-- Postgresql client configuration file. + +-- Copyright (C) 2016 Simon Ruderich +-- +-- This file is free software: you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation, either version 3 of the License, or +-- (at your option) any later version. +-- +-- This file is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this file. If not, see . + + +-- Shut up \pset during this config script. +\set QUIET on + +-- Automatically switch to vertical mode when the columns don't fit on screen. +\pset expanded auto + +-- Use unicode characters for borders. +\pset linestyle unicode + +-- Per default NULL values are not displayed, use a replacement string to +-- prevent mistaken them for an empty string. +\pset null ï½¢NULLï½£ + +-- Don't abort transactions in interactive mode when an error occurs. As the +-- error is displayed no information is lost and this saves one from having to +-- restart the transaction on a typo in a statement. +\set ON_ERROR_ROLLBACK interactive + +-- "ignorespace ignoredups" +\set HISTCONTROL ignoreboth +-- Set path to history file and increase it. +\set HISTFILE HISTFILE_PATH +\set HISTSIZE 100000 + +-- Add transaction status (%x) to prompt; show database name in bold green. +\set PROMPT1 '%x%[%033[01;32m%]%/%[%033[00m%]%R%# ' +-- Remove database from second prompt to make it easily distinguishable from +-- PROMPT1. +\set PROMPT2 '%x%R%# ' + +-- But display the normal psql welcome message. +\set QUIET off + +-- vim: ft=sql diff --git a/misc/setup.sh b/misc/setup.sh new file mode 100755 index 0000000..c04bc52 --- /dev/null +++ b/misc/setup.sh @@ -0,0 +1,68 @@ +#!/bin/sh + +# Setup script for miscellaneous configuration files. + +# Copyright (C) 2009-2014 Simon Ruderich +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + + +set -eu + +. ../lib.sh + + +# gdb, GNU debugger. +if installed gdb; then + link gdb/gdbinit ~/.gdbinit +fi + +# ghc(i), Glasgow Haskell Compilation. +if installed ghci; then + link ghc ~/.ghc + link ghc/ghci ~/.ghci +fi + +# Powerful FTP client. +if installed lftp; then + link lftp ~/.lftp +fi + +# Maxima, a symbolic algebra program. +if installed maxima; then + link maxima ~/.maxima +fi + +if installed psql; then + generate psql/psqlrc .in simple_cpp \ + HISTFILE_PATH -- "`pwd`/psql/history" + sed_i 's/^#/--/' psql/psqlrc + link psql/psqlrc ~/.psqlrc +fi + +# MySQL client. +if installed mysql; then + link mysql/my.cnf ~/.my.cnf +fi + +if installed sqlite3; then + # sqlite3 doesn't support any comments in sqliterc. + grep -v -E '^#' sqlite/sqliterc.in >sqlite/sqliterc + link sqlite/sqliterc ~/.sqliterc +fi + +# perlcritic to check Perl programs for common problems. +if installed perlcritic; then + link perl/perlcriticrc ~/.perlcriticrc +fi diff --git a/misc/sqlite/sqliterc.in b/misc/sqlite/sqliterc.in new file mode 100644 index 0000000..f8bfa58 --- /dev/null +++ b/misc/sqlite/sqliterc.in @@ -0,0 +1,28 @@ +# sqlite3 configuration file. +# +# sqlite3 doesn't support comments in ~/.sqliterc. They must be stripped +# before using this file. + +# Copyright (C) 2014 Simon Ruderich +# +# This file is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This file is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this file. If not, see . + + +# Enable column output mode with headers. Used for SELECT statements and makes +# them more readable. +.mode column +.headers on + +# Display NULL value as "NULL". +.nullvalue NULL