Skip to content

Commit 8f23c75

Browse files
committed
Add SSH, psql and sqlite configuration files
1 parent 775fca7 commit 8f23c75

File tree

3 files changed

+170
-0
lines changed

3 files changed

+170
-0
lines changed

psqlrc

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
-- Taken from: https://robots.thoughtbot.com/an-explained-psqlrc
2+
-- and https://github.com/thoughtbot/dotfiles/blob/master/psqlrc
3+
4+
-- Don't display the "helpful" message on startup.
5+
\set QUIET 1
6+
7+
-- http://www.postgresql.org/docs/9.3/static/app-psql.html#APP-PSQL-PROMPTING
8+
\set PROMPT1 '%[%033[1m%]%M %n@%/%R%[%033[0m%]%# '
9+
-- PROMPT2 is printed when the prompt expects more input, like when you type
10+
-- SELECT * FROM<enter>. %R shows what type of input it expects.
11+
\set PROMPT2 '[more] %R > '
12+
13+
14+
-- When typing transactions in the PSQL prompt by hand, in case of error it
15+
-- allows you to fix the query on the fly without starting the whole transaction
16+
-- all over.
17+
\set ON_ERROR_ROLLBACK interactive
18+
19+
-- Sets the autocompleter to upcase all SQL keywords, so "sel<tab><tab>" becomes
20+
-- "SELECT" instead of "select"
21+
\set COMP_KEYWORD_CASE upper
22+
23+
-- Creates distinct history files for each database
24+
\set HISTFILE ~/.psql_history- :DBNAME
25+
26+
-- If a command is run more than once in a row, only store it once in the
27+
-- history.
28+
\set HISTCONTROL ignoredups
29+
30+
-- Automatically find out if an expanded view (multiple lines per table row)
31+
-- is needed when selecting a table
32+
\x auto
33+
34+
-- Write "<NULL>" instead of a blank space to show NULL fields
35+
\pset null '<NULL>'
36+
37+
-- Show how long each query takes to execute
38+
\timing
39+
40+
-- Verbose error reports.
41+
\set VERBOSITY verbose

sqliterc

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
-- Deactivate output of PRAGMA commands
2+
.output /dev/null
3+
4+
-- PRAGMA commands for ALL used databases with this .sqliterc to increase the
5+
-- insert-per-second rate of massive insertions. Taken from:
6+
-- https://stackoverflow.com/questions/1711631/improve-insert-per-second-performance-of-sqlite
7+
-- https://stackoverflow.com/questions/27391557/how-to-make-sqliterc-commands-be-quiet
8+
9+
-- Avoid pausing after issuing a OS-level write command to wait for the data
10+
-- being written. Simply hand-off the data to the OS for writing and then
11+
-- continue. There's a chance that the database file may become corrupted if the
12+
-- computer suffers a catastrophic crash.
13+
PRAGMA synchronous = OFF;
14+
15+
-- Store the rollback journal in memory for a faster transaction. If you lose
16+
-- power or your program crashes during a transaction, your database could be
17+
-- left in a corrupt state with a partially-completed transaction.
18+
PRAGMA journal_mode = MEMORY;
19+
20+
-- Maximum number of database disk pages that SQLite will hold in memory at once
21+
-- per open database file. A positive value indicates the number of pages, a
22+
-- negative one the number of kibibytes (kiB, not kB).
23+
PRAGMA cache_size = -100000; -- 100000 kiB = 102.4 MB
24+
25+
-- Enable foreign keys, since the default is OFF.
26+
PRAGMA foreign_keys = ON;
27+
28+
-- Display table headers i.e. column names when performing a SELECT
29+
.headers on
30+
-- Display values in columns separated with tabs in a pretty format
31+
.mode tabs
32+
-- Instead of showing nothing, print "NULL" for NULL fields
33+
.nullvalue NULL
34+
-- Show execution timer for each query
35+
.timer on
36+
-- Try opening locked tables for 30 seconds before giving up
37+
.timeout 30000
38+
39+
-- Reactivate normal output of all other commands
40+
.output stdout

