Standard escape codes are prefixed with Escape:
- Ctrl-Key:
^[ - Octal:
\033 - Unicode:
\u001b - Hexadecimal:
\x1B - Decimal:
27
| package main | |
| import ( | |
| "context" | |
| "flag" | |
| "fmt" | |
| "log" | |
| "net/http" | |
| "os" | |
| "os/signal" |
| import asyncio | |
| import time | |
| def timeit(func): | |
| async def process(func, *args, **params): | |
| if asyncio.iscoroutinefunction(func): | |
| print('this function is a coroutine: {}'.format(func.__name__)) | |
| return await func(*args, **params) | |
| else: |
| # coding: utf-8 | |
| try: | |
| import cPickle as pickle | |
| except ImportError: | |
| import pickle | |
| try: | |
| import hashlib | |
| sha1 = hashlib.sha1 |
| -- Error Message: Row size too large (> 8126). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline. | |
| -- | |
| -- our table name that has this issue is XYZ | |
| -- | |
| SET GLOBAL innodb_file_format=Barracuda; | |
| SET GLOBAL innodb_file_per_table=ON; | |
| ALTER TABLE XYZ ROW_FORMAT=COMPRESSED; |
| '400x300' # resize, maintain aspect ratio | |
| '400x300!' # force resize, don't maintain aspect ratio | |
| '400x' # resize width, maintain aspect ratio | |
| 'x300' # resize height, maintain aspect ratio | |
| '400x300>' # resize only if the image is larger than this | |
| '400x300<' # resize only if the image is smaller than this | |
| '50x50%' # resize width and height to 50% | |
| '400x300^' # resize width, height to minimum 400,300, maintain aspect ratio | |
| '2000@' # resize so max area in pixels is 2000 | |
| '400x300#' # resize, crop if necessary to maintain aspect ratio (centre gravity) |
| /* ivan(a.t)mysqlab.net */ | |
| package main | |
| import ( | |
| "syscall" | |
| "os" | |
| "log" | |
| ) | |
| func daemon(nochdir, noclose int) int { |
| Latency Comparison Numbers (~2012) | |
| ---------------------------------- | |
| L1 cache reference 0.5 ns | |
| Branch mispredict 5 ns | |
| L2 cache reference 7 ns 14x L1 cache | |
| Mutex lock/unlock 25 ns | |
| Main memory reference 100 ns 20x L2 cache, 200x L1 cache | |
| Compress 1K bytes with Zippy 3,000 ns 3 us | |
| Send 1K bytes over 1 Gbps network 10,000 ns 10 us | |
| Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD |
This installs a patched ruby 1.9.3-p327 with various performance improvements and a backported COW-friendly GC, all courtesy of funny-falcon.
You will also need a C Compiler. If you're on Linux, you probably already have one or know how to install one. On OS X, you should install XCode, and brew install autoconf using homebrew.
| # db/migrate/20111218135715_globalize_models.rb | |
| class GlobalizeModels < ActiveRecord::Migration | |
| def up | |
| NewsItem.create_translation_table!( | |
| {:title => :string, :body => :text}, | |
| {:migrate_data => true} | |
| ) | |
| end |