Skip to content

Instantly share code, notes, and snippets.

🤠
Doing it live

Aleksey Korzun AlekseyKorzun

🤠
Doing it live
View GitHub Profile
View gulpfile.js
// Include gulp and plugins
var gulp = require('gulp'),
rename = require('gulp-rename'),
autoprefixer = require('gulp-autoprefixer'),
minifycss = require('gulp-minify-css'),
clean = require('gulp-clean'),
concat = require('gulp-concat'),
browserSync = require('browser-sync'),
reload = browserSync.reload,
hologram = require('gulp-hologram'),
@AlekseyKorzun
AlekseyKorzun / gist:28a610afc223c435a888ac491f3b3b8e
Created May 16, 2016
Jenkins database sync from production to staging/qa
View gist:28a610afc223c435a888ac491f3b3b8e
## On production slave (out of rotation)
# Create our database dump
mysqldump ${DATABASE} > ${DATABASE}-${BUILD_ID}.sql
gzip -6 ${DATABASE}-${BUILD_ID}.sql
# Transfer it
scp ${DATABASE}-${BUILD_ID}.sql.gz jenkins@__STAGING__.__DOMAIN__.com:/tmp/${DATABASE}-${BUILD_ID}.sql.gz
# Clean up
@AlekseyKorzun
AlekseyKorzun / gist:7bef94033c5f5cf3a57e4a900efe3ddc
Created May 16, 2016
Jenkins deploy configuration for NAMP environments
View gist:7bef94033c5f5cf3a57e4a900efe3ddc
# Extract payload
mkdir -p /www/site/packages/${BUILD_ID}/
tar -zxf /www/site/packages/package.tar.gz -C /www/site/packages/${BUILD_ID}/
# Maintenance logic
IS_MAINTENANCE=true
if [ ! -f "/www/site/packages/${BUILD_ID}/www/maintenance.flag" ]; then
IS_MAINTENANCE=false
touch "/www/site/packages/${BUILD_ID}/www/maintenance.flag"
fi
@AlekseyKorzun
AlekseyKorzun / gist:c70dc6385b89586fdc6de9c58c80d948
Created May 16, 2016
Jenkins building configuration example with tag management and Gulp
View gist:c70dc6385b89586fdc6de9c58c80d948
echo "Creating package structure..."
rm -rf package
# Purge old tags
echo "Tag: jenkins-${JOB_NAME}"
git fetch --tags
tag_limit=4
tag_current=`git tag -n |grep -i "jenkins-${JOB_NAME}" | wc -l`
@AlekseyKorzun
AlekseyKorzun / policy.xml
Created May 5, 2016
Policy update to secure ImageMagik
View policy.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE policymap [
<!ELEMENT policymap (policy)+>
<!ELEMENT policy (#PCDATA)>
<!ATTLIST policy domain (delegate|coder|filter|path|resource) #IMPLIED>
<!ATTLIST policy name CDATA #IMPLIED>
<!ATTLIST policy rights CDATA #IMPLIED>
<!ATTLIST policy pattern CDATA #IMPLIED>
<!ATTLIST policy value CDATA #IMPLIED>
@AlekseyKorzun
AlekseyKorzun / update-pingdom-iptables-centos.sh
Last active Oct 28, 2015 — forked from mickm/update-pingdom-iptables.sh
Whitelist Pingdom probe-servers in iptables on CentOS.
View update-pingdom-iptables-centos.sh
#!/bin/bash
#
# Whitelist Pingdom probe-servers in iptables.
#
# Create a chain called "PINGDOM" and jump to it somewhere before
# the final REJECT/DROP, e.g.
#
# # New chain for Pingdom rules
# :PINGDOM - [0:0]
#
@AlekseyKorzun
AlekseyKorzun / lighttpd-lua-example
Last active Oct 24, 2015
Static bandwidth limiting and blacklisting with Lighttpd + Lua
View lighttpd-lua-example
# Lighttpd
$HTTP["referer"] !~ "^($|http://([^/]*\.)?imagesocket\.(com|net|org)/)" {
magnet.attract-physical-path-to = ("/www/sites/conf/imagesocket/bandwidth.lua")
}
# Lua check for images that exceeded limit(S)
# Path - Flag - Expiration
local url_check =
{
["/images/2012/08/20/1.png"] = true, -- 1352167206
View gist:f2bca06f74257cfae288
Credit to Paul Moore / @Paul_Reviews:
1. Navigate to http://www.roboform.com/have-i-been-hacked
2. Replace 'Enter account to test' with following: <script type="text/javascript">$('img').attr('src', 'https://lastpass.com/images/lastpass-logo.png');</script>
3. Click on 'Check Now'
In action:
http://g.recordit.co/oBk26XEv0P.gif
View gist:8e75021a4d045c9420a5
#!/bin/bash
#
# Author: Aleksey Korzun
echo "=========================================================================="
echo " Magento Data Segmentator v1.0.1 "
echo "=========================================================================="
help() {
echo "Usage: -s schema [-f filename] [-e '(baublebar.com|aleksey.v.korzun@gmail.com)'] [-d 7] [-l 1000] [-r 1]" 1>&2;
@AlekseyKorzun
AlekseyKorzun / gist:9901982
Last active Aug 29, 2015
MySQL replication monitoring script
View gist:9901982
#!/bin/bash
#
# Author: Aleksey Korzun
email='alert@domain.com'
default_max=60
echo "=========================================================================="
echo " Replicator Man v1.0.2 "
echo "=========================================================================="
You can’t perform that action at this time.