Skip to content

Instantly share code, notes, and snippets.

View mk-qi's full-sized avatar
💭
I may be slow to respond.

mkqi mk-qi

💭
I may be slow to respond.
View GitHub Profile
@rjsalts
rjsalts / newzone
Last active December 20, 2019 08:05
Add a new zone with rndc addzone on master an slave
#!/bin/bash
set -euo pipefail
IFS=$'\n\t'
# primary name server ips
primary=(192.0.2.2 2001:db8:1::53)
# secondary name server ips
secondary=(192.0.2.3 2001:db8:2::53)
#salt for NSEC3
salt=$(head -c 512 /dev/urandom | sha1sum | cut -b 1-16)
@jtyr
jtyr / hostsfile.py
Last active April 25, 2019 10:35
Ansible dynamic inventory script that reads any Ansible hosts file and transforms it into the JSON data structure.
This was moved to https://github.com/jtyr/ansible-ini_inventory
@andreicristianpetcu
andreicristianpetcu / ansible-summary.md
Created May 30, 2016 19:25
This is an ANSIBLE Cheat Sheet from Jon Warbrick

An Ansible summary

Jon Warbrick, July 2014, V3.2 (for Ansible 1.7)

Configuration file

intro_configuration.html

First one found from of

@imwilsonxu
imwilsonxu / app.py
Last active September 14, 2024 12:55
[Flask + Wtforms + Select2] #flask
# -*- coding: utf-8 -*-
from flask import Flask, request, render_template, current_app
from flask_wtf import Form
from wtforms.validators import DataRequired
from wtforms import SelectField, SelectMultipleField, SubmitField
app = Flask(__name__)
@scottcagno
scottcagno / cmdtimeout.go
Created May 27, 2016 18:47
Golang exec.Command Timeout Wrapper
package main
import (
"bytes"
"fmt"
"os/exec"
"time"
)
func run(timeout int, command string, args ...string) string {
@viper233
viper233 / ansible_api_playbook.py
Created February 26, 2016 22:29
Example using Ansible API 2.0 to run a playbook
#!/usr/bin/env python
# stolen from http://stackoverflow.com/questions/27590039/running-ansible-playbook-using-python-api
import os
import sys
from collections import namedtuple
from ansible.parsing.dataloader import DataLoader
from ansible.vars import VariableManager
from ansible.inventory import Inventory
@kikitux
kikitux / Vagrantfile
Last active January 3, 2018 23:14
vagrant-sphere sample Vagrantfile
#settings for vm
#name of vm to current directory
vm_prefix = Pathname.new(Dir.getwd).basename.to_s
vm_folder = "vagrant-vsphere/#{vm_prefix}"
vm_number = 3
vm_ram = 1024
vm_cpu = 2
vm_datastore = "sas"
#scripts
@jaceklaskowski
jaceklaskowski / deployment-tool-ansible-puppet-chef-salt.md
Last active February 20, 2025 16:38
Choosing a deployment tool - ansible vs puppet vs chef vs salt

Requirements

  • no upfront installation/agents on remote/slave machines - ssh should be enough
  • application components should use third-party software, e.g. HDFS, Spark's cluster, deployed separately
  • configuration templating
  • environment requires/asserts, i.e. we need a JVM in a given version before doing deployment
  • deployment process run from Jenkins

Solution

@dead-claudia
dead-claudia / Gmail Filter by Search Query.md
Last active December 18, 2023 21:37
Gmail script filter based on search queries

Gmail Filter by Search Query

This program, in the form of a configuration script and a main script, allows for complicated Gmail search queries to be used as filters. It also lets you do more advanced stuff you can't do with ordinary filters, like label based on whether an email contains a specific kind of attachment.

Installing

  1. Go to script.google.com.
  2. Go to File > New > Script File, and type Main as the title for the new script. This will be for the main script.
  3. Delete any pre-filled text in the script file, and copy main.gs from this gist to that file.
  4. Go to File > New > Script File again, and type Config as the title for the new script. This will be for configuration.
@d1manson
d1manson / images_in_pandas.md
Last active April 19, 2018 23:10
show images when displaying 2d arrays in iPython and Pandas

As of writing, this is only possible with my fork of pandas, but hopefully it will make its way into the main pandas stable branch.

The purpose of the fork is to let you specify a custom html formatter for individual columns in a data frame.


In this example we create a formatting function which takes a numpy array and returns a string of the form <img src='--base64-encoded-data'/>. This means that the numpy array is displayed as an image.

Below is the code we use to define our custom format function. Note that the function takes a single element from the data frame and returns and html string::