Skip to content

Instantly share code, notes, and snippets.

@artbikes
artbikes / downgrade_Mongodb_replica_to_standalone.txt
Created March 2, 2018 15:28 — forked from marcoberri/downgrade_Mongodb_replica_to_standalone.txt
Migrate MongoDB ReplicaSet to single MongoDB Node
mongoserver:PRIMARY> rs.status();
{
"set" : "mongoserver",
"date" : ISODate("2016-02-02T10:47:07.510Z"),
"myState" : 1,
"members" : [
{
"_id" : 3,
"name" : "192.168.1.10:37017",
"health" : 1,
@artbikes
artbikes / vault-token-role-via-api.sh
Created May 7, 2018 19:47 — forked from greenbrian/vault-token-role-via-api.sh
HashiCorp Vault Token Role overview
# start vault in dev mode
VAULT_UI=true vault server -dev -dev-root-token-id="password"
# write some secrets for our example usage
curl --request POST \
--silent \
--header "X-Vault-Token: password" \
--header "Content-Type: application/json" \
--data '{ "options": { "cas": 0 }, "data": { "username": "administrator", "password": "hunter2" } }' \
http://127.0.0.1:8200/v1/secret/data/dev | jq '.'
Ansible playbook to setup HTTPS using Let's encrypt on nginx.
The Ansible playbook installs everything needed to serve static files from a nginx server over HTTPS.
The server pass A rating on [SSL Labs](https://www.ssllabs.com/).
To use:
1. Install [Ansible](https://www.ansible.com/)
2. Setup an Ubuntu 16.04 server accessible over ssh
3. Create `/etc/ansible/hosts` according to template below and change example.com to your domain
4. Copy the rest of the files to an empty directory (`playbook.yml` in the root of that folder and the rest in the `templates` subfolder)
@artbikes
artbikes / osx_bootstrap.sh
Created July 16, 2018 15:55 — forked from codeinthehole/osx_bootstrap.sh
Script to install stuff I want on a new OSX machine
#!/usr/bin/env bash
#
# Bootstrap script for setting up a new OSX machine
#
# This should be idempotent so it can be run multiple times.
#
# Some apps don't have a cask and so still need to be installed by hand. These
# include:
#
# - Twitter (app store)
@artbikes
artbikes / game-voter.patch
Created September 9, 2018 18:06
Patching Adam Petersen's `retro-games.lisp` into `game-voter.lisp`
--- old/retro-games.lisp 2011-06-14 00:08:07.000000000 -0400
+++ new/retro-games.lisp 2011-06-14 00:07:33.000000000 -0400
@@ -1,21 +1,24 @@
(in-package :cl-user)
-(defpackage :retro-games
- (:use :cl :cl-who :hunchentoot :parenscript :elephant))
+(defpackage :game-voter
+ (:use :cl :cl-who :hunchentoot :parenscript :elephant)
+ (:import-from :css-lite :css)
@artbikes
artbikes / Dockerfile
Created May 9, 2019 22:50 — forked from lenalebt/Dockerfile
Installing Taskwarrior in Kubernetes
FROM ubuntu:18.04
RUN apt-get update && apt-get -y upgrade
RUN apt-get install -y taskd
CMD taskd server
@artbikes
artbikes / README.md
Created October 8, 2019 16:37 — forked from shortjared/README.md
If you have ever wanted to grab a marketplace AMI (ex: OpenVPN) you'll know that the process is painful. This solves the pain.

Usage

  • You will need to first make sure you have subscribed to the marketplace product
  • Get the AMI of the marketplace
  • Copy the script to machine
  • awsume (or otherwise authorize) to AWS
  • chmod the script to be executable if needed chmod +x marketplace-ami-encryptor.sh

Usage ./marketplace-ami-encryptor.sh {region} {ami} {name}
Example: ./marketplace-ami-encryptor.sh us-east-1 ami-f6eed4e0 OpenVPN

@artbikes
artbikes / cleanup-ami.py
Created October 21, 2019 14:59 — forked from marvinpinto/cleanup-ami.py
Python script to clean up and update the Jenkins AMIs after a successful Packer run
#!/usr/bin/python
import requests
import os
import boto.ec2
import sys
import re
build_url = os.environ['BUILD_URL']
jenkins_base_url = os.environ['JENKINS_URL']
@artbikes
artbikes / user-data.txt
Created October 24, 2019 22:20 — forked from RichardBronosky/user-data.txt
Chef Bootstrapping an EC2 instance immediately and handsfree using cloud-init user-data
#cloud-config
#
# This is an example file to automatically install chef-client and run a
# list of recipes when the instance boots for the first time.
# Make sure that this file is valid yaml before starting instances.
# It should be passed as user-data when starting the instance.
#
# This example assumes the instance is 16.04 (xenial)
#!/bin/sh
#
# This script deploys the given manifest,
# tracks the deployment, and rolls back on failure.
#
# First execute this with "myapp.yaml" and then try it with "myapp.failing.yaml"
#
MANIFEST_PATH=$1
DEPLOYMENT_NAME=myapp