Skip to content

Instantly share code, notes, and snippets.

@fl64
fl64 / Dockerfile
Created February 6, 2019 17:44
nginx Dockerfile
FROM alpine:latest
EXPOSE 80
EXPOSE 443
RUN apk add nginx
RUN mkdir -p /run/nginx && mkdir -p /var/www
COPY nginx.conf /etc/nginx/nginx.conf
COPY index.html /var/www
CMD ["nginx", "-g", "daemon off; env xxx=1;"]
@fl64
fl64 / docker-compose cut
Last active March 21, 2019 11:14
docker compsoe tmpfs (RO root)
version: "2.4"
services:
my_app:
image: my_app
read_only: true
restart: always
tmpfs:
- /run:mode=770,size=1k,uid=200,gid=10000
@fl64
fl64 / docker-mod.yml
Created April 4, 2019 16:05
Ansible playbook for modifying /etc/docker/daemon.json config (based on https://stackoverflow.com/questions/50796341/add-a-new-key-value-to-a-json-file-using-ansible)
- hosts: all
become: yes
gather_facts: false
vars:
tasks:
- name: Check that the /etc/docker/daemon.json exists
stat:
path: /etc/docker/daemon.json
register: stat_result
@fl64
fl64 / query.json
Created July 14, 2019 10:34 — forked from cb372/query.json
Using the Elasticsearch scroll API
{
"sort": ["_doc"],
"size": 100,
"query": {
"bool": {
"must": {
"match_all": {}
},
"filter": {
...
@fl64
fl64 / ansible-bootstrap-ubuntu-16.04.yml
Created August 11, 2019 19:35 — forked from gwillem/ansible-bootstrap-ubuntu-16.04.yml
Get Ansible to work on bare Ubuntu 16.04 without python 2.7
# Add this snippet to the top of your playbook.
# It will install python2 if missing (but checks first so no expensive repeated apt updates)
# [email protected]
- hosts: all
gather_facts: False
tasks:
- name: install python 2
raw: test -e /usr/bin/python || (apt -y update && apt install -y python-minimal)
@fl64
fl64 / 11.sh
Created September 3, 2019 07:06
xxx
#!/bin/bash
help () {
HELP=$(cat << EOL0
\n
=====================\n
gmserver-log-exporter\n
=====================\n
\n
--host - Elastic host IP-address (def: 127.0.0.1)\n
@fl64
fl64 / Vagrantfile
Last active February 5, 2021 16:04
Vagrantfile for multiply VM (dict) for Ansible-roles test
# -*- mode: ruby -*-
# vi: set ft=ruby :
goss_version="v0.3.9"
vms = {
"master" => { :ip => "10.111.111.10", :playbook => "tests/vagrant_master.yml" },
"client" => { :ip => "10.111.111.20", :playbook => "tests/vagrant_client.yml" }
}
@fl64
fl64 / main.go
Last active February 20, 2020 05:40
golang: sort struct by fields
package main
import (
"fmt"
"sort"
)
type User struct {
FName string
SName string
@fl64
fl64 / Vagrant file multiply VMs
Created June 8, 2020 15:01
Multiply vagrant VMs
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
config.vm.box = "ubuntu/xenial64"
#config.vm.box = "geerlingguy/centos7"
config.vm.synced_folder "synced/", "/synced"
config.vm.provider "virtualbox" do |vb|
vb.gui = false
vb.memory = 1024
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
#config.vm.synced_folder '.', '/vagrant', disabled: true
#config.ssh.private_key_path = ["~/.ssh/id_rsa", "~/.vagrant.d/insecure_private_key"]
#config.ssh.insert_key = false
#config.ssh.forward_agent = true
config.vm.box = "ubuntu/bionic64"