Skip to content

Instantly share code, notes, and snippets.

@bdwyertech
bdwyertech / wsl_chefdk.ps1
Last active April 21, 2022 09:52
Windows Subsystem for Linux - ChefDK
# Update to Latest Windows 10 Spring Refresh
# Install WSL
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux
# Get Ubuntu installed - https://docs.microsoft.com/en-us/windows/wsl/install-on-server
wsl.exe
# Install ChefDK deb package
@crazyguitar
crazyguitar / redis.md
Last active October 12, 2021 03:34
Redis

Redis Note

Features

  • An in-memory database (often shortened to IMDB) which stores data using the main memory of a machine as the primary storage facility, rather than storing the data on a disk as in a typical disk-optimized database.
  • Redis can store a mapping of keys to values (Key-Value Store) and can even achieve similar performance levels as memcached.
  • Redis supports the writing of its data to disk
  • Redis has two different forms of writing in-memory data to disk in a compact format:
    1. point-in-time dump (snapshot): when certain conditions are met (a number of writes in a given period) or when one of the two dump-to-disk commands is called
  1. append-only file: writes every command that alters data in Redis to disk as it happens
@Aerijo
Aerijo / making_language_grammar.md
Last active March 18, 2024 05:03
Guide to writing an Atom language grammar

A guide to writing a language grammar (TextMate) in Atom

Tree sitter

  • Atom is transitioning to an entirely new way of defining grammars using tree-sitter. This will be enabled by default quite soon now. It is theoretically faster and more powerful than regex based grammars (the one described in this guide), but requires a steeper learning curve. My understanding is that regex based grammars will still be supported however (at least until version 2), so this guide can still be useful. To enable it yourself, go to Settings -> Core and check Use Tree Sitter Parsers

Links for tree-sitter help:

@marcocitus
marcocitus / pg_partman.sql
Last active May 4, 2023 18:32
Setting up pg_partman on cloud
-- as superuser:
CREATE EXTENSION pg_cron;
GRANT USAGE ON SCHEMA cron TO citus;
CREATE SCHEMA partman;
GRANT USAGE ON SCHEMA partman TO citus;
CREATE EXTENSION pg_partman WITH SCHEMA partman;
GRANT ALL ON TABLE partman.part_config TO citus;
GRANT ALL ON TABLE partman.part_config_sub TO citus;
@whiteinge
whiteinge / complex_salt_orchestrate.sls
Last active March 20, 2024 15:48
An example of a complex, multi-host Salt Orchestrate state that performs status checks as it goes
# /srv/salt/upgrade_the_app.sls
# Example of a complex, multi-host Orchestration state that performs status checks as it goes.
# Note, this is untested and is meant to serve as an example.
# Run via: salt-run state.orch upgrade_the_app pillar='{nodes: [nodeA, nodeB], version: 123}'
{% set nodes = salt.pillar.get('nodes', []) %}
{% set all_grains = salt.saltutil.runner('cache.grains',
tgt=','.join(nodes), tgt_type='list') %}
{# Default version if not given at the CLI. #}
@mayorova
mayorova / README.md
Created August 10, 2017 14:44
Mutual SSL in NGINX

Securing traffic to upstream servers with client certificates

Info: https://www.nginx.com/resources/admin-guide/nginx-https-upstreams/

Creating and Signing Your Certs

Source: http://nategood.com/client-side-certificate-authentication-in-ngi

This is SSL, so you'll need an cert-key pair for you/the server, the api users/the client and a CA pair. You will be the CA in this case (usually a role played by VeriSign, thawte, GoDaddy, etc.), signing your client's certs. There are plenty of tutorials out there on creating and signing certificates, so I'll leave the details on this to someone else and just quickly show a sample here to give a complete tutorial. NOTE: This is just a quick sample of creating certs and not intended for production.

@turtlemonvh
turtlemonvh / load_kibana_objects.py
Last active July 1, 2018 09:39
Load kibana objects from json file via command line
#!/bin/env python
help = """
Load kibana dashboards or visualizations exported as json via the kibana ui on the command line.
Example:
$ python load_kibana_dashboards.py export.json 'http://un:pw@localhost:9207'
Posting: Per-node-doc-count (visualization)
{"_index":".kibana","_type":"visualization","_id":"Per-node-doc-count","_version":2,"_shards":{"total":1,"successful":1,"failed":0},"created":false}
@magnetikonline
magnetikonline / README.md
Last active January 24, 2023 21:06
Python - comparing JSON data structures.

Python - comparing JSON data structures

A function compare_json_data(source_data_a,source_data_b), accepting structures populated with data loaded from json.load() and comparing for equality.

Example

$ ./compare.py 
Compare JSON result is: True
import json
from botocore.exceptions import ClientError
import boto3
import sys
import logging
logger = logging.getLogger()
logger.setLevel(logging.INFO)
from zabbix.api import ZabbixAPI
@vasanthk
vasanthk / System Design.md
Last active July 3, 2024 16:14
System Design Cheatsheet

System Design Cheatsheet

Picking the right architecture = Picking the right battles + Managing trade-offs

Basic Steps

  1. Clarify and agree on the scope of the system
  • User cases (description of sequences of events that, taken together, lead to a system doing something useful)
    • Who is going to use it?
    • How are they going to use it?