(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
| NODE="a hostname" | |
| IFS=$'\n' | |
| for line in $(curl -s 'localhost:9200/_cat/shards' | fgrep UNASSIGNED); do | |
| INDEX=$(echo $line | (awk '{print $1}')) | |
| SHARD=$(echo $line | (awk '{print $2}')) | |
| curl -XPOST 'localhost:9200/_cluster/reroute?pretty' -d '{ | |
| "commands": [ | |
| { | |
| "allocate": { |
(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
| # encoding: UTF-8 | |
| require 'optparse' | |
| require 'net/http' | |
| require 'json' | |
| def parse_options(argv) | |
| opts = {} | |
| @parser = OptionParser.new do |o| |
A Dashing widget for displaying the number of current visitors (in real time) to your website, as reported by Google Analytics.
This widget is a fork of https://gist.github.com/mtowers/5986576
| # /etc/ntp.conf, configuration for ntpd; see ntp.conf(5) for help | |
| driftfile /var/lib/ntp/ntp.drift | |
| # Enable this if you want statistics to be logged. | |
| #statsdir /var/log/ntpstats/ | |
| statistics loopstats peerstats clockstats | |
| filegen loopstats file loopstats type day enable |
##Preview
Simple Dashing widget (and associated job) to display GitHub Status. Uses GitHubs Status API
One of the best ways to reduce complexity (read: stress) in web development is to minimize the differences between your development and production environments. After being frustrated by attempts to unify the approach to SSL on my local machine and in production, I searched for a workflow that would make the protocol invisible to me between all environments.
Most workflows make the following compromises:
Use HTTPS in production but HTTP locally. This is annoying because it makes the environments inconsistent, and the protocol choices leak up into the stack. For example, your web application needs to understand the underlying protocol when using the secure flag for cookies. If you don't get this right, your HTTP development server won't be able to read the cookies it writes, or worse, your HTTPS production server could pass sensitive cookies over an insecure connection.
Use production SSL certificates locally. This is annoying
| #!/bin/bash | |
| # Dashing service | |
| # Add this file to /etc/init.d/ | |
| # $ sudo cp dashboard /etc/init.d/ | |
| # Update variables DASHING_DIR, GEM_HOME, & PATH to suit your installation | |
| # $ sudo nano /etc/init.d/dashboard | |
| # Make executable | |
| # $ sudo chmod 755 /etc/init.d/dashboard | |
| # Update rc.d | |
| # $ sudo update-rc.d dashboard defaults |
| # unicorn_rails -c /srv/myapp/current/config/unicorn.rb -E production -D | |
| rails_env = ENV['RAILS_ENV'] || 'production' | |
| working_directory (rails_env == 'production' ? "/srv/myapp/current" : `pwd`.gsub("\n", "")) | |
| worker_processes (rails_env == 'production' ? 10 : 4) | |
| preload_app true | |
| timeout 30 | |
| if rails_env == 'production' |