Other: Filter git repo on folder

# check out
git filter-branch --subdirectory-filter src/folder/<folders> -- --all
git reset --hard
 
# and now really, really clean up all objects not referenced anymore...
git remote rm origin
Termlisting: 

git move files rewrite history

git filter-branch --prune-empty --tree-filter 'if [ ! -e foo/bar ]; then mkdir -p foo/bar; git ls-tree --name-only $GIT_COMMIT | grep -v ^foo$ | xargs -I files mv files foo/bar || echo ""; fi'
Termlisting: 

Other: Windows Batch for Symfony2 with xampp, git, mysql

Windows-Console mit php, git in PATH-Variable für Symfony, Doctrine und Co.

@set git_install_root=C:\Tools\PortableGit-1.7.10-preview20120409
@set xampp_install_root=C:\xampp\
 
 
@set PATH=%git_install_root%\bin;%git_install_root%\mingw\bin;%git_install_root%\cmd;%PATH%

PHP: search multidimensional array recursive on key

search php multidimensional array and return parent array

/**
 *
 * @param array $array
 *  Array to search
 * 
 * @param type $search
 *  key to search
 * 
 * @return type 
 *  false or array
 * 
 */
function array_search_recursive_single(array 

Other: Block Google Bot on apache2 htacces or Directory Directive

<Directory "/var/www/yourpage">
  SetEnvIf  User-Agent .*google.* search_robot
  SetEnvIf  User-Agent .*yahoo.* search_robot
  SetEnvIf  User-Agent .*bot.* search_robot
  SetEnvIf  User-Agent .*as

MySQL migrate users, rights, and databases

Hat man mehrere MySQL User, ist es recht umständlich sie via SHOW GRANTS zu exportieren und wieder anzulegen. Viel eleganter geht das mit mk-show-grants aus der maatkit Suite.
Alle MySQL User

mk-show-grants -u root -p PASSWORD > grants.sql

Ohne root und debian-sys-maint

mk-show-grants -u root -p PASSWORD --ignore root@127.0.0.1,root@localhost,debian-sys-maint@localhost > grants.sql

Alle MySQL User
mk-show-grants -u root -p PASSWORD > grants.sql
 
Ohne root und debian-sys-maint
mk-show-grants -u root -p PASSWORD --ignore root@127.0.0.1,root@localhost,debian-sys-maint@localhost

Apache2 Performance Config

#dont log static file requests
SetEnvIf Request_URI "\.(jpg|xml|png|gif|ico|js|css|swf|js?.|css?.)$" DontLog
CustomLog /var/log/apache2/access-example.com.log combined Env=!DontLog

Apache proxy redirect dns

<VirtualHost *:80>
        ServerName  servername.de
        #Include     /var/www/alias.conf
 
    ProxyRequests Off
    <Proxy *>
        Order deny,allow
        Allow from all
    </Proxy>
Termlisting: 

PHP: tabledrag / tablesort drupal7

$test = ParserBase::InstanceOnDir($cid);
 dpm($bs = $test->GetBouquetsRaw());
 
 $form = array();
 
 $rows = array();
 $i = 0;
 foreach ($bs as $key => $b) {
  $row = array(
    'name' => '<inp
Termlisting: 

SSH: SSH public/private key

#ssh-keygen -t rsa1	  # für Protokol 1 (!! nicht mehr verwenden !!)
ssh-keygen -t rsa	  # für Protokol 2
ssh-keygen -t dsa	  # für Protokol 2
 
ssh-copy-id -i ~/.ssh/id_rsa.pub user@remote-system

Pages

Subscribe to snippet.espend.de RSS