Skip to content

Instantly share code, notes, and snippets.

@wavedocs
wavedocs / sysctl.conf
Created June 16, 2023 21:17 — forked from voluntas/sysctl.conf
Sysctl configuration for high performance
### KERNEL TUNING ###
# Increase size of file handles and inode cache
fs.file-max = 2097152
# Do less swapping
vm.swappiness = 10
vm.dirty_ratio = 60
vm.dirty_background_ratio = 2
@wavedocs
wavedocs / gitlab_dag_diagram.py
Created April 30, 2021 12:33 — forked from aarongorka/gitlab_dag_diagram.py
Prints a PlantUML diagram that shows the DAG of the GitLab pipeline
#!/usr/bin/env python3
"""Prints a PlantUML diagram that shows the DAG of the GitLab pipeline"""
import sys
import yaml
from pprint import pprint
def merge(user, default):
if isinstance(user,dict) and isinstance(default,dict):
for k,v in default.items():
@wavedocs
wavedocs / backup-to-s3.sh
Created February 6, 2021 15:08 — forked from edhemphill/backup-to-s3.sh
Use Duplicati for Backup to S3 on Ubuntu Server
#!/bin/bash
#
# You need Duplicati installed
# First on Ubuntu it uses mono :( unfortunately:
# apt-get install mono-runtime
# get the latest Duplicati 2.0 - go here--> http://www.duplicati.com/download
# wget https://updates.duplicati.com/experimental/duplicati_2.0.1.30-1_all.deb
# sudo dpkg -i duplicati_2.0.1.30-1_all.deb
#
# After install you will have a 'duplicati-cli' which is a script which runs the mono program: Duplicati.CommandLine.exe
@wavedocs
wavedocs / ELK with Nginx.md
Created June 9, 2020 12:02 — forked from Dev-Dipesh/ELK with Nginx.md
Setting up Elasticsearch, Logstash and Kibana with Nginx.

ELK (Elasticsearch Logstash Kibana)

Though we're focused more on server setup procedure in this document, I will still give a very brief explanation in laymen terms for ELK. To those who are starting new in this stack, must have already heard of MVC (Model View Controller), so take it like this:

  • Model => Elasticsearch (for Storage, Indexing & Search)
  • View => Kibana (for DataViz & G-Man, yeah the one in half life 😏)
  • Controller => Logstash (For Logs & Filtering)

@wavedocs
wavedocs / .gitlab-ci.yml
Created July 19, 2019 13:53 — forked from t3easy/.gitlab-ci.yml
Build and deploy docker containers with GitLab CI
image: an-image-with-docker-and-docker-compose
variables:
DOCKER_TLS_VERIFY: "1"
DOCKER_CERT_PATH: ".docker"
before_script:
- mkdir -p $DOCKER_CERT_PATH
- echo "$DOCKER_CA" > $DOCKER_CERT_PATH/ca.pem
- echo "$DOCKER_CERT" > $DOCKER_CERT_PATH/cert.pem
@wavedocs
wavedocs / prometheus.md
Created February 12, 2018 20:59 — forked from petarnikolovski/prometheus.md
Prometheus 2.x installation on Ubuntu 16.04 server.

Installing Prometheus on Ubuntu 16.04

This gist is a compilation of two tutorials. You can find the original tutorials here and here. What should you know before using this? Everything can be executed from the home folder. For easier cleanup at the end you can make directory where you'll download everything, and then just use rm -rf .. Although, you should be careful. If some strange bugs arise unexpectedly somewhere sometimes, just keep in mind that some user names have underscores in them (this is probably nothing to worry about).

Create Users

sudo adduser --no-create-home --disabled-login --shell /bin/false --gecos "Prometheus Monitoring User" prometheus
sudo adduser --no-create-home --disabled-login --shell /bin/false --gecos "Node Exporter User" node_exporter
sudo adduser --no-create-home --disabled-login --shell /bin/false --gecos "Alertm
@wavedocs
wavedocs / .gitlab-ci.yml
Created January 23, 2018 07:30 — forked from theoomoregbee/.gitlab-ci.yml
Gitlab Final Script for Deploying Your App over SSH
image: trion/ng-cli-karma
cache:
paths:
- node_modules/
before_script:
- apt-get update -qq && apt-get install -y -qq sshpass
deploy_stage:
@wavedocs
wavedocs / python3-logging.py
Created November 1, 2017 20:12 — forked from Integralist/capture logger output.py
[Python3 Logging] Simple Python3 Logging Configuration #tags: logs, python3
# https://docs.python.org/3/library/logging.html#logrecord-attributes
import logging
log = logging.getLogger() # <logging.RootLogger at 0x107f72f98>
log.setLevel(logging.DEBUG)
log.debug('123') # DEBUG:root:123
log.info('456') # INFO:root:456
# Alternatively...
import logging
import time
import datetime
import asyncio
import aiohttp
domain = 'http://integralist.co.uk'
a = '{}/foo?run={}'.format(domain, time.time())
b = '{}/bar?run={}'.format(domain, time.time())
async def get(url):
@wavedocs
wavedocs / bacula-dir.conf
Created September 28, 2017 09:38 — forked from skarllot/bacula-dir.conf
Bacula configuration to use sendEmail
. . .
Messages {
Name = Standard
mailcommand = "/usr/local/bin/sendEmail-backup \"[BACKUP] %t %e of %n %l\" \"%r\""
operatorcommand = "/usr/local/bin/sendEmail-backup \"[BACKUP] Intervention needed for %j\" \"%r\""
mail = [email protected] = all, !skipped
operator = [email protected] = mount
console = all, !skipped, !saved
append = "/var/log/bacula/bacula.log" = all, !skipped
catalog = all