- Smarter completion. A few examples:
- context sensitive -- if you have file "name1" and directory "name2", "cd nam<TAB>" completes to "name2/"
- "tar xf <TAB>" completes to tarballs only. "unrar x <TAB>" completes to RARs only. etc.
- rsync / scp completion: "rsync host:anything/<TAB>" shows you files on host under anything/
- also works with rsync:// URLs
- SSH host completion from ~/.ssh/config & ~/.ssh/known_hosts
- lots of other smart completions: Rake tasks, git commands & SHAs, dpkg packages, dash-options for most commands, etc etc.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
begin | |
require 'tweetstream' | |
require 'poseidon' | |
rescue 'LoadError' | |
raise "Requires tweetstream and poseidon libraries" | |
end | |
raise "Works only on 1.9" if RUBY_VERSION < "1.9" | |
raise "Requires Argument keyword to match from twitter firehose" if ARGV.length == 0 | |
Sample TCP server-client implementation using openssl in ruby
Use the wrapper shell script to create ssl certificates ./openssl.sh -newca
, enter the details and the required files will be generated to ./demoCA
dir from where you run the script. cacert.pem
will be your ssl-certificate and private/cakey.pem
will be your ssl-key
Start SSL Server using:
ruby ssl_server.rb 9099 demoCA/cacert.pem demoCA/private/cakey.pem
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# --- | |
# => Nagios plugin to monitor hadoop dfs | |
# This script serves as base line for nagios plugins for hadoop | |
# Author: Ashrith | |
# --- | |
PROGNAME=`basename $0` | |
VERSION="Version 1.0" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
#Author: Ashrith | |
#Arrays to store hosts and their regionsOnLine respectively | |
declare -a HOSTS_ARRAY | |
declare -a REGIONS_ARRAY | |
message="" | |
EXIT_STATUS=0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'openssl' | |
# | |
# Program to demonstrate Certificate Signing Request using openssl | |
# | |
# Create a new key | |
def gen_key(name) | |
key = OpenSSL::PKey::RSA.new 1024 | |
file = File.new name, "w" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# Licensed to the Apache Software Foundation (ASF) under one or more | |
# contributor license agreements. See the NOTICE file distributed with | |
# this work for additional information regarding copyright ownership. | |
# The ASF licenses this file to You under the Apache License, Version 2.0 | |
# (the "License"); you may not use this file except in compliance with | |
# the License. You may obtain a copy of the License at | |
# | |
# http://www.apache.org/licenses/LICENSE-2.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.apache.http.HttpEntity; | |
import org.apache.http.HttpResponse; | |
import org.apache.http.StatusLine; | |
import org.apache.http.client.ClientProtocolException; | |
import org.apache.http.client.HttpClient; | |
import org.apache.http.client.methods.HttpGet; | |
import org.apache.http.impl.client.DefaultHttpClient; | |
import org.json.simple.JSONArray; | |
import org.json.simple.JSONObject; | |
import org.json.simple.JSONValue; |
Start server on one machine using:
iperf -s -i 1
-i
specifies the interval at which the output is specified-s
specified to start server
Start client on another machine using:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class String | |
def undent | |
gsub(/^.{#{slice(/^ +/).length}}/, '') | |
end | |
end | |
#Usage: | |
test = <<-EOS.undent | |
testing unindent | |
..another line |