Create 3 top-level directories. Create a file and a directory in each.
$ mkdir r rx x
$ touch {r,rx,x}/file
$ mkdir {r,rx,x}/dir
#!/bin/sh | |
# | |
# a simple way to parse shell script arguments | |
# | |
# please edit and use to your hearts content | |
# | |
ENVIRONMENT="dev" |
#!/bin/bash | |
# | |
# Example of how to parse short/long options with 'getopt' | |
# | |
OPTS=`getopt -o vhns: --long verbose,dry-run,help,stack-size: -n 'parse-options' -- "$@"` | |
if [ $? != 0 ] ; then echo "Failed parsing options." >&2 ; exit 1 ; fi | |
echo "$OPTS" |
#!/usr/bin/env ruby | |
require 'pdf/reader' # gem install pdf-reader | |
# credits to : | |
# https://github.com/yob/pdf-reader/blob/master/examples/text.rb | |
# usage example: | |
# ruby pdf2txt.rb /path-to-file/file1.pdf [/path-to-file/file2.pdf..] | |
ARGV.each do |filename| | |
PDF::Reader.open(filename) do |reader| |
/* Deleting a node from Binary search tree */ | |
#include<iostream> | |
using namespace std; | |
struct Node { | |
int data; | |
struct Node *left; | |
struct Node *right; | |
}; | |
//Function to find minimum in a tree. | |
Node* FindMin(Node* root) |
/** | |
* Definition for a binary tree node. | |
* function TreeNode(val) { | |
* this.val = val; | |
* this.left = this.right = null; | |
* } | |
*/ | |
/** | |
* @param {TreeNode} root | |
* @param {number} key |
require 'benchmark/ips' | |
Benchmark.ips do |x| | |
Property = Struct.new(:name, :original_name) | |
PROPERTIES = [ | |
Property.new("Clo", "Chloe" ), | |
Property.new("Jon", "Jonathan" ), | |
Property.new("Kris", "Kristin" ), |
require 'yaml' | |
$db_file = 'filename.yaml' | |
def load_data | |
text = File.read 'db.yaml' | |
return YAML.load text | |
end | |
def store_data hash |
#!/usr/bin/env ruby | |
=begin | |
install Sinatra: gem install sinatra | |
install Shotgun: gem install shotgun (this auto-reloads sinatra on every http request - which means every time you make a change in your code you don't have to stop then start sinatra) | |
To just run your code using Sinatra: ruby name-of-file.rb | |
To run your code using Shotgun (which is just Sinatra but with ability to auto-reload when changes are made to files): shotgun name-of-file.rb | |
The following examples are run using Shotgun and the URL is: http://127.0.0.1:9393/ |