Python 随机打乱list

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
import random
keywords = ['ajenti', 'django-suit', 'django-xadmin', 'flask-admin', 'flower', 'grappelli', 'wooey', 'algorithms',
'pypattyrn', 'python-patterns', 'sortedcontainers', 'django-simple-captcha',
'django-simple-spam-blocker', 'django-compressor', 'django-pipeline', 'django-storages', 'fanstatic',
'fileconveyor', 'flask-assets', 'jinja-assets-compressor', 'webassets', 'audiolazy', 'audioread',
'beets', 'dejavu', 'django-elastic-transcoder', 'eyed3', 'id3reader', 'm3u8', 'mingus', 'mutagen',
'pyaudioanalysis', 'pydub', 'pyechonest', 'talkbox', 'timeside', 'tinytag', 'authomatic',
'django-allauth', 'django-oauth-toolkit', 'flask-oauthlib', 'oauthlib', 'python-oauth2',
'python-social-auth', 'rauth', 'sanction', 'jose', 'pyjwt', 'python-jws', 'python-jwt', 'bitbake',
'buildout', 'platformio', 'pybuilder', 'scons', 'django-cms', 'djedi-cms', 'feincms', 'kotti',
'mezzanine', 'opps', 'plone', 'quokka', 'wagtail', 'widgy', 'beaker', 'diskcache',
'django-cache-machine', 'django-cacheops', 'django-viewlet', 'dogpile.cache', 'hermescache',
'johnny-cache', 'pylibmc', 'errbot', 'coala', 'code2flow', 'pycallgraph', 'flake8', 'pylama', 'pylint',
'mypy', 'asciimatics', 'cement', 'click', 'cliff', 'clint', 'colorama', 'docopt', 'gooey',
'python-fire', 'python-prompt-toolkit', 'aws-cli', 'bashplotlib', 'caniusepython3', 'cookiecutter',
'doitlive', 'howdoi', 'httpie', 'mycli', 'pathpicker', 'percol', 'pgcli', 'saws', 'thefuck', 'try',
'python-future', 'python-modernize', 'six', 'opencv', 'pyocr', 'pytesseract', 'simplecv', 'eventlet',
'gevent', 'multiprocessing', 'threading', 'tomorrow', 'uvloop', 'config', 'configobj', 'configparser',
'profig', 'python-decouple', 'cryptography', 'hashids', 'paramiko', 'passlib', 'pynacl', 'blaze',
'open mining', 'orange', 'pandas', 'cerberus', 'colander', 'jsonschema', 'schema', 'schematics',
'valideer', 'voluptuous', 'altair', 'bokeh', 'ggplot', 'matplotlib', 'pygal', 'pygraphviz', 'pyqtgraph',
'seaborn', 'vispy', 'pickledb', 'pipelinedb', 'tinydb', 'zodb', 'mysql-python', 'mysqlclient', 'oursql',
'pymysql', 'psycopg2', 'queries', 'txpostgres', 'apsw', 'dataset', 'pymssql', 'cassandra-python-driver',
'happybase', 'plyvel', 'py2neo', 'pycassa', 'pymongo', 'redis-py', 'telephus', 'txredis', 'arrow',
'chronyk', 'dateutil', 'delorean', 'moment', 'pendulum', 'pytime', 'pytz', 'when.py', 'ipdb', 'pdb++',
'pudb', 'remote-pdb', 'wdb', 'line_profiler', 'memory_profiler', 'profiling', 'vprof',
'django-debug-toolbar', 'django-devserver', 'flask-debugtoolbar', 'hunter', 'lptrace', 'manhole',
'pyelftools', 'pyringe', 'caffe', 'keras', 'mxnet', 'neupy', 'pytorch', 'tensorflow', 'theano',
'ansible', 'cloud-init', 'cuisine', 'docker compose', 'fabric', 'fabtools', 'honcho', 'openstack',
'pexpect', 'psutil', 'saltstack', 'supervisor', 'dh-virtualenv', 'nuitka', 'py2app', 'py2exe',
'pyinstaller', 'pynsist', 'sphinx', 'awesome-sphinxdoc', 'mkdocs', 'pdoc', 'pycco', 's3cmd', 's4cmd',
'you-get', 'youtube-dl', 'alipay', 'cartridge', 'django-oscar', 'django-shop', 'merchant', 'money',
'python-currencies', 'forex-python', 'shoop', 'elpy', 'anaconda', 'sublimejedi', 'jedi-vim',
'python-mode', 'youcompleteme', 'ptvs', 'python', 'magic python', 'liclipse', 'pycharm', 'spyder',
'envelopes', 'flanker', 'imbox', 'inbox.py', 'lamson', 'marrow mailer', 'modoboa', 'nylas sync engine',
'yagmail', 'pipenv', 'p', 'pyenv', 'venv', 'virtualenv', 'virtualenvwrapper', 'imghdr', 'mimetypes',
'path.py', 'pathlib', 'python-magic', 'unipath', 'watchdog', 'cffi', 'ctypes', 'pycuda', 'swig',
'deform', 'django-bootstrap3', 'django-crispy-forms', 'django-remote-forms', 'wtforms', 'cytoolz',
'fn.py', 'funcy', 'toolz', 'curses', 'enaml', 'flexx', 'kivy', 'pyglet', 'pygobject', 'pyqt', 'pyside',
'pywebview', 'tkinter', 'toga', 'urwid', 'wxpython', 'cocos2d', 'panda3d', 'pygame', 'pyogre',
'pyopengl', 'pysdl2', 'renpy', 'django-countries', 'geodjango', 'geoip', 'geojson', 'geopy', 'pygeoip',
'beautifulsoup', 'bleach', 'cssutils', 'html5lib', 'lxml', 'markupsafe', 'pyquery', 'untangle',
'weasyprint', 'xmldataset', 'xmltodict', 'grequests', 'httplib2', 'requests', 'treq', 'urllib3', 'ino',
'keyboard', 'mouse', 'pingo', 'pyro', 'pyuserinput', 'scapy', 'wifi', 'hmap', 'imgseek', 'nude.py',
'pagan', 'pillow', 'pybarcode', 'pygram', 'python-qrcode', 'quads', 'scikit-image', 'thumbor', 'wand',
'clpython', 'cpython', 'cython', 'grumpy', 'ironpython', 'jython', 'micropython', 'numba', 'peachpy',
'pyjion', 'pypy', 'pysec', 'pyston', 'stackless python', 'bpython', 'jupyter notebook (ipython)',
'ptpython', 'babel', 'pyicu', 'apscheduler', 'django-schedule', 'doit', 'gunnery', 'joblib', 'plan',
'schedule', 'spiff', 'taskflow', 'eliot', 'logbook', 'logging', 'sentry', 'metrics', 'nupic',
'scikit-learn', 'spark ml', 'vowpal_porpoise', 'xgboost', 'pyspark', 'luigi', 'mrjob', 'streamparse',
'dask', 'python(x,y)', 'pythonlibs', 'pythonnet', 'pywin32', 'winpython', 'attrs', 'blinker',
'itsdangerous', 'pluginbase', 'pychievements', 'tryton', 'gensim', 'jieba', 'langid.py', 'nltk',
'pattern', 'polyglot', 'snownlp', 'spacy', 'textblob', 'mininet', 'pox', 'pyretic', 'sdx platform',
'asyncio', 'diesel', 'pulsar', 'pyzmq', 'twisted', 'txzmq', 'napalm', 'django-activity-stream',
'stream-framework', 'django models', 'sqlalchemy', 'awesome-sqlalchemy', 'orator', 'peewee', 'ponyorm',
'pydal', 'python-sql', 'django-mongodb-engine', 'flywheel', 'hot-redis', 'mongoengine', 'pynamodb',
'redisco', 'butterdb', 'dataset', 'pip', 'python package index', 'conda', 'curdling', 'pip-tools',
'wheel', 'warehouse', 'warehouse', 'bandersnatch', 'devpi', 'localshop', 'carteblanche',
'django-guardian', 'django-rules', 'delegator.py', 'sarge', 'sh', 'celery', 'huey', 'mrq', 'rq',
'simpleq', 'annoy', 'fastfm', 'implicit', 'libffm', 'lightfm', 'surprise', 'tensorrec',
'django-rest-framework', 'django-tastypie', 'eve', 'flask-api-utils', 'flask-api', 'flask-restful',
'flask-restless', 'cornice', 'falcon', 'hug', 'restless', 'ripozo', 'sandman', 'apistar',
'simplejsonrpcserver', 'simplexmlrpcserver', 'zerorpc', 'astropy', 'bcbio-nextgen', 'bccb', 'biopython',
'cclib', 'networkx', 'nipy', 'numpy', 'open babel', 'obspy', 'pydy', 'pymc', 'rdkit', 'scipy',
'statsmodels', 'sympy', 'zipline', 'simpy', 'django-haystack', 'elasticsearch-dsl-py',
'elasticsearch-py', 'esengine', 'pysolr', 'solrpy', 'whoosh', 'marshmallow', 'apex', 'python-lambda',
'zappa', 'tablib', 'marmir', 'openpyxl', 'pyexcel', 'python-docx', 'relatorio', 'unoconv', 'xlsxwriter',
'xlwings', 'xlwt', 'pdfminer', 'pypdf2', 'reportlab', 'mistune', 'python-markdown', 'pyyaml', 'csvkit',
'unp', 'cactus', 'hyde', 'lektor', 'nikola', 'pelican', 'tinkerer', 'django-taggit', 'genshi', 'jinja2',
'mako', 'hypothesis', 'mamba', 'nose', 'nose2', 'pytest', 'robot framework', 'unittest', 'green', 'tox',
'locust', 'pyautogui', 'selenium', 'sixpack', 'splinter', 'doublex', 'freezegun', 'httmock',
'httpretty', 'mock', 'responses', 'vcr.py', 'factory_boy', 'mixer', 'model_mommy', 'coverage',
'mimesis', 'fake2db', 'faker', 'radar', 'fuckit.py', 'chardet', 'difflib', 'ftfy', 'fuzzywuzzy',
'levenshtein', 'pangu.py', 'pyfiglet', 'pypinyin', 'shortuuid', 'unidecode', 'uniout', 'xpinyin',
'awesome-slugify', 'python-slugify', 'unicode-slugify', 'phonenumbers', 'ply', 'pygments', 'pyparsing',
'python-nameparser', 'python-user-agents', 'sqlparse', 'apache-libcloud', 'boto3', 'django-wordpress',
'facebook-sdk', 'facepy', 'gmail', 'google-api-python-client', 'gspread', 'twython', 'furl', 'purl',
'pyshorteners', 'short_url', 'webargs', 'moviepy', 'scikit-video', 'bjoern', 'fapws3', 'gunicorn',
'meinheld', 'netius', 'paste', 'rocket', 'uwsgi', 'waitress', 'werkzeug', 'haul', 'html2text', 'lassie',
'micawber', 'newspaper', 'opengraph', 'python-goose', 'python-readability', 'sanitize', 'sumy',
'textract', 'cola', 'demiurge', 'feedparser', 'grab', 'mechanicalsoup', 'portia', 'pyspider',
'robobrowser', 'scrapy', 'bottle', 'cherrypy', 'django', 'awesome-django', 'flask', 'awesome-flask',
'pyramid', 'awesome-pyramid', 'sanic', 'tornado', 'turbogears', 'web2py', 'github web2py',
'autobahnpython', 'crossbar', 'django-channels', 'django-socketio', 'websocket-for-python', 'circleci',
'travis ci', 'vexor ci', 'wercker', 'codacy', 'codecov', 'landscape', 'quantifiedcode', 'sqlite3',
'bsddb3', 'pil', 'urlparse']
random.shuffle(keywords)

