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 / decrypt.py
Created November 2, 2021 14:49
awx decrypt credentials
# https://github.com/ansible/awx/blob/devel/awx/main/utils/encryption.py
import base64, hashlib, json
from cryptography.fernet import Fernet, InvalidToken
from cryptography.hazmat.backends import default_backend
class Fernet256(Fernet):
'''Not techincally Fernet, but uses the base of the Fernet spec and uses AES-256-CBC
instead of AES-128-CBC. All other functionality remain identical.
'''
@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 / gist:d3d7015a1e5c7298d8954a0be182d99a
Created July 12, 2020 21:08
Get telegram channel/chat id
curl 'https://api.telegram.org/bot13:AAF/getUpdates'
@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
tmp_dict = {
"md5": hashlib.md5(str.encode('utf-8')).hexdigest(),
"sha1": hashlib.sha1(str.encode('utf-8')).hexdigest(),
"sha224": hashlib.sha224(str.encode('utf-8')).hexdigest(),
"sha256": hashlib.sha256(str.encode('utf-8')).hexdigest(),
"sha384": hashlib.sha384(str.encode('utf-8')).hexdigest(),
"sha512": hashlib.sha512(str.encode('utf-8')).hexdigest(),
}
@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: