RewriteCond %{HTTP_HOST} ^site.ru
RewriteRule ^spb/(.*)$ http://spb.site.ru/$1 [L,R=301]
Categories: Web Tags:

Скрипт для загрузки файлов из Google Drive из консоли.
Код скрипта:

#!/bin/bash
 
url=$1
filename=$2
 
[ -z "$url" ] && echo A URL or ID is required first argument && exit 1
 
fileid=""
declare -a patterns=("s/.*\/file\/d\/\(.*\)\/.*//p" "s/.*id\=\(.*\)//p" "s/\(.*\)//p")
for i in "${patterns[@]}"
do
   fileid=$(echo $url | sed -n $i)
   [ ! -z "$fileid" ] && break
done
 
[ -z "$fileid" ] && echo Could not find Google ID && exit 1
 
echo File ID: $fileid 
 
tmp_file="$filename.$$.file"
tmp_cookies="$filename.$$.cookies"
tmp_headers="$filename.$$.headers"
 
url='https://docs.google.com/uc?export=download&id='$fileid
echo Downloading: "$url > $tmp_file"
wget --save-cookies "$tmp_cookies" -q -S -O - $url 2> "$tmp_headers" 1> "$tmp_file"
 
if [[ ! $(find "$tmp_file" -type f -size +10000c 2>/dev/null) ]]; then
   confirm=$(cat "$tmp_file" | sed -rn 's/.*confirm=([0-9A-Za-z_]+).*//p')
fi
 
if [ ! -z "$confirm" ]; then
   url='https://docs.google.com/uc?export=download&id='$fileid'&confirm='$confirm
   echo Downloading: "$url > $tmp_file"
   wget --load-cookies "$tmp_cookies" -q -S -O - $url 2> "$tmp_headers" 1> "$tmp_file"
fi
 
[ -z "$filename" ] && filename=$(cat "$tmp_headers" | sed -rn 's/.*filename=\"(.*)\".*//p')
[ -z "$filename" ] && filename="google_drive.file"
 
echo Moving: "$tmp_file > $filename"
 
mv "$tmp_file" "$filename"
 
rm -f "$tmp_cookies" "$tmp_headers"
 
echo Saved: "$filename"
echo DONE!
 
exit 0

Скачиваем скрипт и делаем его исполняемым:

sudo wget -O /usr/sbin/gdrivedl 'https://f.mjh.nz/gdrivedl'
sudo chmod +x /usr/sbin/gdrivedl

Варианты использования:

gdrivedl https://drive.google.com/open?id=1sNhrr2u6n48vb5xuOe8P9pTayojQoOc_
gdrivedl https://drive.google.com/file/d/1sNhrr2u6n48vb5xuOe8P9pTayojQoOc_/view?usp=sharing
gdrivedl 1sNhrr2u6n48vb5xuOe8P9pTayojQoOc_
gdrivedl https://drive.google.com/open?id=1sNhrr2u6n48vb5xuOe8P9pTayojQoOc_ /tmp/my_file.rar

Источник: https://www.matthuisman.nz/2019/01/download-google-drive-files-wget-curl.html

Зеркало на GitHub: https://github.com/matthuisman/files.matthuisman.nz/blob/master/gdrivedl

Зеркало у себя: gdrivedl

Categories: Unix Tags:
$("a[href$='.jpg'],a[href$='.jpeg'],a[href$='.png'],a[href$='.gif']").fancybox({
	helpers:{title:{type:'over'}},
	padding:'0',
	afterShow:function(){
		$('.fancybox-wrap').touchwipe({
			wipeLeft:function(){$.fancybox.next();},
			wipeRight:function(){$.fancybox.prev();},
			preventDefaultEvents:false,
		});
	}
});

https://www.netcu.de/jquery-touchwipe-iphone-ipad-library

Categories: Javascript Tags:
$('.block').each(function(){
	if($(this).find('.content').html()==''){
		$(this).hide();
	}
});
Categories: Javascript Tags:

Применить стили к :before (1200 — ширина рабочей области)

$(window).load(function(){
	var half=(parseInt($(window).width())-1200)/2;
	$('head').append('<style>.title:before{width:'+(half-15)+'px;left:-'+half+'px;}</style>');
});
Categories: CSS, Javascript Tags: ,

Less:

.block{
	position:relative;
	&:before{
		content:'';
		position:absolute;
		top:0;
		left:-20px;
		display:block;
		width:20px;
		height:100px;
		background:@color_white;
		-webkit-transform:skewX(15deg);
		-moz-transform:skewX(15deg);
		-ms-transform:skewX(15deg);
		-o-transform:skewX(15deg);
		transform:skewX(15deg);
	}
}
Categories: CSS Tags: ,

Javascript:

$('#owl_1').owlCarousel({
	loop:true,
	margin:0,
	items:1,
	nav:false,
	dots:false,
	autoplay:true,
	autoplayTimeout:500,
	animateOut:'fadeOut',
	animateIn:'fadeIn',
});

Less:

#owl_1{
	.animated{
		-webkit-animation-duration:0ms;
		animation-duration:0ms;
		-webkit-animation-fill-mode:both;
		animation-fill-mode:both;
	}
	.fadeOut{
		-webkit-animation-name:fadeOut;
		animation-name:fadeOut;
	}
	@-webkit-keyframes fadeOut{
		0%{
			opacity:0;
		}
		100%{
			opacity:0;
		}
	}
	@keyframes fadeOut{
		0%{
			opacity:0;
		}
		100%{
			opacity:0;
		}
	}
}
Categories: CSS, Javascript Tags: