This file contains 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 lxml import etree | |
root = etree.fromstring(xml_str) | |
def xml2json(self, root): | |
children = root.findall('ResponseData/ResponseDataObject')[0] | |
def recusiv(children): | |
out = {} | |
for child in list(children): | |
if len(list(child)): |
This file contains 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
colorscheme desert | |
set smartindent | |
set tabstop=4 | |
set ruler | |
set nu | |
syntax on | |
set backupcopy=yes | |
set shiftwidth=4 | |
set laststatus=2 | |
set expandtab |
This file contains 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 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 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
<div id="d3"> | |
sdf | |
<p> | |
1231 | |
<a> | |
asdfasdf | |
<div id="d1"> | |
1 | |
</div> | |
</a> |
This file contains 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
SELECT DATE_FORMAT(d, "%Y%m") as month_year, GROUP_CONCAT(id SEPARATOR ',') as ids FROM events_event GROUP BY month_year LIMIT 100 |
This file contains 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
[client] | |
default-character-set=utf8 | |
[mysqld] | |
default-character-set=utf8 | |
collation_server=utf8_unicode_ci | |
datadir=/var/lib/mysql | |
socket=/var/lib/mysql/mysql.sock | |
user=mysql | |
# Disabling symbolic-links is recommended to prevent assorted security risks |
This file contains 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 onLoader = function onloader(call, selector) | |
{ | |
var loaderTimer = setInterval(function() | |
{ | |
if ( | |
!$(selector).filter(function() | |
{ | |
return !this.complete | |
}).length | |
) |
This file contains 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 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()) |
NewerOlder