Skip to content

Instantly share code, notes, and snippets.

@tristanfisher
tristanfisher / Ansible-Vault how-to.md
Last active March 25, 2025 12:44
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.

@JamesMGreene
JamesMGreene / gitflow-breakdown.md
Last active March 27, 2025 17:19
`git flow` vs. `git`: A comparison of using `git flow` commands versus raw `git` commands.

Initialize

gitflow git
git flow init git init
  git commit --allow-empty -m "Initial commit"
  git checkout -b develop master

Connect to the remote repository

@dbrgn
dbrgn / mixins.py
Last active September 13, 2018 20:44
Moved to https://github.com/dbrgn/drf-dynamic-fields
@acenqiu
acenqiu / redis-backup.sh
Last active March 15, 2024 09:59
redis rdb backup script
#!/bin/bash
#
## redis backup script
## usage
## redis-backup.sh port backup.dir
port=${1:-6379}
backup_dir=${2:-"/data/backup/redis"}
cli="/usr/local/bin/redis-cli -p $port"
@stuartpb
stuartpb / demo.html
Last active February 10, 2018 14:23 — forked from kig/gzip.js
<!DOCTYPE html>
<html>
<head>
<script src="gzip.js"></script>
<script>
function showImg(f) {
var res = document.getElementById('results');
var e = document.createElement('div');
res.appendChild(e);
var p = document.createElement('p');
@hummus
hummus / gist:8592113
Last active September 26, 2024 01:29
aws cli + jq example
wget http://stedolan.github.io/jq/download/linux64/jq
aws ec2 describe-instances --filters "Name=tag:Name,Values=$NAME" \
"Name=instance-state-name,Values=running" \
| jq -r \
".Reservations[] | .Instances[] | .InstanceId" \
aws ec2 describe-volumes --filters \
"Name=status,Values=available" \
| jq -r ".Volumes[] | .VolumeId" \
@bertspaan
bertspaan / README.md
Created January 2, 2014 15:28
Python script to convert DBF database file to CSV
@tahajahangir
tahajahangir / mongo_dump.py
Last active December 31, 2015 23:19 — forked from kesor/sql_mongodb_dump_middleware.py
The file is a util for dumping mongo commands/queries. Can be used in any python environment, and included a django middleware.
import struct
import logging
from pymongo import MongoClient
import bson
from bson.errors import InvalidBSON
from pymongo.mongo_replica_set_client import MongoReplicaSetClient
logger = logging.getLogger('mongo_dump')
@hzbd
hzbd / postgres_backup
Created November 10, 2013 06:16
PostgreSQL database backup script (Python recipe)
#!/usr/bin/env python
import os
import time
username = 'root'
defaultdb = 'postgres'
port = '5433'
backupdir='/www/backup/'
date = time.strftime('%Y-%m-%d')
@plentz
plentz / nginx.conf
Last active April 19, 2025 04:46
Best nginx configuration for improved security(and performance)
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048