This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # created_at is a DateTime field | |
| from datetime import datetime | |
| today = datetime.now() | |
| objs = MyModel.objects.filter( | |
| created_at__day=today.day, | |
| created_at__month=today.month, | |
| created_at__year=today.year | |
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # | |
| # author: @gin, 2013 | |
| # url: | |
| # | |
| # split cue into individual flac files | |
| # | |
| # dependencies: | |
| # sudo apt-get install flac bchunk ffmpeg | |
| # |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # dependencies | |
| sudo apt-get install flac bchunk ffmpeg | |
| # convert to a wave file | |
| ffmpeg -i INPUT.ape OUTPUT.wav | |
| # split the .wav into individual tracks | |
| bchunk -w OUTPUT.wav INPUT.cue BASE_FILENAME | |
| # convert to flac |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| apt-get install --install-recommends --install-suggests nvidia-kernel-dkms nvidia-glx nvidia-xconfig | |
| reboot |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Original list of dicts | |
| old = [{ | |
| 'product_name': 'A Name', | |
| 'product_id': '666' | |
| }] | |
| # New keys | |
| mapping = { | |
| 'product_name': 'name', | |
| 'product_id': 'id' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $('#element').bind('DOMSubtreeModified',function() { | |
| // do something | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| today = new Date(); | |
| today = '' + | |
| ('000' + today.getFullYear()).slice(-4) +'-'+ | |
| ('0' + today.getMonth()).slice(-2) +'-'+ | |
| ('0' + today.getDay()).slice(-2); | |
| /* today is: | |
| ####-##-## (YYYY-MMM-DD) | |
| sample: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| sudo dpkg --add-architecture i386; | |
| sudo apt-get update; | |
| sudo apt-get install libpulse0:i386; | |
| wget -O skype-install.deb http://www.skype.com/go/getskype-linux-deb; | |
| sudo dpkg -i skype-install.deb; | |
| sudo apt-get install -f; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| // $_product = $this->getProduct(); | |
| $stock = 0; | |
| $simpleProducts = Mage::getModel('catalog/product_type_configurable')->getUsedProducts(null, $_product); | |
| foreach ($simpleProducts as $simple) { | |
| $stockItem = Mage::getModel('cataloginventory/stock_item')->loadByProduct($simple); | |
| if ($stockItem->getIsInStock()) { | |
| $qty = intval($stockItem->getQty()); | |
| $stock += $qty; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| UPDATE | |
| `cataloginventory_stock_item` | |
| SET | |
| `cataloginventory_stock_item`.`is_in_stock` = '1' | |
| WHERE | |
| `cataloginventory_stock_item`.`product_id` IN | |
| ( | |
| SELECT | |
| a.entity_id | |
| FROM |