Skip to content

Instantly share code, notes, and snippets.

View w0rldart's full-sized avatar

Al w0rldart

View GitHub Profile
@w0rldart
w0rldart / docker-compose.yml
Created January 23, 2017 00:32
Docker + MySQL + Traefik
version: '2'
services:
traefik:
image: traefik
container_name: "traefik_site"
command: --web --docker --docker.domain=docker.localhost --logLevel=DEBUG
ports:
- "80:80"
- "8080:8080"
@w0rldart
w0rldart / swarm.sh
Created January 20, 2017 10:20
Create a cluster of Docker Engines, a.k.a a swarm
#!/bin/sh
###
## Virtual box options
###
export VIRTUALBOX_CPU_COUNT='1'
export VIRTUALBOX_DISK_SIZE='10000'
export VIRTUALBOX_MEMORY_SIZE='512'
swarm_workers=2
@w0rldart
w0rldart / System Design.md
Created April 22, 2016 09:33 — forked from vasanthk/System Design.md
System Design Cheatsheet

#System Design Cheatsheet

Picking the right architecture = Picking the right battles + Managing trade-offs

##Basic Steps

  1. Clarify and agree on the scope of the system
  • User cases (description of sequences of events that, taken together, lead to a system doing something useful)
    • Who is going to use it?
    • How are they going to use it?
@w0rldart
w0rldart / update-repos.sh
Last active August 29, 2017 12:17
Update all git repositories in a directory
for dir in `ls -d */`; do BASE_PATH=`pwd`; DIR_PATH=$BASE_PATH/$dir; cd $DIR_PATH; git pull; cd ../ ; done
@w0rldart
w0rldart / install-mongodb.sh
Last active April 3, 2022 00:53
Installing MongoDB on Ubuntu 15.04
#!/bin/sh
##
## Bash install script for mongo 3.2 for Ubuntu 15.04, because of
## the replacement of upstart with systemd
##
## - AUTHOR: Alexandru Budurovici <https://w0rldart.com>
## - VERSION: 1.0
##
@w0rldart
w0rldart / iso8601.php
Created September 12, 2015 12:31
ISO 8601 to seconds
/**
* Convert ISO 8601 values like PT15M33S
* to a total value of seconds.
*
* @param string $ISO8601
*/
function ISO8601ToSeconds($ISO8601)
{
preg_match('/\d{1,2}[H]/', $ISO8601, $hours);
preg_match('/\d{1,2}[M]/', $ISO8601, $minutes);
@w0rldart
w0rldart / logs.sql
Last active December 15, 2015 02:59
logs database for my apps
--
-- Database: `logs`
--
DROP DATABASE `logs`;
CREATE DATABASE `logs` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
USE `logs`;
-- --------------------------------------------------------
@w0rldart
w0rldart / services-action.sh
Created April 19, 2012 13:48
Get site status with CURL and invoke services action (restart, stop)
#!/bin/bash
## ./services-action.sh restart => To restart all the services
## ./services-action.sh restart postfix => To restart specific service (postfix in this case)
initPath="/etc/init.d/"
services="apache2,mysql,amavis,postfix,courier-authdaemon,courier-imap,courier-imap-ssl,courier-pop,courier-pop-ssl"
export IFS=","
if [ $# -lt 1 ]; then
@w0rldart
w0rldart / back-res.sh
Created March 23, 2012 18:24 — forked from zekus/back-res.sh
a backup script for ispconfig-3
#!/bin/bash
version="0.9.4 from 2010-09-13"
# Always download the latest version here: http://www.eurosistems.ro/back-res
# Thanks or questions: http://www.howtoforge.com/forums/showthread.php?t=41609
#
# CHANGELOG:
# -----------------------------------------------------------------------------
# version 0.9.4 - 2010-09-13
# --------------------------
# Small fix: - Corrected small bug replaced tar with $TAR in the recovery line