Skip to content

Instantly share code, notes, and snippets.

View aleksandar-babic's full-sized avatar

Aleksandar Babic aleksandar-babic

  • Novi Sad, Serbia
  • 10:26 (UTC +02:00)
View GitHub Profile
---
- hosts:
- containers
tasks:
#Check if nestegg3.py main script file exists
- stat:
path: /usr/local/sbin/nestegg3.py
register: resultPy
@aleksandar-babic
aleksandar-babic / backup.sh
Created August 15, 2017 18:11
Quick backup script
#!/bin/bash
#VARS
now=$(date)
nowDate="$(date +'%d-%m-%Y')"
nowTime="$(date +'%H%M')"
workDir="/root/backups/"
fileName="backup_wp_$nowTime.tar.gz"
fileNameOffSite="backup_wp_$nowTime_$nowDate.tar.gz"
@aleksandar-babic
aleksandar-babic / cannotGatherStats.php
Created August 18, 2017 15:06
mage2 cannot gather stats product
<?php
if($argc == 2){
$db['db_host'] = '127.0.0.1';
$db['db_username'] = 'username';
$db['db_password'] = 'password';
$db['db_databaseName'] = 'db';
$db['db_port'] = '3306'; // This is default MySql port, you can change it if needed
foreach ($db as $key => $value) {
define(strtoupper($key), $value);
}
@aleksandar-babic
aleksandar-babic / forceHttps.ps1
Created August 21, 2017 23:28
Azure App Gateway Force HTTPS
# Get the application gateway
$gw = Get-AzureRmApplicationGateway -Name DHProductionGatewayFE -ResourceGroupName DeployHandler
# Get the existing HTTPS listener
$httpslistener = Get-AzureRmApplicationGatewayHttpListener -Name appgatewayhttplistener -ApplicationGateway $gw
# Get the existing front end IP configuration
$fipconfig = Get-AzureRmApplicationGatewayFrontendIPConfig -Name appgatewayfrontendip -ApplicationGateway $gw
# Add a new front end port to support HTTP traffic
@aleksandar-babic
aleksandar-babic / error502.html
Created August 25, 2017 16:10
Custom 502 error
<!doctype html>
<html>
<head>
<title>Error|DeployHandler</title>
<meta charset="utf-8" />
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link href="https://fonts.googleapis.com/css?family=Montserrat" rel="stylesheet">
@aleksandar-babic
aleksandar-babic / 301Generator.py
Last active December 8, 2017 16:50
301 Generator from CSV file
import csv
import sys
def parseLinks(fileName):
redirectsList = []
with open(fileName, 'rb') as f:
reader = csv.reader(f)
next(reader, None) # Skip CSV file headers
for row in reader:
destination = row[3].split(' ')[0]
#!/bin/bash -
#===============================================================================
#
# FILE: gitPush.sh
#
# USAGE: ./gitPush.sh
#
# DESCRIPTION:
#
# OPTIONS: ---
@aleksandar-babic
aleksandar-babic / create.sql
Created January 29, 2018 12:23
Vivify Ideas - Vezba 4
-- Create table users with all needed fields
CREATE TABLE IF NOT EXISTS users (
id INT(6) UNSIGNED AUTO_INCREMENT PRIMARY KEY,
email VARCHAR(50) UNIQUE,
password VARCHAR(50),
firstname VARCHAR(30),
lastname VARCHAR(30),
company VARCHAR(30),
country VARCHAR(30)
);
@aleksandar-babic
aleksandar-babic / gist:af29cc1c8067ab833ffaed9782039065
Created March 28, 2018 21:27
Clear magento 2 cache after module enable/disable shell alias
alias clear-magento='rm -rf var/cache/* var/generation/* var/page_cache/* var/di/* var/view_preprocessed/*; bin/magento cache:flush; bin/magento setup:upgrade; bin/magento setup:di:compile; bin/magento setup:static-content:deploy'
@aleksandar-babic
aleksandar-babic / get-first-swarm-container.sh
Created June 6, 2018 13:38
Script returns ID of first container for given service in Docker Swarm Mode
#!/usr/bin/env bash
if [[ $# -eq 0 ]] ; then
echo 'usage: ./get-first-swarm-container.sh service-name'
exit 1
fi
docker ps | grep $1 | awk '{print $1}' | head -n 1