Skip to content

Instantly share code, notes, and snippets.

@t2d
t2d / main.yml
Last active June 25, 2020 20:14
ansible distribution specific vars and tasks
---
# (c) Wong Hoi Sing Edison <hswong3i@pantarei-design.com>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
#!/bin/bash
OLDIFS=$IFS
export IFS=$'\n'
# Find all boxes which have updates
AVAILABLE_UPDATES=$(vagrant box outdated --global | grep outdated | tr -d "*'" | cut -d ' ' -f 2 2>/dev/null)
if [[ ${#AVAILABLE_UPDATES[@]} -ne 0 ]]; then
@kunicmarko20
kunicmarko20 / LocaleListener.php
Last active December 23, 2022 03:59
Symfony Locale Listener that redirects to default language route if no language has been added instead of 404
<?php
namespace YourBundle\EventListener;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\Routing\RouterInterface;
use Symfony\Component\HttpKernel\Event\GetResponseEvent;
use Symfony\Component\HttpKernel\KernelEvents;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\Routing\Matcher\UrlMatcher;
use Symfony\Component\Routing\RequestContext;
@arbabnazar
arbabnazar / gist:6b9909cfba52ac066512ba5d1c1a1080
Created July 9, 2016 09:20 — forked from mpolden/gist:8559017
Example for Ansible git-module and ssh agent forwarding
# files/env:
Defaults env_keep += "SSH_AUTH_SOCK"
# tasks/main.yml
- name: ensure sudo keeps SSH_AUTH_SOCK in environment
copy: src=env
dest=/etc/sudoers.d/env
mode=0440
owner=root
group=root
@roblayton
roblayton / Vagrantfile
Created June 27, 2015 22:46
A Vagrant multi-machine cluster using a loop
# -*- mode: ruby -*-
# vi: set ft=ruby :
VAGRANTFILE_API_VERSION = "2"
cluster = {
"master" => { :ip => "192.168.33.10", :cpus => 1, :mem => 1024 },
"slave" => { :ip => "192.168.33.11", :cpus => 1, :mem => 1024 }
}
@Finkregh
Finkregh / create-prosody-groups.sh
Created December 6, 2013 11:15
add groups from Active Directory / ldap to prosody
#!/bin/bash
#/usr/local/bin/create-prosody-groups.sh
tmpfile=/tmp/sharedgroups.txt
for org in group1 group2 ; do echo "[${org}]" ; ldapsearch -x -h ldap.corp.org -D "ldap-bind-user" -w "ldap-bind-pw" -LLL -b "ou=${org},dc=corp,dc=org" "(&(objectClass=user)(mail=*))" | grep -E "^cn: |sAMAccountName: "; done > ${tmpfile}
while read line ; do
if echo ${line} | grep -qE "^\[" ; then