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 | |
function getValute() { | |
$res = file_get_contents("http://www.cbr.ru/scripts/XML_daily.asp"); | |
$values = new SimpleXMLElement($res); | |
$data = array(); | |
$data["dollar"] = $values->Valute[9]->Value; | |
$data["euro"] = $values->Valute[10]->Value; | |
return $data; |
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
from vk_lplib import VK | |
# Used https://github.com/stroum/vk_lplib/ | |
CONVERSATION_ID = 0 | |
USER_ID = 0 | |
TOKEN = "" | |
vk = VK(USER_ID, TOKEN) | |
start_from = 0 |
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
def get_today_start(): | |
t = datetime.today() | |
return int(datetime(t.year, t.month, t.day, 0).timestamp()) |
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
CONFIG['password'] = 'PASS' | |
def login_required(func): | |
def wrapper(*args, **kwargs): | |
if not session or session['hash'] != generate_hash(CONFIG['password']): | |
return redirect('/login') | |
else: | |
return func(*args, **kwargs) | |
wrapper.__name__ = func.__name__ |
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
modprobe zram num_devices=4 | |
SIZE=1536 | |
echo $(($SIZE*1024*1024)) > /sys/block/zram0/disksize | |
echo $(($SIZE*1024*1024)) > /sys/block/zram1/disksize | |
echo $(($SIZE*1024*1024)) > /sys/block/zram2/disksize | |
echo $(($SIZE*1024*1024)) > /sys/block/zram3/disksize | |
mkswap /dev/zram0 | |
mkswap /dev/zram1 |
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
def plural_days(n): | |
days = ['день', 'дня', 'дней'] | |
if n % 10 == 1 and n % 100 != 11: | |
p = 0 | |
elif 2 <= n % 10 <= 4 and (n % 100 < 10 or n % 100 >= 20): | |
p = 1 | |
else: | |
p = 2 |