Map datarange to another datarange
int value = map(input, minOldRange, maxOldRange, minNewrange, maxNewRange);
int value = map(input, minOldRange, maxOldRange, minNewrange, maxNewRange);
If you have problems to get rid of FHEM, because of some package inconsistencies cause by broken installation or so, you can do this: $> sudo dpkg –remove –force-remove-reinstreq fhem $> sudo apt-get-update -f
Create and initialize your new repository: $> mkdir <repo> && cd <repo> $> git init $> git remote add –f <name> <url> Enable sparse-checkout: $> git config core.sparsecheckout true Configure sparse-checkout by listing your desired sub-trees in .git/info/sparse-checkout: $> echo some/dir/ >> .git/info/sparse-checkout $> echo another/sub/tree >> .git/info/sparse-checkout Checkout from the remote: $> git pull […]
$> atop -r DATE The date format is YYYYMMDD. The output should look like this: Installation $> apt-get install atop # Debian, Ubuntu … $> yum install atop # CentOS,Fedora …
Init from the scratch $> mkdir /path/to/your/project $> cd /path/to/your/project $> git init $> git remote add origin https://Bravehartk2@bitbucket.org/Bravehartk2/magento-versions.git $> git fetch First checkout $> git checkout origin/master $> git pull origin master Push to an existing repo $> cd /path/to/my/repo $> git remote add origin https://Bravehartk2@bitbucket.org/Bravehartk2/magento-versions.git $> git push -u origin –all # pushes […]
To return a downloadable file in a controller action, you have to send a file header in controller like that: $fileName = ‘mm_actioncodes_export_’.date(“Ymd_His”).’.csv’; $fp = fopen(Mage::getBaseDir(‘var’) . DS .’export’ . DS . $fileName, ‘w’); fputcsv($fp, $codes, ‘;’, ‘”‘); fclose($fp); $this->_prepareDownloadResponse($fileName, array( ‘type’ => ‘filename’, ‘value’ => Mage::getBaseDir(‘var’) . DS .’export’ . DS . $fileName, //’rm’ => true […]
To get Mailcatcher (http://mailcatcher.me/) running under PuPHPet-based Vagrant (http://puphpet.com) I had to implement the following shell script in puphpet/files/startup-always/correct_mail_catcher.sh: #!/bin/sh sed -i “s/^sendmail_path=\/usr\/local\/rvm\/wrappers\/default\/catchmail -f$/sendmail_path=\/usr\/local\/rvm\/wrappers\/default\/catchmail -f mailman@local.sheldon.dev/g” /etc/php.d/zzzz_custom.ini echo “SET sendmail_path” The script adds a value to the -f param and that fixes the issue, that no mails are collected by mailcatcher. Versions: Vagrant: 1.6.2 Puppet: 3.4.3 OS: CentOS 6.5 (Final) / […]
In most cases you don’t want to write the same layout declaration twice. With the following snippet you can trigger a once written layout handle in other layout handles. So you can reuse the declaration. <modul_controller_action> <update handle=”modul_controller_action”/><!–layout handle to trigger–> </modul_controller_action>
… its so easy for the current branch: $> git branch -m <newname> … and for any branch too: $> git branch -m <oldname> <newname>
If you got the “Too many authentication failures for X” error on trying to connect to a server over ssh you can use the -o parameter to set the PubkeyAuthentication option to no. ssh -o PubkeyAuthentication=no root@host With that parameter your machine won’t try to send all your public keys any more on ssh connect. […]