Skip to content

Instantly share code, notes, and snippets.

View vdvm's full-sized avatar

Attila van der Velde vdvm

View GitHub Profile
@vdvm
vdvm / gist:4665450
Last active December 13, 2023 23:29
Recursive array str_replace
<?php
function recursive_array_replace($find, $replace, $array) {
if (!is_array($array)) {
return str_replace($find, $replace, $array);
}
$newArray = array();
@vdvm
vdvm / unattended-mysql_secure_installation.md
Created December 23, 2014 14:50
A way to run mysql_secure_installation unattended

anwsers.txt:



mysecret
mysecret


n
@vdvm
vdvm / main.go
Created June 16, 2023 11:05
Diceware Password Generator by ChatGPT
package main
import (
"bufio"
"flag"
"fmt"
"log"
"math/rand"
"os"
"strings"
@vdvm
vdvm / auroraobjects-laravel.md
Created April 22, 2014 13:04
Using AuroraObjects with Laravel 4
https://github.com/aws/aws-sdk-php-laravel
https://github.com/aws/aws-sdk-php

composer.json:

{
 "require": {
@vdvm
vdvm / srt2vtt.sh
Created April 15, 2014 14:31
Convert .srt to .vtt
#!/bin/bash
echo "WEBVTT"
echo ""
sed '/[0-9][0-9]:[0-9][0-9]:[0-9][0-9],[0-9][0-9][0-9] --> [0-9][0-9]:[0-9][0-9]:[0-9][0-9],[0-9][0-9][0-9]/s/,/./g' $1
@vdvm
vdvm / .editorconfig
Created July 22, 2017 10:25
EditorConfig
# top-most EditorConfig file
root = true
[*]
indent_style = space
indent_size = 4
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
@vdvm
vdvm / www.conf
Created October 16, 2016 14:17 — forked from evansolomon/www.conf
PHP-FPM config
; Start a new pool named 'www'.
; the variable $pool can we used in any directive and will be replaced by the
; pool name ('www' here)
[www]
; Per pool prefix
; It only applies on the following directives:
; - 'slowlog'
; - 'listen' (unixsocket)
; - 'chroot'
#!/usr/bin/env bash
set -e
if [[ -e /home/core/volumes/consul/raft/peers.json ]] && [[ $(cat /home/core/volumes/consul/raft/peers.json | jq '. | length') -ge 3 ]]; then
echo "CONSUL_BOOTSTRAP=\"\"" > /tmp/consul-env
exit
fi
if [[ MACHINES=$(etcdctl ls /consul.io/machines | grep -v ${HOSTNAME}) ]] && [[ ${#MACHINES[@]} -ge 1 ]]; then
for MACHINE in "$MACHINES"; do
<?php
return array(
'includes' => array('_aws'),
'services' => array(
'default_settings' => array(
'params' => array(
'key' => 'KEY',
'secret' => 'SECRET',
'base_url' => 'http://o.auroraobjects.eu'
@vdvm
vdvm / sesscache.go
Created June 23, 2015 10:01
Distributed PHP sessions using memcached extension and coreos/etcd (PoC)
package main
import (
"bufio"
"fmt"
"net"
"regexp"
"runtime"
"strconv"
"strings"