Skip to content

Instantly share code, notes, and snippets.

🎯
Focusing

Felix Kraus fxkraus

🎯
Focusing
  • idem telematics GmbH
  • Munich, Germany
Block or report user

Report or block fxkraus

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@fxkraus
fxkraus / autopgsqlbackup
Created Jul 27, 2018 — forked from matthewlehner/autopgsqlbackup
Auto PostgreSQL backup script.
View autopgsqlbackup
#!/bin/bash
#
# PostgreSQL Backup Script Ver 1.0
# http://autopgsqlbackup.frozenpc.net
# Copyright (c) 2005 Aaron Axelsen <axelseaa@amadmax.com>
#
# This script is based of the AutoMySQLBackup Script Ver 2.2
# It can be found at http://sourceforge.net/projects/automysqlbackup/
#
# The PostgreSQL changes are based on a patch agaisnt AutoMySQLBackup 1.9
@fxkraus
fxkraus / notify.sh
Created Aug 8, 2017 — forked from jehiah/notify.sh
email notify at system boot time
View notify.sh
#!/bin/bash
#
# *************************************************
# chkconfig: 2345 99 99
# description: notify email address on system boot.
# *************************************************
# Installing:
# 1) save as /etc/rc.d/init.d/notify
# 2) set the desired email address in "MAILADD" variable
# 3) chmod a+w /etc/rc.d/init.d/notify
@fxkraus
fxkraus / check_swap_paging_rate.sh
Last active Aug 8, 2017 — forked from jehiah/check_swap_paging_rate.sh
Nagios Monitor for the rate pages are swapped in/out
View check_swap_paging_rate.sh
#!/bin/bash
# Show the rate of swapping (in number of pages) between executions
OK=0
WARNING=1
CRITICAL=2
UNKNOWN=-1
EXITFLAG=$OK
WARN_THRESHOLD=1
@fxkraus
fxkraus / debian-install-megacli.md
Last active Jul 16, 2019
Install LSI MegaCli .deb package on Debian/Ubuntu
View debian-install-megacli.md

download

wget https://docs.broadcom.com/docs-and-downloads/raid-controllers/raid-controllers-common-files/8-07-14_MegaCLI.zip

unzip

unzip 8-07-14_MegaCLI.zip
View postgres_queries_and_commands.sql
-- show running queries (pre 9.2)
SELECT procpid, age(query_start, clock_timestamp()), usename, current_query
FROM pg_stat_activity
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%'
ORDER BY query_start desc;
-- show running queries (9.2)
SELECT pid, age(query_start, clock_timestamp()), usename, query
FROM pg_stat_activity
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%'
@fxkraus
fxkraus / ubuntu-luks-encrypted-usb-drive.md
Last active Jul 7, 2017
Ubuntu LUKS encrypted usb backup partition
View ubuntu-luks-encrypted-usb-drive.md

Encrypted

Install required packages

sudo apt-get update && sudo apt-get install -y cryptsetup

Overwrite existing partition table (optional)

@fxkraus
fxkraus / postgresql_create_ro_user.sql
Created Jul 4, 2017
PostgreSQL: Create read-only database user/role
View postgresql_create_ro_user.sql
CREATE USER username WITH PASSWORD 'the_password';
GRANT CONNECT ON DATABASE the_database TO username;
GRANT USAGE ON SCHEMA public TO username;
ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT SELECT ON TABLES TO username;
-- has to be executed while connected to the actual database
\c the_database
GRANT SELECT ON ALL SEQUENCES IN SCHEMA public TO the_database;
GRANT SELECT ON ALL TABLES IN SCHEMA public to the_database;
@fxkraus
fxkraus / malduino_elite_ubuntu_device_busy.md
Last active Jul 2, 2017
Malduino 'can't open device "/dev/ttyACM0": Device or resource busy' on Ubuntu
View malduino_elite_ubuntu_device_busy.md

Malduino 'can't open device "/dev/ttyACM0": Device or resource busy' on Ubuntu

Set Permissions

Add your user to the 'dialout' group

sudo usermod -aG dialout yourusername
@fxkraus
fxkraus / build_cross_gcc
Last active Oct 7, 2017 — forked from preshing/build_cross_gcc
A shell script to download packages for, configure, build and install a GCC cross-compiler.
View build_cross_gcc
#! /bin/bash
set -e
trap 'previous_command=$this_command; this_command=$BASH_COMMAND' DEBUG
trap 'echo FAILED COMMAND: $previous_command' EXIT
#-------------------------------------------------------------------------------------------
# This script will download packages for, configure, build and install a GCC cross-compiler.
# Customize the variables (INSTALL_PATH, TARGET, etc.) to your liking before running.
# If you get an error and need to resume the script from some point in the middle,
# just delete/comment the preceding lines before running it again.
You can’t perform that action at this time.