This file contains hidden or 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 ruby | |
| # Script to convert the Learn Prolog Now! online HTML edition to a PDF. | |
| require 'nokogiri' | |
| require 'open-uri' | |
| require 'pdfkit' | |
| class HTMLBook | |
| attr_reader :content, :footer |
This file contains hidden or 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
| df -h | |
| echo | |
| ps auxc | head -n 6 | |
| echo | |
| echo "Network information:" | |
| netstat -s -p tcp | sed -n '2p;11p;28p;29p;30p;44p' | tr -d "\t" | |
| echo | |
| cat ~/weather.txt | |
| # Screenshot |
This file contains hidden or 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 | |
| # http://codekata.pragprog.com/2007/01/kata_four_data_.html | |
| awk '{print (($7 - $9) < 0 ? -($7 - $9) : $7 - $9) " " $2}' football.dat | grep -P "[A-Za-z_]{2,}" | sort -n | head -n 1 | awk '{print $2}' |
This file contains hidden or 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
| $ ruby weather_split_vs_scan_benchmarks.rb | |
| user system total real | |
| Using split 0.320000 0.010000 0.330000 ( 0.330723) | |
| Using scan 0.230000 0.020000 0.250000 ( 0.239557) |
This file contains hidden or 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 ruby | |
| # Andrew Horsman | |
| # Monitors a Google Docs page and continuously compiles the text with Clang++. | |
| require 'net/http' | |
| require 'open-uri' | |
| class Downloader | |
| def initialize(source_url) |
This file contains hidden or 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
| CPP = clang++ | |
| OUTPUT = dijkstra | |
| CPPFLAGS = -stdlib=libc++ \ | |
| -IGraph \ | |
| -IDataStructures \ | |
| -o $(OUTPUT) | |
| INPUTFILES = Graph/DijkstraPQ.cpp Graph/Graph.cpp DataStructures/PriorityQueue.cpp | |
| main: | |
| $(CPP) $(CPPFLAGS) $(INPUTFILES) |
This file contains hidden or 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
| #include "Graph.h" | |
| #include "PriorityQueue.h" | |
| void PrintPath(int start, int end, int *parents, int *distance) { | |
| cout << end << " (" << distance[end] << "): "; | |
| int a = start; | |
| int b = end; | |
| while (a != b) { | |
| cout << b << " -> "; | |
| b = parents[b]; |
This file contains hidden or 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 ruby | |
| loop do | |
| if rand < 0.5 | |
| `say herp derp` | |
| else | |
| `say trololololol` | |
| end | |
| end | |
| # If you disturb me while studying, your ears are declared forfeit to this script. |
This file contains hidden or 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
| 2 ~$ rvm use 1.8.7 | |
| Using /Users/basicxman/.rvm/gems/ruby-1.8.7-p330 | |
| 3 ~$ git clone git://github.com/mojombo/chronic.git && cd chronic && rake test | |
| Cloning into chronic... | |
| remote: Counting objects: 2059, done. | |
| remote: Compressing objects: 100% (957/957), done. | |
| remote: Total 2059 (delta 1344), reused 1782 (delta 1083) | |
| Receiving objects: 100% (2059/2059), 277.02 KiB, done. | |
| Resolving deltas: 100% (1344/1344), done. | |
| /Users/basicxman/.rvm/rubies/ruby-1.8.7-p330/bin/ruby -I"lib:lib:test" -I"/Users/basicxman/.rvm/gems/ruby-1.8.7-p330/gems/rake-0.9.2/lib" "/Users/basicxman/.rvm/gems/ruby-1.8.7-p330/gems/rake-0.9.2/lib/rake/rake_test_loader.rb" "test/**/test_*.rb" |
This file contains hidden or 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
| /* | |
| * Perform a single rotation in the given direction around a given root | |
| * tree and return the new root. | |
| * 3 4 | |
| * \ / \ | |
| * 4 ==> 3 5 | |
| * \ | |
| * 5 | |
| * | |
| * The comments will follow with an example of performing a left rotation |