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 <iostream> // For std::cout, std::flush, and std::endl | |
| #include <chrono> // For std::chrono::milliseconds | |
| #include <thread> // For std::this_thread::sleep_for | |
| /** Update current line without putting the text on the next line | |
| * | |
| * This is done by using \r (carriage return) instead of \n | |
| */ | |
| int main(const int argc, char const* argv[]) { |
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 <assert.h> | |
| #include <stdio.h> | |
| #include <iostream> | |
| #include <vector> | |
| #include <algorithm> | |
| using MemoizationTable = std::vector<std::vector<int>>; | |
| /** Utility function to dump the memoization table | |
| */ |
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 | |
| require 'robotex' | |
| require 'nokogiri' | |
| require 'open-uri' | |
| url = 'http://www.cplusplus.com/reference/ios/basic_ios/' | |
| # Fake User Agent | |
| ua = 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:9.0.1) Gecko/20100101 Firefox/9.0.1' |
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
| source 'https://rubygems.org' | |
| gem 'robotex' | |
| gem 'nokogiri' | |
| gem 'trollop' | |
| gem 'thread' |
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 | |
| # A program that sorts the output from the command `du -h' | |
| # Use it like: du -h . | $PROGRAM_NAME [-r|--reverse] | |
| SUFFIX = { | |
| 'K' => 1E3, | |
| 'M' => 1E6, | |
| 'G' => 1E9, | |
| 'T' => 1E12, |
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 | |
| require 'sqlite3' | |
| require 'active_record' | |
| ActiveRecord::Base.establish_connection( | |
| adapter: 'sqlite3', | |
| database: 'sample.db' | |
| ) |
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 <iostream> | |
| class Foo { | |
| public: | |
| Foo() {} | |
| Foo(const int x) : x(x) {} | |
| int other_x(const Foo& other) { | |
| // Accessing private member variable | |
| return other.x; |
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 | |
| require 'fileutils' | |
| require 'slop' | |
| # Move image files downloaded using Pixiv Downloader to appropriate | |
| # directories. | |
| # | |
| # https://chrome.google.com/webstore/detail/pixiv-downloader/lkpfhmlbjibbcinophhcbmapjbhboodd | |
| # |
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 | |
| def measure | |
| `uptime`.split(' ')[-3].chop.to_f | |
| end | |
| max = -1 | |
| maxes = [] | |
| loop do |
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 <iostream> | |
| #include <queue> | |
| struct Foo { | |
| Foo(const int x) : x(x) {} | |
| int x; | |
| }; | |
| std::ostream& operator<<(std::ostream& os, const Foo& f) { | |
| os << f.x; |