Skip to content

Instantly share code, notes, and snippets.

@dlip
dlip / svn_log_increment_redmine.rb
Created August 4, 2010 08:00
Increments the trac ticket numbers in the svn log and replaces "ticket:" with # for Redmine multi project
@repo = "file:///path_to_svn_repo"
#How much each ticket should be incremented by
@increment_ticket = 100
#If the incremented ticket is above or below these numbers it will not increment
#Useful if you have a svn repository which refers to tickets in another project
@ticket_min = 0
@ticket_max = 100000
class SvnEntry
attr_accessor :revision, :log
@dlip
dlip / gist:5711808
Created June 5, 2013 05:33
Focus chrome from console command
wmctrl -a 'Google Chrome'
@dlip
dlip / gist:5711811
Created June 5, 2013 05:35
Banshee toggle playing from console
banshee --toggle-playing
@dlip
dlip / gist:5712371
Created June 5, 2013 08:14
vagrant increase memory / enable multicore
config.vm.customize ["modifyvm", :id, "--memory", "1024", "--ioapic", "on"]
# Set cpu cores
if not RUBY_PLATFORM.downcase.include?("mswin")
config.vm.customize ["modifyvm", :id, "--cpus",
`awk "/^processor/ {++n} END {print n}" /proc/cpuinfo 2> /dev/null || sh -c 'sysctl hw.logicalcpu 2> /dev/null || echo ": 2"' | awk \'{print \$2}\' `.chomp ]
end
@dlip
dlip / gist:5712378
Created June 5, 2013 08:15
xdebug vagrant config
zend_extension=/usr/lib/php5/20090626+lfs/xdebug.so
xdebug.remote_enable=1
xdebug.remote_handler=dbgp
xdebug.remote_mode=req
xdebug.remote_host=192.168.33.1
xdebug.remote_port=9000
xdebug.remote_cookie_expire_time=36000
xdebug.profiler_enable_trigger = 1;
xdebug.profiler_output_dir = "/vagrant/profiler"
xdebug.profiler_output_name = cachegrind.out.%t.%p
@dlip
dlip / gist:5712491
Created June 5, 2013 08:36
run composer install with symfony env prod
SYMFONY_ENV=prod ./composer.phar install
@dlip
dlip / gist:5712522
Created June 5, 2013 08:41
symfony fos_rest config
fos_rest:
param_fetcher_listener: true
view:
view_response_listener: true
failed_validation: HTTP_BAD_REQUEST
default_engine: php
formats:
json: true
format_listener:
prefer_extension: true
@dlip
dlip / Capfile
Last active March 10, 2016 22:51
Capistrano 3 deploy notification email with git diff
require 'mail'
@dlip
dlip / gist:11169293
Created April 22, 2014 07:57
Simple bash templating for nginx and docker
#!/bin/bash
REGISTRY_IP=$(docker inspect --format '{{ .NetworkSettings.IPAddress }}' registry)
for f in *
do
if [[ "$f" != *\.sh ]]
then
config=$(<$f);
config=${config//REGISTRY_IP/$REGISTRY_IP};
printf '%s\n' "$config" >../sites-enabled/$f
@dlip
dlip / gist:2051ef4136e42e2b5e1c
Created May 11, 2014 02:30
Replaces variables in a template using shell script
#!/bin/bash
if [ $# -eq 0 ]
then
echo "Templater"
echo "Copies templates from one folder to another."
echo "Only replaces variables that exist in the environment"
echo "Usage: templater IN_FOLDER OUT_FOLDER"
exit 1
fi