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
| function declOfNum(number, titles) { | |
| cases = [2, 0, 1, 1, 1, 2]; | |
| return titles[ (number%100>4 && number%100<20)? 2 : cases[(number%10<5)?number%10:5] ]; | |
| } | |
| use: | |
| declOfNum(count, ['найдена', 'найдено', 'найдены']); |
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
| var down = false;var olddown = window.onkeydown, oldup = window.onkeyup | |
| var key_w = {keyCode: 87}; | |
| setInterval(function() { if(down) | |
| {olddown(key_w) | |
| oldup(key_w)}}, 50) | |
| onmousedown = function(e) { switch (e.which) { | |
| case 1: down = true; | |
| } | |
| } | |
| onmouseup = function(e) { switch (e.which) { |
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
| var jq = document.createElement('script'); | |
| jq.src = "https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"; | |
| document.getElementsByTagName('head')[0].appendChild(jq); | |
| jQuery.noConflict(); |
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
| #!/usr/bin/env python | |
| import io | |
| import codecs | |
| import sys | |
| with io.open('error.log', 'r', encoding='ascii', errors='ignore') as file: | |
| for line in file: | |
| print line.encode('utf-8').decode('string_escape') |
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 | |
| /** | |
| * Возвращает сумму прописью | |
| * @author runcore | |
| * @uses morph(...) | |
| */ | |
| function num2str($num) { | |
| $nul='ноль'; | |
| $ten=array( |
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
| INTO OUTFILE '/tmp/orders.csv' | |
| FIELDS TERMINATED BY ',' | |
| ENCLOSED BY '"' | |
| LINES TERMINATED BY '\n'; |
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
| dpkg --list | grep linux-image | awk '{ print $2 }' | sort -V | sed -n '/'`uname -r`'/q;p' | xargs sudo apt-get -y purge | |
| dpkg --list | grep 'linux-image' | awk '{ print $2 }' | sort -V | sed -n '/'"$(uname -r | sed "s/\([0-9.-]*\)-\([^0-9]\+\)/\1/")"'/q;p' | xargs sudo apt-get -y purge | |
| dpkg --list | grep 'linux-headers' | awk '{ print $2 }' | sort -V | sed -n '/'"$(uname -r | sed "s/\([0-9.-]*\)-\([^0-9]\+\)/\1/")"'/q;p' | xargs sudo apt-get -y purge |
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 | |
| grep "200 " access.log \ | |
| | cut -d '"' -f 4 \ | |
| | sort \ | |
| | uniq -c \ | |
| | sort -rn \ | |
| | grep -v "YOURDOMAIN.COM" \ | |
| | less |
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 | |
| SRC=/tmp/png-icons | |
| DST=/tmp/svg-icons | |
| for f in `ls $SRC` | |
| do | |
| FILENAME=`basename $f` | |
| FILECLEAR=`basename $f .png` |
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 | |
| /** | |
| * Before you run this example: | |
| * 1. copy config.php.dist to config.php: cp config.php.dist config.php | |
| * | |
| * @author Novikov Bogdan <[email protected]> | |
| */ | |
| error_reporting(E_ALL & ~E_NOTICE & ~E_WARNING); | |
| ini_set('display_errors', 1); | |
| ini_set('display_startup_errors', 1); |