意外得奖(在 FIR.im)

Kiana Khansmith
Game of Thrones Daily

izzy's playlists!

pixel skylines
NASA

blake kathryn
todays bird

★
Misplaced Lens Cap
Cosimo Galluzzi
trying on a metaphor

tannertan36
Sweet Seals For You, Always

No title available

JVL
let's talk about Bridgerton tea, my ask is open
Show & Tell
PUT YOUR BEARD IN MY MOUTH
will byers stan first human second

No title available
seen from United States
seen from United States

seen from United States
seen from United States
seen from United States
seen from United States
seen from South Korea

seen from Malaysia

seen from Germany
seen from Greece
seen from Türkiye

seen from United States
seen from United States

seen from Saudi Arabia
seen from United States

seen from United States
seen from United States
seen from United States
seen from Switzerland

seen from United Kingdom
@trawor-blog
意外得奖(在 FIR.im)
that's why I love MacBook Pro 😄(在 FIR.im)
在 FIR.im
Moleskine X-small Pocket A5
作~
实现类似iTunes里的封面动态颜色效果
开源在GitHub 欢迎fork! https://github.com/Plumn/MostColorPicker
大概原理是:
把图片缩小 加快计算速度
得到每个点的RGBA
找出出现最多的那个颜色
与iTunes的颜色不尽相同. 因为iTunes里图片是放在最右边了 所以只取了最左边的一部分像素.
效果如下:
学习 vim 并且其会成为你最后一个使用的文本编辑器。没有比这个更好的文本编辑器了,非常地难学,但是却不可思议地好用。
路由器上的原生ShadowSocks客户端
ShadowSocks是支持多个平台的科学上网工具. 在路由器上以前跑Python版本的 需要外接USB,安装Python运行环境,很麻烦,很不利索.
我在GitHub上提了个需求,经过来回耐心的沟通,大神编译出了这个原生的客户端 非常值得推荐 只有几十K的文件
配合PAC配置文件, 全家所有设备自由了
用法: nohup ss-local -s 服务器IP -p 服务器端口 -l 本地端口 -k 密码 > /tmp/shadow.log &
注意最后的&符号
这样就跑起来了 日志可以看 /tmp/shadow.log PS: 作者说兼容OpenWrt, 我的固件是番茄自制的 也正常 CPU是BCM 53XX应该都可以
下载地址: 百度网盘
如果你使用了默认的ObjectId作为_id值,并且你还存在一个addtime字段保存添加时间,那么你已经在犯错了。因为MongoDB默认的ObjectId本身就保存了一些信息。其中就包括本条记录生成的时间。
`ObjectId.getTimestamp()`可以达到创建的时间戳. PyMongo中,这个方法是`generation_time`
乔布斯生前很少接受电视采访,这是其中很珍贵的一段遗失的访谈。如果你想要聆听史蒂夫乔布斯详细讲述自己1995年及之前的职业生涯,看看这部影片吧。片中还有乔布斯就驱使企业和自己前进的东西,提出了一些真知灼见。
针对Tumblr的代码高亮优化
最近搬家到了tumblr. 作为程序员博客, 代码高亮是不可缺的 分享一下. 效果就是现在我博客中的代码样式. 支持单行 和 段落
把下面这部分加到自定义HTML的<head>里
<script src="https://google-code-prettify.googlecode.com/svn/loader/run_prettify.js?skin=sunburst" type="text/javascript"></script> <script type="text/javascript"> function styleCode() { $('pre').each(function() { if (!$(this).hasClass('prettyprint')) { $(this).addClass('prettyprint'); } }); $('code').each(function() { if (!$(this).parent().is('pre')) { $(this).addClass('prettyprint'); } }); } $(function() {styleCode();}); </script>
这部分放到自定义CSS里 因为单行的code没有被考虑到
code.prettyprint { padding-left: 5px; padding-right: 5px; -khtml-border-radius: 4px; border-radius: 4px; }
友情赠送 这是StackOverflow里扒来的键盘样式CSS 例如: ctrl+c
kbd { padding: 0.1em 0.6em; border: 1px solid #ccc; font-size: 11px; font-family: Arial,Helvetica,sans-serif; background-color: #f7f7f7; color: #333; -moz-box-shadow: 0 1px 0px rgba(0, 0, 0, 0.2),0 0 0 2px #ffffff inset; -webkit-box-shadow: 0 1px 0px rgba(0, 0, 0, 0.2),0 0 0 2px #ffffff inset; box-shadow: 0 1px 0px rgba(0, 0, 0, 0.2),0 0 0 2px #ffffff inset; -moz-border-radius: 3px; -webkit-border-radius: 3px; border-radius: 3px; display: inline-block; margin: 0 0.1em; text-shadow: 0 1px 0 #fff; line-height: 1.4; white-space: nowrap; }
man -t cal | open -a Preview -f
“预览”不简单 | 益牙志
如果Xcode更新后编译的时候报错类似这样: error: PCH file built from a different branch ((clang-425.0.27)) than the compiler ((clang-425.0.28)) 试试清除缓存文件, 快捷键: + Shift+K
没有任何PS和修善处理 iPhone的效果相当不错
给Python初学者的一些技巧
英文原文:Max Burstein,编译:伯乐在线 –刘志军
以下是我近些年收集的一些Python实用技巧和工具,希望能对你有所帮助。
交换变量
x = 6 y = 5 x, y = y, x print x >>> 5 print y >>> 6
if 语句在行内
print "Hello" if True else "World" >>> Hello
连接 下面的最后一种方式在绑定两个不同类型的对象时显得很cool。
nfc = ["Packers", "49ers"] afc = ["Ravens", "Patriots"] print nfc + afc >>> ['Packers', '49ers', 'Ravens', 'Patriots'] print str(1) + " world" >>> 1 world print `1` + " world" >>> 1 world print 1, "world" >>> 1 world print nfc, 1 >>> ['Packers', '49ers'] 1
数字技巧
#除后向下取整 print 5.0//2 >>> 2 # 2的5次方 print 2**5 >> 32
数值比较
x = 2 if 3 > x > 1: print x >>> 2 if 1 < x > 0: print x >>> 2
同时迭代两个列表
nfc = ["Packers", "49ers"] afc = ["Ravens", "Patriots"] for teama, teamb in zip(nfc, afc): print teama + " vs. " + teamb >>> Packers vs. Ravens >>> 49ers vs. Patriots
带索引的列表迭代
teams = ["Packers", "49ers", "Ravens", "Patriots"] for index, team in enumerate(teams): print index, team >>> 0 Packers >>> 1 49ers >>> 2 Ravens >>> 3 Patriots
列表推导式 已知一个列表,我们可以刷选出偶数列表方法:
numbers = [1,2,3,4,5,6] even = [] for number in numbers: if number%2 == 0: even.append(number) #转变成如下: numbers = [1,2,3,4,5,6] even = [number for number in numbers if number%2 == 0]
字典推导
teams = ["Packers", "49ers", "Ravens", "Patriots"] print {key: value for value, key in enumerate(teams)} >>> {'49ers': 1, 'Ravens': 2, 'Patriots': 3, 'Packers': 0}
初始化列表的值
items = [0]*3 print items >>> [0,0,0]
列表转换为字符串
teams = ["Packers", "49ers", "Ravens", "Patriots"] print ", ".join(teams) >>> 'Packers, 49ers, Ravens, Patriots'
获取列表的子集
x = [1,2,3,4,5,6] #前3个 print x[:3] >>> [1,2,3] #中间4个 print x[1:5] >>> [2,3,4,5] #最后3个 print x[-3:] >>> [4,5,6] #奇数项 print x[::2] >>> [1,3,5] #偶数项 print x[1::2] >>> [2,4,6]
集合
from collections import Counter print Counter("hello") >>> Counter({'l': 2, 'h': 1, 'e': 1, 'o': 1})
迭代工具
from itertools import combinations teams = ["Packers", "49ers", "Ravens", "Patriots"] for game in combinations(teams, 2): print game >>> ('Packers', '49ers') >>> ('Packers', 'Ravens') >>> ('Packers', 'Patriots') >>> ('49ers', 'Ravens') >>> ('49ers', 'Patriots') >>> ('Ravens', 'Patriots')
False == True 在python中,True和False是全局变量,因此:
False = True if False: print "Hello" else: print "World" >>> Hello