Skip to content

Instantly share code, notes, and snippets.

View svenvarkel's full-sized avatar

Sven Varkel svenvarkel

View GitHub Profile
@svenvarkel
svenvarkel / bamboo
Created September 23, 2013 07:30
Bamboo init script for Debian
#!/bin/sh
### BEGIN INIT INFO
# Provides: bamboo
# Required-Start: $local_fs $remote_fs $network $syslog nginx
# Required-Stop: $local_fs $remote_fs $network $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: starts bamboo server
# Description: starts bamboo using start-stop-daemon
@svenvarkel
svenvarkel / confluence
Created September 23, 2013 07:31
CONFLUENCE init script for Debian
#!/bin/sh
### BEGIN INIT INFO
# Provides: confluence
# Required-Start: $local_fs $remote_fs $network $syslog nginx
# Required-Stop: $local_fs $remote_fs $network $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: starts confluence server
# Description: starts confluence using start-stop-daemon
@svenvarkel
svenvarkel / create_debian_vm.sh
Created October 18, 2013 06:48
Create and start Debian 7 server headless in VirtualBox
#!/bin/bash
if test $# != 1; then
echo "Usage: $0 vm_name"
exit 0
fi
VMNAME=$1
vboxmanage createvm --name $VMNAME --ostype Debian_64 --register
vboxmanage modifyvm $VMNAME --memory 512 --acpi on --boot1 dvd --nic1 bridged --bridgeadapter1 eth0 --nictype1 virtio --cpus 2 --cpuhotplug on
vboxmanage createhd --filename ~/VirtualBox\ VMs/testvm/$VMNAME-disk01.vdi --size 4096 --variant Standard
vboxmanage storagectl $VMNAME --name SATA controller --add sata
@svenvarkel
svenvarkel / retrieve_magento_db_password.sh
Created October 28, 2013 10:39
This is a useful oneliner for reading Magento database password from local.xml in command line
#!/bin/bash
# run in your app/etc folder
grep -o -P "<password><\!\[CDATA\[([\w]*)\]\]><\/password>" local.xml | sed -e 's|<password><\!\[CDATA\[||g' | sed -e 's|\]\]></password>||g'
@svenvarkel
svenvarkel / git-find-large-files
Created December 4, 2013 08:44
This script finds the n largest files from your git repository.
#!/bin/sh
#
# Credits go to: http://article.gmane.org/gmane.comp.version-control.git/123050
#
usage() {
echo "usage: `basename $0` [<limit>]"
exit 1
}
@svenvarkel
svenvarkel / git-remove-large-files
Created December 4, 2013 08:46
This script helps to remove specified files or folders from the whole GIT repository history
#!/bin/bash
# 1. list git branches
# 2. iterate thru branches
# 3. for each branch do git filter-branch --index-filter "git rm -rf --cached --ignore-unmatch FILENAME" HEAD
filepath=$1
remove_large_files(){
for branch in $(git branch)
do
echo "Removing ${filepath} from ${branch}"
git filter-branch -f --index-filter "git rm -rf --cached --ignore-unmatch ${filepath}" $branch
@svenvarkel
svenvarkel / .gitignore
Created December 4, 2013 09:25
A reference .gitignore file for Magento 1.* projects
#
# .gitignore version 1.0-beta
#
# For the reference see the folder structure here:
# http://measure9.varkel.net/2013/10/setting-up-magento-development-environment-step-by-step-part-3-naming-and-structure/
#
# System files, special files
#
.DS_Store
._*
@svenvarkel
svenvarkel / fix_permissions.sh
Created December 20, 2013 22:40
Fix file permissions in your Magento project folder. It has some constraints: - use group name "dev" for your developers and your "php/web server user" (www-data) - it's untested in other environments than Debian/Ubuntu
#!/bin/bash
#
# This script fixes permissions on Magento subtree
#
# Usage:
# cd to virtual host folder
# run script by issuing utils/fix_permissions.sh . command
#
# Author Sven Varkel <[email protected]>
# Copyright 2013 MageFlow Ltd
@svenvarkel
svenvarkel / kill_glassfish.sh
Created January 14, 2014 19:27
Kill glassfish easily, quickly and for sure: ./kill_glassfish.sh
#!/bin/bash
ps -ef | grep "[c]om.sun.enterprise.glassfish.bootstrap.ASMain" | awk '{print $2}' | xargs kill -9
@svenvarkel
svenvarkel / Package.php
Created July 1, 2014 20:49
Magento 1.* extension packager bug in lib/Mage/Connect/Command/Package.php
<?php
/**
* Magento
*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide- web at this URL:
* http://opensource.org/licenses/osl-3.0.php