Skip to content

Instantly share code, notes, and snippets.

@benosman
benosman / dhcp2dns.rsc
Last active September 19, 2022 12:44 — forked from SmartFinn/dhcp-leases-to-dns.rsc
MikroTik (RouterOS) script for automatically setting DNS records for clients when they obtain a DHCP lease
# MikroTik (RouterOS) script for automatically setting DNS records
# for clients when they obtain a DHCP lease.
#
# authors:
# SmartFinn <https://gist.github.com/SmartFinn>
# elevendroids <https://gist.github.com/elevendroids>
:local dnsTTL "00:15:00";
:local token "$leaseServerName-$leaseActMAC";
:local LogPrefix "[dhcp2dns]($leaseServerName | $leaseActMAC)"
@benosman
benosman / ansible-provisioner.json
Last active September 19, 2019 14:01
Ansible Provisioner schema and generator (for https://github.com/radekg/terraform-provisioner-ansible)
{
"name": "ansible",
"type": "provisioner",
"version": "v2.3.0",
"schema": {
"ansible_ssh_settings": {
"Type": "TypeSet",
"Optional": true,
"Default": {},
"Elem": {
@benosman
benosman / axios-store-plugin.js
Last active April 29, 2020 18:58
Vuex Store plugin to inject axios instance into actions for axios nuxt module: https://github.com/nuxt-community/modules/tree/master/modules/axios
import Vuex from 'vuex';
// Copied from vuex/src/utils
function isPromise (val) {
return val && typeof val.then === 'function'
}
// Based on registerAction from vuex/src/store.js
function patchAction (store, type, handler, local) {
const entry = store._actions[type] || (store._actions[type] = [])
var fs = require('fs')
var Nuxt = require('nuxt')
var resolve = require('path').resolve
var rootDir = resolve('.')
var nuxtConfigFile = resolve(rootDir, 'nuxt.config.js')
var options = {}
if (fs.existsSync(nuxtConfigFile)) {
2016/09/24 18:31:49 [INFO] Terraform version: 0.7.4
2016/09/24 18:31:49 [INFO] CLI args: []string{"/usr/local/Cellar/terraform/0.7.4/bin/terraform", "apply"}
2016/09/24 18:31:49 [DEBUG] Detected home directory from env var: /Users/ben
2016/09/24 18:31:49 [DEBUG] Detected home directory from env var: /Users/ben
2016/09/24 18:31:49 [DEBUG] Attempting to open CLI config file: /Users/ben/.terraformrc
2016/09/24 18:31:49 [DEBUG] Detected home directory from env var: /Users/ben
2016/09/24 18:31:49 [DEBUG] DestroyEdgeInclude: Checking: dme_record.a_record
2016/09/24 18:31:49 [DEBUG] DestroyEdgeInclude: Checking: dme_record.txt_record
2016/09/24 18:31:49 [DEBUG] Checking resource noop: dme_record.txt_record
2016/09/24 18:31:49 [DEBUG] No diff, not a noop
@benosman
benosman / gist:e9cde12231b4bda05cc60179719eaef7
Created September 22, 2016 21:00 — forked from gmasse/gist:4b0c34be3d797cd729d2
OVH custom iPXE boot (dedicated server)

iPXE customer script (BETA)

Booting your server with your own iPXE script allows cool things like:

  • running diskless bare-metal system like CoreOS, SmartOS, ...
  • recovering with your own Rescue system or bare-metal restore tools (like Acronis and Idera)
  • launching Standard installer like ESXi, Linux, Solaris, ...

How ? Using directly the RESTful API EU|CA or the API console EU|CA.

---
# Vars is a list of variables, some will be required for the component library, others are specific to the custom tasks.
vars:
default_source: drupal
drupal_version: 7
static_root: static
dev_root: dev
bitbucket_user: username
github_user: username
@benosman
benosman / library.ini
Last active December 31, 2015 05:49
Example library file for Drupal workflow tool.
# Example component library file.
#
# Repo is set to drupal by default, so you can use the short form of the projects
#
# Components are separated into [groups]
#
# Components should be in form:
# source=version
##
# Available Sources (set using _source):
@benosman
benosman / .mrconfig
Created November 7, 2013 11:46
Regexp convert make file to myrepos (mr) format
search=^projects\[([\w_]*)\]\[subdir\][\s=]*"([\w_]*)"\nprojects\[([\w_]*)\]\[version\][\s=]*"([\w\.\-]*)"
replace=[modules/$2/$1]\nproject = $1\nversion = 6.x-$4
@benosman
benosman / example_style.inc.php
Last active December 27, 2015 07:29
Example Panels style plugin with substyles. You add this to your module or theme in the normal way for ctools / panels plugins. FIlename should end in .inc.
<?php
/**
* @file
* Definition of the 'bootstrap_style' panels style plugin.
*/
$plugin = array(
'title' => t('Example Parent Style'),
'description' => t('Example style providing substyles'),