Skip to content

Instantly share code, notes, and snippets.

View arossouw's full-sized avatar

Arno Rossouw arossouw

  • Anonymous
View GitHub Profile
@hi1280
hi1280 / Vagrantfile
Created September 25, 2019 13:50
Kubernetes Setup Using Ansible and Vagrant
IMAGE_NAME = "bento/ubuntu-16.04"
N = 2
Vagrant.configure("2") do |config|
config.ssh.insert_key = false
config.vm.provider "virtualbox" do |v|
v.memory = 1024
v.cpus = 2
end
WITH RECURSIVE traversed (id, name, path, `left`, `right`) AS (
SELECT id,
name,
CAST(JSON_ARRAY(id) AS JSON),
`left`,
`right`
FROM binary_tree
WHERE id = 1
UNION
SELECT b.id,
---
authorized_pubkeys:
- ../vars/public_keys/devops@webstores.nl.pub
- ../vars/public_keys/tom.keur@webstores.nl.pub
revoked_pubkeys:
- ../vars/public_keys/webstores-management-key.pub
@TomKeur
TomKeur / ssh-public-keys.yml
Last active June 1, 2021 14:25
Linux public keys #ansible
---
- hosts: all
vars_files:
- ../vars/public_keys.yml
tasks:
- name: Linux users authorized public keys
authorized_key:
user: "{{ ansible_user }}"
state: present
---
- hosts: all
become: yes
vars_files:
- var.yaml
tasks:
- name: add a admin group
group: name=admin state=present
- name: add a new user
@akshendra
akshendra / cw-ec2:redis-cw.py
Last active November 26, 2021 11:33
Send redis info to cloudwatch
#!/usr/bin/env python3
'''
Send Redis usage metrics to CloudWatch
'''
import redis
import json
import boto3
import os
// Split the array into halves and merge them recursively
function mergeSort(array) {
if (array.length === 1) {
// Return once we hit an array with a single item
return array
}
// Get the middle item of the array rounded down by creating a variable
const middle = Math.floor(array.length / 2)
// Create a variable for the items on the left side
@ddrscott
ddrscott / sub_query_test.sql
Last active February 27, 2018 16:17
Testing how smart Postgres handles sub query aggregates
anon=# SELECT
anon-# SUM(impressions)
anon-# FROM direct_delivery_items;
sum
--------------
544642902932
(1 row)
Time: 19853.941 ms -- base line measurement
anon=# SELECT
@ddrscott
ddrscott / histogram.sql
Last active December 9, 2022 18:03
Histogram for PostgreSQL without width_bucket.
WITH params AS (
-- Parameters for down stream queries
SELECT
15 AS bucket_count,
80 AS max_bars
),
numbers AS (
-- Change this query to select real data.
-- For now we make random set of numbers.
SELECT
@creisor
creisor / add_users.yml
Created May 5, 2017 15:11
Ansible tasks for adding users to hosts, and adding their authorized keys to other users so they can login as those users
---
- name: add users
user:
name: "{{ item.name }}"
state: present
groups: "{{ item.groups }}"
shell: /bin/bash
with_items: "{{ users }}"
- name: add authorized keys