Skip to content

Instantly share code, notes, and snippets.

@lazybios
lazybios / Media Queries for Standard Devices
Created October 29, 2014 09:28
Media Queries for Standard Devices
/* Smartphones (portrait and landscape) ----------- */
@media only screen
and (min-device-width : 320px)
and (max-device-width : 480px) {
/* Styles */
}
/* Smartphones (landscape) ----------- */
@media only screen
and (min-width : 321px) {
#!/usr/bin/python
# coding: utf-8
'''转换时间戳为实际时间 & 格式化时间'''
import time
import sys
if __name__ == "__main__":
if len(sys.argv) > 1:
#!/usr/bin/python
# -*- coding: utf-8 -*-
'''导入csv格式数据到mysql数据库'''
import csv
import MySQLdb as mysqldb
import time
mytime = time.strftime('%Y-%m-%d %H:%M:%S')
#!/usr/bin/python
# coding: utf-8
import csv
import json
import sys
if __name__ == "__main__":
# execel 导出后带有^M符号 换行符号 'rU' U通用换行符
with open(sys.argv[1],'rU') as fd:
var data = {"4":"d","3":"c","2":"b","1":"a"};
for(var key in data){
print "key:" + key;
print "value:" + data[key];
}
@lazybios
lazybios / sendmail.py
Last active August 29, 2015 14:13
'''send mail by smtplib module'''
import smtplib
from email.mime.text import MIMEText
'''send mail by smtplib module'''
# me == my email address
# you == recipient's email address
me = "[email protected]"
# -*- coding: utf-8 -*-
@lazybios
lazybios / format_value.py
Last active August 29, 2015 14:14
format value
# 保留小数点后n位
# 四舍五入法
val = 13.949999999999999
round(val,2)
#=> 13.95
print "%.2f" % a
#=> 13.95
# update os
sudo apt-get -y update
# install git & curl
sudo apt-get -y install git curl
# depdency
sudo apt-get --no-install-recommends -y install build-essential openssl libreadline6 libreadline6-dev curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev libgdbm-dev ncurses-dev automake libtool bison subversion pkg-config libffi-dev vim
# useful tools
/**
* Eric Meyer's Reset CSS v2.0 (http://meyerweb.com/eric/tools/css/reset/)
* http://cssreset.com
*/
html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,