主要就是使用shuffle函数了。

ps:写这么low的blog,仅是测试下新的host主机提供商:Coding.net

https://coding.net

pps: 代码里面的keywords,是统计的比较流行python库。可以作为常用爬虫的索引词来使用。

7Zip for Windows图标美化版下载(简体中文)

7Zip自带的图标丑的天崩地裂。这几天正好研究7Zip,顺手替换掉一套图标,美化美化。

7Zip的7zs.sfx自解压安装工具包说实话不是很好用。好在其本身源码里面带了NSIS的打包脚本。略作修改,生成Win64和Win32两套安装文件。

此贴已经过时,请访问 7Zip-for-Windows图标美化版(2021稳定版) 获取最新版本。

此贴已经过时,请访问 7Zip-for-Windows图标美化版(2021稳定版-v21.04) 获取最新版本。

版本选择的是最近的稳定版,16.04—–2016年10月官方发布的

下载路径:

继续阅读···

Windows的EXE文件,何时自动添加盾牌(UAC)小图标

开启了UAC后,很多exe程序就给自动标识了UAC小盾牌图标。

到底Windows系统是如何判定呢?

参见:Windows Vista Application Development Requirements for User Account Control (UAC)

老应用程序,大致这么判断:

  • Filename includes keywords such as “install,” “setup,” and “update.”
  • Keywords in the following Versioning Resource fields: Vendor, Company Name, Product Name, File Description, Original Filename, Internal Name, and Export Name.
  • Keywords in the side-by-side application manifest embedded in the executable.
  • Keywords in specific **StringTable** entries linked in the executable.
  • Key attributes in the resource file data linked in the executable.
  • Targeted sequences of bytes within the executable.

