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
CREATE DATABASE <BDname> CHARACTER SET utf8 COLLATE utf8_general_ci; | |
GRANT ALL PRIVILEGES ON <BDname>.* to <user_name>@localhost identified by '<user_password>'; | |
for crone: | |
mysqldump -u <user_name> '-p<user_password>' <oldBDname> | gzip > ~/$(date +/var/sqlDump/<oldBDname>.sql.%Y%m%d.gz) | |
gunzip < `date +/var/sqlDump/<oldBDname>.sql.%Y%m%d.gz` | mysql -u <user_name> '-p<user_password>' <BDname> | |
CREATE USER <un> WITH PASSWORD '<up>'; | |
CREATE DATABASE sales ENCODING 'utf8' OWNER <un>; |
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
data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw== |
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
Obj.objects.extra(select={'num': "(select @f2 := @f2 +1 from (select @f2 := 0) as t )"}) |
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
import magic | |
with magic.Magic(flags=magic.MAGIC_MIME_TYPE) as m: | |
content_type = m.id_filename(self.file._get_path()) |
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
y = MAX*(1-e^-x) |
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($) | |
{ | |
var jqPluginName = 'scheme', | |
Init = function(element, options) | |
{ | |
var config = $.extend(true, {}, $.fn[jqPluginName].defaults, options), | |
self = this, | |
cats_counter = [], | |
create_cav = function() | |
{ |
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
server { | |
listen 80; | |
server_name www.<domain>; | |
return 301 $scheme://<domain>$request_uri; | |
} | |
server { | |
listen 80; | |
server_name localhost <ip> <domain>; | |
location ~* ^.+\.(xml|html|txt|png|jpg|gif|ico)$ { |
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
if request.get_host().split(".")[0] == 'www': | |
return HttpResponseRedirect((request.is_secure() and "https" or "http")+ "://"+".".join(request.build_absolute_uri().split(".")[1:])) | |
server { | |
listen 80; | |
server_name www.dom.ru; | |
return 301 $scheme://dom.ru$request_uri; | |
} | |
server { |
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 scaleKepper = function(e){ | |
var obj = $(/*selector*/)[0], | |
windowWidth = $(window).innerWidth(), | |
windowHeight = $(window).innerHeight(), | |
aspect = obj.clientWidth/obj.clientHeight, | |
result = windowWidth/aspect > windowHeight ? | |
'width:'+windowWidth+"px;height:"+windowWidth/aspect+"px;margin-top:-"+((obj.clientHeight-windowHeight)/2)+"px;" : | |
'width:'+windowHeight*aspect+'px;height:'+windowHeight+'px;margin-left:-'+((obj.clientWidth-windowWidth)/2)+'px'; | |
obj.setAttribute('style', result); | |
}; |
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
#server | |
def socketer(s, ...): | |
s.bind(...) | |
s.listen(10) | |
while 1: | |
conn, addr = s.accept() | |
out = (....).encode('zlib') | |
out = str(len(out))+"data_length"+out | |
conn.sendall(out) |