Skip to content

Instantly share code, notes, and snippets.

@silviud
silviud / telegraf.conf
Created October 3, 2022 14:13 — forked from DrPsychick/telegraf.conf
Telegraf Windows Performance Counters configuration
# Windows Performance Counters plugin.
# These are the recommended method of monitoring system metrics on windows,
# as the regular system plugins (inputs.cpu, inputs.mem, etc.) rely on WMI,
# which utilize more system resources.
#
# See more configuration examples at:
# https://github.com/influxdata/telegraf/tree/master/plugins/inputs/win_perf_counters
# If metrics are missing run `lodctr /r` as Administrator
[[inputs.win_perf_counters]]
@silviud
silviud / pg_uuid.py
Created August 17, 2022 14:16 — forked from lly365/pg_uuid.py
Flask-SQLAlchemy UUID
# -*- coding: utf-8 -*-
"""
pg_uuid
~~~~~~~~~~~~~~~~
<NO DESCRIPTION>.
:copyright: (c) 2018 by WRDLL <4ever@wrdll.com>
"""
from flask import Flask
@silviud
silviud / gist:dd2caaf018c4d2816b8d82397dd3e768
Created August 31, 2021 14:00
Create postgresql role and database from shell
# create password - note the md5 is the prefix and the value is user + password
$ U=testpg; P=testpg; echo -n md5; echo -n $P$U | md5sum | cut -d' ' -f1
$ md54bb01023735acf990f528fe961df8140
# connect to pg
$ psql
postgres=# CREATE ROLE testpg NOSUPERUSER NOCREATEDB NOCREATEROLE NOINHERIT LOGIN PASSWORD 'md54bb01023735acf990f528fe961df8140';
postgres=# CREATE DATABASE testpgdb OWNER testpg;
^D
# at this point you can connect to the database `testpgdb` such so
$ psql -U testpg -d testpgdb -h YOURHOST -W
# Regular Colors
| Value | Color |
| -------- | ------ |
| \e[0;30m | Black |
| \e[0;31m | Red |
| \e[0;32m | Green |
| \e[0;33m | Yellow |
| \e[0;34m | Blue |
| \e[0;35m | Purple |
// class
class ClassCar {
drive () {
console.log('Vroom!');
}
}
const car1 = new ClassCar();
console.log(car1.drive());
#!/usr/bin/env bash
# https://betterdev.blog/minimal-safe-bash-script-template/
set -Eeuo pipefail
trap cleanup SIGINT SIGTERM ERR EXIT
script_dir=$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd -P)
usage() {
@silviud
silviud / css-selectors.md
Created November 24, 2020 00:06 — forked from magicznyleszek/css-selectors.md
CSS Selectors Cheatsheet

CSS Selectors Cheatsheet

Element selectors

Element -- selects all h2 elements on the page

h2 {
    foo: bar;
@silviud
silviud / kubectl.yml
Created April 4, 2019 16:58
Kubectl ~/.kube/config
apiVersion: v1
clusters:
- cluster:
insecure-skip-tls-verify: true
server: https://SERVER:PORT
name: main
contexts:
- context:
cluster: main
user: main
@silviud
silviud / Ansible-Vault how-to.md
Created September 5, 2018 12:32 — forked from tristanfisher/Ansible-Vault how-to.md
A short tutorial on how to use Vault in your Ansible workflow. Ansible-vault allows you to more safely store sensitive information in a source code repository or on disk.

Working with ansible-vault


I've been using a lot of Ansible lately and while almost everything has been great, finding a clean way to implement ansible-vault wasn't immediately apparent.

What I decided on was the following: put your secret information into a vars file, reference that vars file from your task, and encrypt the whole vars file using ansible-vault encrypt.

Let's use an example: You're writing an Ansible role and want to encrypt the spoiler for the movie Aliens.

@silviud
silviud / ssh.sh
Created December 17, 2017 13:48
SSH Cheatsheet
Base Usage
ssh [user]@[host]
Use Specific Key
ssh -i ~/.ssh/id_rsa [user]@[host]
Use Alternative Port
ssh -i ~/.ssh/id_rsa -p [port] [user]@[host]