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
/** | |
* @author Robert Boloc | |
*/ | |
public boolean isPower2(int v) { | |
if (v == 1) { | |
return true; | |
} else if (v % 2 != 0 || v == 0) { | |
return false; | |
} else { |
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
<?php | |
error_reporting(E_ALL); | |
ini_set('display_errors', '1'); | |
function microtimestamp() { | |
$timeofday = gettimeofday(); | |
return $timeofday['sec'] + $timeofday['usec'] / | |
1000000; | |
} |
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
file = File.new("input", "r") | |
max = file.gets | |
counter = 1 | |
while (line = file.gets) | |
data = line.split(" ") | |
#num of cases | |
cases = data[0].to_i | |
#num of surprising cases | |
s = data[1].to_i | |
#min result |
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
#googlerese to english | |
mapping = { "a" => "y", "b" => "h", "c" => "e", "d" => "s", "e" => "o", | |
"f" => "c", "g" => "v", "h" => "x", "i" => "d", "j" => "u", | |
"k" => "i", "l" => "g", "m" => "l", "n" => "b", "o" => "k", | |
"p" => "r", "q" => "z", "r" => "t", "s" => "n", "t" => "w", | |
"u" => "j", "v" => "p", "w" => "f", "x" => "m", "y" => "a", | |
"z" => "q"} | |
file = File.new("input", "r") | |
max = file.gets |
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
file = File.new("input", "r") | |
max = file.gets | |
counter = 1 | |
while (line = file.gets) | |
result = 0 | |
raw_range = line.split(" ") | |
range = raw_range[0].to_i..raw_range[1].to_i | |
computed = Hash.new |
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
<?php | |
require_once($CFG->dirroot.'/lib/formslib.php'); | |
class my_form extends moodleform{ | |
function definition() { | |
//check if the select must be disabled | |
isset($this->_customdata['disabled_select']) |
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
<?php | |
$default_form_data = array ('disabled_select' => true); | |
$my_form = new my_form($default_form_data); | |
$my_form->display(); |
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
[remote "origin"] | |
url = https://[email protected]/username/reponame.git | |
fetch = +refs/heads/*:refs/remotes/origin/* |
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
[remote "origin"] | |
url = [email protected]:username/reponame.git | |
fetch = +refs/heads/*:refs/remotes/origin/* |
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
--- | |
Compression | |
--- | |
# Create folder.tar.bz2 from folder | |
tar -cvjf folder.tar.bz2 folder/* | |
--- | |
Mysql | |
--- | |
# Dump selected table |
OlderNewer