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
If you've downloaded Eclipse from their official website, follow these steps for the installation. | |
Extract the eclipse.XX.YY.tar.gz using | |
tar -zxvf eclipse.XX.YY.tar.gz | |
Become root. | |
sudo -i | |
Copy the extracted folder to /opt |
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
require "rubygems" | |
require "json" | |
require "net/http" | |
require "uri" | |
require 'open-uri' | |
uri = URI.parse(ARGV[0] + ".json") | |
http = Net::HTTP.new(uri.host, uri.port) | |
request = Net::HTTP::Get.new(uri.request_uri) |
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
class MultiplicationTable { | |
public static void main(String[] args) { | |
//rows | |
int m = Integer.parseInt(args[0]); | |
//columns | |
int n = Integer.parseInt(args[1]); | |
for (int i = 1; i <= m; i++) { | |
for (int j = 1; j <= n; j++) { | |
System.out.print(String.format("%4d", i*j)); |
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
class ReverseString { | |
public static void main(String[] args) { | |
int last = args[0].length()-1; | |
char[] chars = args[0].toCharArray(); | |
for (int i = 0; i < args[0].length()/2; i++) { | |
char temp = chars[i]; | |
chars[i] = chars[last]; | |
chars[last--] = temp; |
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
# v1: | |
("a".."password").to_a.join(" ") | |
# v2: | |
?a.upto('password').to_a.join(" ") |
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
res = [] | |
8.times do | |
res << [rand(7..10), rand(3..4), rand(3..6), rand(2..4)] | |
end | |
14.times do | |
res << [rand(11..20), rand(5..7), rand(3..4), rand(3..4)] | |
end | |
2.times 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
/* | |
You've woken up one day to find that everyone suddenly expresses numbers in different number bases. You're seeing prices in octal and phone numbers in hexadecimal. It's a numerical Tower of Babel! For your own sanity, you decide to program a simple mathematical expression evaluator that can handle numbers in different number bases. It should support addition, subtraction, and multiplication, should respect order of operations, and should handle number bases between 2 and 16. | |
While your language of choice may directly support expression evaluation, please create your own. | |
The input on stdin is a mathematical expression on a single line. Number constants are expressed like "123_4", which is "123" in base 4, which is 27 in base 10. Some digits in the higher bases will be represented with uppercase letters. Numbers within the expression will always be non-negative integers. The operators will be +, -, and *. Whitespace should be ignored. | |
Your program should emit to stdout a single base-10 number with no und |
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
/* | |
* BS-tree size solved with and without additional memory. | |
* | |
*/ | |
#include <iostream> | |
#include <cstdlib> | |
using namespace std; |
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
/* | |
* Simple tree traversal algorithms (preorder, inorder and postorder) | |
* on a small binary tree with 5 nodes. | |
* | |
*/ | |
#include <iostream> | |
#include <cstdlib> | |
using namespace std; |
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
''' | |
Rot13 implementation in ruby | |
21.01.2013. | |
''' | |
def a(s) | |
s.tr("A-MN-Z","N-ZA-M") | |
end | |
p a("ASDDSAZZZ") |