Skip to content

Instantly share code, notes, and snippets.

View tomaszklim's full-sized avatar

Tomasz Klim tomaszklim

View GitHub Profile
@tomaszklim
tomaszklim / wp-fetch-updates-info.php
Last active June 28, 2018 12:24
Wordpress remote update checker
<?php
/**
* Wordpress remote update checker
* Written by Tomasz Klim, based on wp-admin code
**
<Files wp-fetch-updates-info.php>
Order Deny,Allow
Deny from all
Allow from 1.2.3.4
@tomaszklim
tomaszklim / install-docker-ubuntu16.sh
Last active June 7, 2019 15:12
Install Docker stack on Ubuntu 16.04 LTS
#!/bin/sh
# warning: this installs old 17.05.0-ce version, see my install-docker-ubuntu18.sh gist for the current version
echo "deb https://apt.dockerproject.org/repo ubuntu-xenial main" >/etc/apt/sources.list.d/docker.list
apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
apt-get update
apt-get install docker-engine python-pip
@tomaszklim
tomaszklim / docker-clear-old-images.sh
Created August 19, 2018 19:47
Clear old Docker images (works with all Docker versions)
#!/bin/sh
docker rmi $(docker images | grep "^<none>" | awk '{print $3}')
#!/bin/sh
add-apt-repository ppa:certbot/certbot
apt-get update
apt-get install nginx python-certbot-nginx
@tomaszklim
tomaszklim / uptimerobot-add-check.sh
Created January 8, 2019 11:53
Add new Heartbeat-based check to Uptimerobot.com using API
#!/bin/bash
api_key="u123456-qa9oic80zsll1xi0fhbwso1"
alert_contacts="0123456_0_0-2761234_0_0"
baseurl="https://serverfarmer.home.pl/heartbeat/query.php"
db="id_myaccount.txt"
# 300 for free accounts, 60 for paid accounts
interval=300
@tomaszklim
tomaszklim / uptimerobot-get-checks.sh
Created January 8, 2019 11:57
Get the list of Uptimerobot.com checks
#!/bin/sh
api="u123456-qa9oic80zsll1xi0fhbwso1"
offset=$1
if [ "$offset" = "" ]; then
offset=0
fi
curl -s -X POST \
#!/bin/sh
git clone https://github.com/CISOfy/lynis /opt/lynis
cd /opt/lynis && /opt/lynis/lynis audit system --cronjob --quiet |grep -v custom.prf
grep warning /var/log/lynis-report.dat |egrep -v "(CONT-8104|KRNL-5830|NETW-2705)"
@tomaszklim
tomaszklim / install-docker-ubuntu18.sh
Created June 7, 2019 15:10
Install Docker stack on Ubuntu 18.04 LTS
#!/bin/sh
apt install apt-transport-https ca-certificates curl software-properties-common
echo "deb [arch=amd64] https://download.docker.com/linux/ubuntu bionic stable" >/etc/apt/sources.list.d/docker.list
curl -fsSL https://download.docker.com/linux/ubuntu/gpg |apt-key add -
apt update
apt install docker-ce python-pip
@tomaszklim
tomaszklim / docker-logtail.sh
Created July 5, 2019 10:58
Send stdout logs from running Docker containers by email.
#!/bin/sh
# Written by Tomasz Klim, 2019-07-05
#
# This is a simplified, open source version. It relies on $MAILTO variable
# defined in /etc/crontab file for all cron tasks. A better approach would
# be to send emails in dedicated format, to dedicated list of recipients.
#
# Add this to /etc/crontab:
# * * * * * root /etc/local/docker-logtail.sh
@tomaszklim
tomaszklim / espeo-initial-server-analysis.sh
Last active October 26, 2023 09:43
Espeo Software initial server analysis script, for future customers
#!/bin/sh
# Espeo Software server analysis script
# Written by Tomasz Klim
# Version 1.2
#
# Run this script as root and send us the created TGZ package.
WD=`pwd`
path=$WD/analysis
mkdir -p $path/etc $path/log $path/ls $path/proc