说白了就是,对老程序,Windows既没有“沙盒”运行来判定程序所需权限,也不会静态反汇编分析程序权限,只是根据一些特征字判断……

新程序,大概需要:

When developing new installation programs, much like developing programs for Windows Vista, be sure to embed an application manifest with an appropriate requestedExecutionLevel element (see Step 6: Create and Embed an Application Manifest in downloadable Help file). When the requestedExecutionLevel is present in the embedded application manifest, it overrides Installer Detection.

最近很火的益智玩具--迷宫大追捕的谜题穷举(02)

解决类似Scott骨牌谜题,有个比较快速的方法:

Dancing Links aka 跳舞链

这个算法产生自1979年(没错,那会时间戳还很短呢)。主要目标就是搜索特定0,1矩阵中的一些行,这些行“叠加”起来,可以保证每一列有且只有一个1。

基于双向链表的一个特点:

1
2
3
4
5
6
7
删除一个节点:
x.left.right ← x.right;
x.right.left ← x.left;
恢复刚被删除的节点:
x.left.right ← x;
x.right.left ← x;

对一个由双向链表组成的矩阵,利用上面的特点可以快速删除、恢复一个节点乃至一整行or一整列。

这样,利用递归,就可以在搜索中轻易舍弃某些行、列,然后在搜索结束后,迅速的恢复现场。

具体的原理,参考这个

Wiki

中文翻译(PS:很好的翻译,虽然排版方式老旧点,单绝对用心)

OK,在了解DLX后,对我们的谜题–迷宫大追捕,如何搞定呢?

继续阅读···

最近很火的益智玩具--迷宫大追捕的谜题穷举(01)

最近这个玩具很火,娃也很喜欢。质量也不错,塑料一看就比较高级,手感好,无味道,还挺皮实。

购买链接:点这里

先领红包:点这里

在聪明伶俐的程序员带领下(某些人还不如娃玩的好),娃很快把60个基本谜题和60个高级谜题做完了(偷看答案次数也不少)。

200多块钱的玩具,难道1个月就作废?不能够……

继续阅读···

hexo插入Youtube视频

hexo写文章的时候,插入视频很简单,在YouTube的“共享”中,选择嵌入即可获取类似这样的链接:

1
<iframe width="100%" height="100%" src="https://www.youtube.com/embed/P2r9U4wkjcc" frameborder="0" allowfullscreen></iframe>