ssh_conf

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
# -----------------------------------------------------------------------------
2+
# Matjaž's dotfiles SSH client configuration file
3+
#
4+
# Copyright (c) 2015-2016, Matjaž Guštin <dev@matjaz.it> matjaz.it
5+
# This source code form is part of the "Matjaž's dotfiles" project and is
6+
# subject to the terms of the BSD 3-clause license as expressed in the
7+
# LICENSE.md file found in the top-level directory of this distribution and at
8+
# http://directory.fsf.org/wiki/License:BSD_3Clause
9+
# -----------------------------------------------------------------------------
10+
11+
# Default configuration that any host inherits. Override if needed.
12+
Host *
13+
# Use protocol v2, fallback to v1 if v2 is not available.
14+
Protocol 2,1
15+
16+
### Security ###
17+
# Protocol v2 ciphers
18+
# The latest ones are really weak and are kept for compatibility with
19+
# all hosts that may not have the stronger ones. No spaces after commas!
20+
Ciphers aes256-ctr,aes256-gcm@openssh.com,aes256-cbc,aes192-ctr,aes192-cbc,aes128-ctr,aes128-gcm@openssh.com,aes128-cbc,blowfish-cbc,arcfour256,arcfour128,arcfour,3des-cbc
21+
# Protocol v1 cipher
22+
Cipher blowfish
23+
# Try public key first
24+
PreferredAuthentications publickey,gssapi-with-mic,hostbased,keyboard-interactive,password
25+
26+
### Connection ###
27+
# After <value> seconds of inativity, sends an echo request to the server.
28+
ServerAliveInterval 30
29+
# After <value> echo consecutive requests sent, disconnects the session.
30+
ServerAliveCountMax 20
31+
# TCP timeout when estabilishing the first connection to the server.
32+
ConnectTimeout 10
33+
# Number of times to try the connection if timeouts.
34+
ConnectionAttempts 3
35+
Compression no
36+
37+
### Local logging ###
38+
# A command run on the local machine after a succesful login to a server.
39+
# %u = local user name
40+
# %l = local host name
41+
# %r = remote user name
42+
# %n = host name as provided on the command line
43+
# %h = remote host name
44+
# %p = remote port
45+
# %d = local user's home directory
46+
PermitLocalCommand yes
47+
LocalCommand echo "$(date +%%s) %u@%l --> %r@%h:%p" >> %d/.ssh/logins.log
48+
49+
Host nashira
50+
HostName nashira.matjaz.it
51+
User ubuntu
52+
IdentityFile ~/.ssh/Nashira.pem
53+
Port 62800
54+
55+
Host raspi
56+
HostName noctis.zapto.org
57+
User pi
58+
IdentityFile ~/.ssh/Raspi
59+
Port 62800
60+
61+
Host raspi-lan
62+
HostName 192.168.0.86
63+
User pi
64+
IdentityFile ~/.ssh/Raspi
65+
Port 62800
66+
67+
Host eltanin
68+
HostName 192.168.0.88
69+
User root
70+
PreferredAuthentications password,publickey,gssapi-with-mic,hostbased,keyboard-interactive
71+
Port 22
72+
73+
Host vbox-ubuntu
74+
HostName localhost
75+
User mat
76+
PreferredAuthentications password,publickey,gssapi-with-mic,hostbased,keyboard-interactive
77+
Port 3022
78+
79+
Host vbox-bsd
80+
HostName localhost
81+
User mat
82+
PreferredAuthentications password,publickey,gssapi-with-mic,hostbased,keyboard-interactive
83+
Port 3122
84+
85+
Host proxy
86+
Hostname localhost
87+
User mat
88+
PreferredAuthentications password,publickey,gssapi-with-mic,hostbased,keyboard-interactive
89+
Port 4022

0 commit comments

Comments
 (0)