Show process list:
SELECT * FROM pg_stat_activity;
Show running processes:
SELECT pid,datname,query_start,state,query
FROM pg_stat_activity WHERE state <> 'idle';
Reload config:
### Start SSH agent if not running | |
SSH_ENV="$HOME/.ssh/environment" | |
function start_agent { | |
echo -n "Initialising new SSH agent... " | |
/usr/bin/ssh-agent -t 3600 | sed 's/^echo/#echo/' > "${SSH_ENV}" | |
echo done | |
chmod 600 "${SSH_ENV}" | |
. "${SSH_ENV}" |
# for building packages | |
apt-get install build-essential devscripts debhelper | |
# for creating/editing packages | |
apt-get install dh-make quilt | |
cat >>~/.bashrc <<"_EOF" | |
DEBEMAIL="your.email.address@example.org" | |
DEBFULLNAME="Firstname Lastname" | |
export DEBEMAIL DEBFULLNAME | |
alias dquilt="quilt --quiltrc=${HOME}/.quiltrc-dpkg" |
#!/usr/bin/gnuplot | |
U = 3.3 | |
I = 2.2e-3 | |
R = U/I | |
C = 10e-6 | |
t = 0.01 | |
set yrange [0:U] | |
set xrange [0:t] | |
plot U * exp(-x/(R*C)) | |
pause -1 |
Show process list:
SELECT * FROM pg_stat_activity;
Show running processes:
SELECT pid,datname,query_start,state,query
FROM pg_stat_activity WHERE state <> 'idle';
Reload config:
SSLCipherSuite ECDHE:DHE:HIGH:+SHA1:!MEDIUM:!LOW:!EXP:!aNULL:!eNULL:!PSK:!RC4 | |
SSLHonorCipherOrder on | |
SSLProtocol all -SSLv3 | |
<VirtualHost ...> | |
SSLEngine on | |
Header always set Strict-Transport-Security "max-age=15552000" | |
Header set Public-Key-Pins "pin-sha256=\"yiUxVRHwMNoXtZZS/RtgPr2bCNyc6L8IJrmTU80HSlA=\"; pin-sha256=\"XQIfp7PhqFyw93tHv86EhngOxSVVdZy0Dj1mFmI81PM=\"; max-age=15552000" | |
SSLUseStapling on | |
... |
# https://www.zabbix.com/forum/showthread.php?t=43550 | |
policy_module(zabbix-fix, 1.3) | |
require { | |
type zabbix_agent_t; | |
type zabbix_t; | |
type ping_t; | |
type zabbix_tmp_t; | |
class tcp_socket name_connect; | |
} |
for beli (https://keybase.io/beli) @keybase
with PGP fingerprint 05ED 7B6D 4DDA E43D DB92 1AEC A537 2D08 32D8 419D
{
"body": {
"key": {
# show commit tree (possibly append --all for all branches) | |
git log --graph --oneline --decorate | |
# save previous as an alias and then just use 'git tree' | |
git config --global alias.tree "log --graph --oneline --decorate" | |
# restoring lost commit (e.g. after git reset --hard HEAD~1) | |
git fsck --lost-found | |
# or | |
git reflog | |
git merge <hash> |
# Number of open file descriptors per process (replace 'httpd' with process name) | |
lsof -p $( echo `ps -o pid= -C httpd` | tr ' ' ',' ) | awk '{ print $2 }' | uniq -c | |
# Show swap usage per process, >=1000 kB | |
cat /proc/*/status | egrep -B30 '^VmSwap:[[:space:]]+[[:digit:]]{4,}' | egrep '^Name|^Pid|^VmSwap' | |
# generate password | |
head -c12 /dev/urandom | base64 | tr '+/' '_-' | tr -d '=' | |
# days to web server certificate expiry |
# Disable Gnome Keyring SSH agent in Ubuntu | |
# To allow using ssh-agent from OpenSSH, mainly because | |
# gnome-keyring does not like EC-type SSH keys | |
# as regular user (for which to disable): | |
systemctl --user mask gnome-keyring-ssh.service | |
pam-auth-update | |
# and disable "GNOME Keyring Daemon..." | |
# which probably also disables automatic keyring unlocking on login |