Tested with Apache Spark 2.1.0, Python 2.7.13 and Java 1.8.0_112
For older versions of Spark and ipython, please, see also previous version of text.
Tested with Apache Spark 2.1.0, Python 2.7.13 and Java 1.8.0_112
For older versions of Spark and ipython, please, see also previous version of text.
| >>> import itertools | |
| >>> import string | |
| >>> from elasticsearch import Elasticsearch,helpers | |
| es = Elasticsearch() | |
| >>> # k is a generator expression that produces | |
| ... # a series of dictionaries containing test data. | |
| ... # The test data are just letter permutations | |
| ... # created with itertools.permutations. | |
| ... # | |
| ... # We then reference k as the iterator that's |
| # Using these pry gems -- copy to your Gemfile | |
| # group :development, :test do | |
| # gem 'awesome_print' # pretty print ruby objects | |
| # gem 'pry' # Console with powerful introspection capabilities | |
| # gem 'pry-byebug' # Integrates pry with byebug | |
| # gem 'pry-doc' # Provide MRI Core documentation | |
| # gem 'pry-rails' # Causes rails console to open pry. `DISABLE_PRY_RAILS=1 rails c` can still open with IRB | |
| # gem 'pry-rescue' # Start a pry session whenever something goes wrong. | |
| # gem 'pry-theme' # An easy way to customize Pry colors via theme files | |
| # end |
Command Line
pry -r ./config/app_init_file.rb - load your app into a pry session (look at the file loaded by config.ru)pry -r ./config/environment.rb - load your rails into a pry sessionDebugger
| David Heinemeier | |
| Gihub: | |
| • 14 repos related to Ruby | |
| • multiple comments in rails/rails | |
| RubyGem | |
| • 23 Gems | |
| • 227,964,383 downloads | |
| Vimeo | |
| • Uploaded RubyConf video | |
| 37Signals |
| #!/usr/bin/env python | |
| import sys | |
| import argparse | |
| import networkx as nx | |
| import community | |
| from networkx.readwrite import json_graph | |
| def graphmltojson(graphfile, outfile): |
| // Just before switching jobs: | |
| // Add one of these. | |
| // Preferably into the same commit where you do a large merge. | |
| // | |
| // This started as a tweet with a joke of "C++ pro-tip: #define private public", | |
| // and then it quickly escalated into more and more evil suggestions. | |
| // I've tried to capture interesting suggestions here. | |
| // | |
| // Contributors: @r2d2rigo, @joeldevahl, @msinilo, @_Humus_, | |
| // @YuriyODonnell, @rygorous, @cmuratori, @mike_acton, @grumpygiant, |
Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.
$ python -m SimpleHTTPServer 8000| #XLarge DBInstanceClassMemory = 15892177440 = 14.8GB | |
| #/32 = 496630545 = 473MB | |
| #/64 = 248315272 = 236MB | |
| #/128 = 124157636 = 118MB | |
| #/256 = 62078818 = 59MB | |
| #/512 = 31039409 = 29MB | |
| #/12582880 = 1263 #default same divisor as max_connections = 4041.6MB = 4237924762 | |
| #/25165760 = 623 # half of max_connections = 1993.6MB | |
| #/50331520 = 315 # quarter of max_connections = 1008MB = 1056964608 | |
| #*(3/4) #default innodb pool size = 11922309120 |
| ;; Open the file name being pointed in an other window or dired | |
| ;; reference: http://kouzuka.blogspot.com/2011/02/emacsurlfinder.html | |
| (defun my-directory-or-file-p (path) | |
| "return t if path is a directory, | |
| return nil if path is a file" | |
| (car (file-attributes path))) | |
| (defun my-open-emacs-at-point () | |
| "open the file with opening emacs" | |
| (interactive) |