This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apt-get install mdadm | |
mdadm --create /dev/md0 --level=10 --raid-devices=4 /dev/sd[c-f] | |
mkfs.ext4 /dev/md0 | |
mkdir /mnt/raid10 | |
mount /dev/md0 /mnt/raid10/ | |
echo "/dev/md0 /mnt/raid10 ext4 defaults 0 0" >> /etc/fstab | |
mount -av | |
mdadm --detail --scan --verbose >> /etc/mdadm.conf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dpkg -l | grep -i docker; | |
sudo apt-get purge -y docker-engine docker docker.io docker-ce; | |
sudo apt-get autoremove -y --purge docker-engine docker docker.io docker-ce; | |
sudo rm -rf /var/lib/docker /etc/docker; | |
sudo rm /etc/apparmor.d/docker; | |
sudo groupdel docker; | |
sudo rm -rf /var/run/docker.sock; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dpkg -l | grep -i docker | |
sudo apt-get purge -y docker-engine docker docker.io docker-ce | |
sudo apt-get autoremove -y --purge docker-engine docker docker.io docker-ce | |
sudo rm -rf /var/lib/docker /etc/docker | |
sudo rm /etc/apparmor.d/docker | |
sudo groupdel docker | |
sudo rm -rf /var/run/docker.sock |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
USERNAME=root | |
ssh -l ${USERNAME} server-name " | |
sudo apt-get install nfs-common; | |
cd ..; | |
sudo mkdir -p /remote-backups; | |
sudo chmod 777 remote-backups; | |
sudo mount -t nfs "backup-storage-id:/export/ftpbackup/ovh-server-name" /remote-backups; | |
exit; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
create type query_datatype as (pid int, duration text, query text); | |
drop type query_datatype cascade; | |
drop function terminate_performance_killer(); | |
create OR REPLACE FUNCTION terminate_performance_killer() RETURNS SETOF query_datatype | |
LANGUAGE plpgsql | |
AS $$ | |
DECLARE | |
items query_datatype; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Check active queries | |
SELECT * FROM pg_stat_activity WHERE state = 'active'; | |
-- Terminate active queries with ProcessID | |
select pg_terminate_backend(pid); | |
-- Get all queries which are older then 5 minutes (idle or active) | |
SELECT pid, now() - pg_stat_activity.query_start AS duration, query, state | |
FROM pg_stat_activity WHERE (now() - pg_stat_activity.query_start) > interval '5 minutes'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ENV LANG="de_DE.UTF-8" | |
ENV LC_COLLATE="de_DE.UTF-8" | |
ENV LC_CTYPE="de_DE.UTF-8" | |
ENV LC_MESSAGES="de_DE.UTF-8" | |
ENV LC_MONETARY="de_DE.UTF-8" | |
ENV LC_NUMERIC="de_DE.UTF-8" | |
ENV LC_TIME="de_DE.UTF-8" | |
RUN locale-gen de_DE.UTF-8 | |
RUN update-locale LANG=de_DE.UTF-8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import base64 | |
import json | |
import os | |
import urllib | |
from urllib import request, parse | |
TWILIO_SMS_URL = "https://api.twilio.com/2010-04-01/Accounts/{}/Messages.json" | |
TWILIO_CALL_URL = "https://api.twilio.com/2010-04-01/Accounts/{}/Calls.json" | |
TWILIO_ACCOUNT_SID = os.environ.get("TWILIO_ACCOUNT_SID") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import subprocess | |
import boto3 | |
import json | |
lambda_client = boto3.client('lambda') | |
def lambda_handler(event, context): | |
result = subprocess.call("curl -I YOUR_URL", shell=True) | |
if result > 0: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import logging | |
import boto3 | |
import datetime | |
from botocore.exceptions import ClientError | |
def lambda_handler(event, context): | |
# Set up logging | |
logging.basicConfig(level=logging.DEBUG, | |
format='%(levelname)s: %(asctime)s: %(message)s') | |
NewerOlder