Python 提供了两个基本的 socket 模块:
Socket它提供了标准的BSD Socket API。SocketServer它提供了服务器重心,可以简化网络服务器的开发。
下面讲解下 Socket模块功能。
| #!/bin/bash | |
| while sleep 0.5; do vim --startuptime "$@" >(./startup-info) +qall; done | |
| # usage: ./collect-times | |
| # Running this will collect startup times in `times' directory. | |
| # It will run it multiple times so that the averages start converging. | |
| # Whenever you remove a plugin, it gets stored as a different version, | |
| # which will be shown at 'watch ./watcher'. |
| import random, time | |
| RUNS_PER_DECK = 1000000 #million | |
| def generateDeck(numDoubles): | |
| """ Generate a random array of 30 numbers representing unique cards """ | |
| numUnique = 30 - (numDoubles*2) - 1 | |
| deck = [0] |
Chromium OS is cool. Chromium OS with crouton is cooler. Chromium OS with Docker is even cooler. This is specifically a guide for the Chromebook Pixel 2 (2015), but I can't think of any reason it wouldn't work with other devices.
| <?xml version="1.0" encoding="UTF-8"?> | |
| <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
| <plist version="1.0"> | |
| <dict> | |
| <key>ANSIBlackColor</key> | |
| <data> | |
| YnBsaXN0MDDUAQIDBAUGKSpYJHZlcnNpb25YJG9iamVjdHNZJGFyY2hpdmVyVCR0b3AS | |
| AAGGoKcHCBMXGyImVSRudWxs1QkKCwwNDg8QERJcTlNDb21wb25lbnRzVU5TUkdCXE5T | |
| Q29sb3JTcGFjZV8QEk5TQ3VzdG9tQ29sb3JTcGFjZVYkY2xhc3NPECgwLjAyNzQ1MTAw | |
| NjcgMC4yMTE3NjQ3MjMxIDAuMjU4ODIzNDg0MiAxTxAoMC4wMzkzODA3NDc4MiAwLjE2 |
| ; This is a complete solution to map the CapsLock key to Control and Escape without losing the ability to toggle CapsLock | |
| ; We use two tools here - any remapping software to map CapsLock to LControl and AutoHotkey to execute the following script | |
| ; This has been tested with MapKeyboard (by Inchwest) | |
| ; This will allow you to | |
| ; * Use CapsLock as Escape if it's the only key that is pressed and released within 300ms (this can be changed below) | |
| ; * Use CapsLock as LControl when used in conjunction with some other key or if it's held longer than 300ms | |
| ; * Toggle CapsLock by pressing LControl/CapsLock + RControl | |
| ~*LControl:: |
| #http://unix.stackexchange.com/questions/34248/how-can-i-find-broken-symlinks | |
| find . -type l ! -exec test -e {} \; -print |
| // http://stackoverflow.com/questions/10656743/how-to-offset-the-center-point-in-google-maps-api-v3 | |
| function offsetCenter(map, latlng, offsetx, offsety) { | |
| // latlng is the apparent centre-point | |
| // offsetx is the distance you want that point to move to the right, in pixels | |
| // offsety is the distance you want that point to move upwards, in pixels | |
| // offset can be negative | |
| // offsetx and offsety are both optional | |
| var scale = Math.pow(2, map.getZoom()); |
| " ---------------------------------------------------------------------------- | |
| " vimawesome.com | |
| " ---------------------------------------------------------------------------- | |
| function! VimAwesomeComplete() abort | |
| let prefix = matchstr(strpart(getline('.'), 0, col('.') - 1), '[.a-zA-Z0-9_/-]*$') | |
| echohl WarningMsg | |
| echo 'Downloading plugin list from VimAwesome' | |
| echohl None | |
| ruby << EOF | |
| require 'json' |
See https://github.com/romainl/vim-rnb for an up-to-date version.