This file contains 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 Obrobka_textu | |
def initialize (filename = 0) | |
if filename!=0 | |
file = File.open(filename,'r') | |
@content_of_file = file.read | |
file.close() | |
end | |
end | |
def vuvid | |
puts @content_of_file |
This file contains 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
str = " Дана, строка в которой записаны слова через пробел. Необходимо перемешать в каждом слове все символы в случайном порядке кроме первого и последнего" | |
p str.delete("[.,!?]").split(" ").each {|x| n = x.split("");n.pop;n.shift;n = n.sort_by{rand};n.push(x.split("").pop);x.split("").size>1?n.unshift(x.split("").shift): n; p n.join("") } |
This file contains 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
str = " ABCооооолльоCBA" | |
p str.gsub(/[^A-Z]/,"") == str.gsub(/[^A-Z]/,"").reverse | |
p str.scan(/[A-Z]/).join("") == str.scan(/[A-Z]/).join("").reverse | |
p str.split("").select{|x| x>="A" && x<="Z"}.join("") == str.split("").select{|x| x>="A" && x<="Z"}.join("").reverse |
This file contains 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
<table padding="1"> | |
<tr> | |
<td> <hr id = "line_2"/></td> | |
<%@tab.each do |el|%> | |
<%unless(el[:label]==@choose)%> | |
<td class="left"><div/></td><td class="navbar"><span class="text"><%= link_to el[:label],el[:url] %></span></td><td class="right"></td> | |
<%else%> | |
<td id="left_a"><div/></td><td id="navbar_a"><span id="active"><%= link_to el[:label],el[:url] %></span></td><td id="right_a"></td> | |
<%end%> | |
<td></td> |
This file contains 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 | |
masuvElementiv=( Mercury Venus Earth Mars Jupiter Saturn Uranus Neptune Pluto ) | |
#створюємо масив елементів | |
kilkistElementivMasivu=${#masuvElementiv[@]} #отримуємо кількість елементів у масиві | |
index=0 #ініціалізуємо зміну, за допомогою якої індиксуватимемо масив | |
while [ "$index" -lt "$kilkistElementivMasivu" ] #поки зміна менша за довжину масиву |
This file contains 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 #вказуємо шлях інтерпретатора | |
searchF(){ #функція для перевірки наявності всіх установлених програмок | |
echo -e "Searching for unrar, unzip and tar installed in your system" | |
if [ -x "/usr/bin/unrar" ] #перевірки чи установлений unrar | |
then | |
echo -e "\tUnrar detected!" | |
else | |
echo -e "\tUnrar wasn't detected :(" | |
fi |
This file contains 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 | |
FIND=$(find $1 -type f -mtime 0) #знаходимо файли у директорії,яка передається як парметр, які не змінювалися останні 24 год,пошук здійснюємо рекурсивно і результат занесемо у FIND | |
echo $FIND # виводимо список на екран | |
tar -cf archive.tar $FIND #архівуємо файли у тар-архів | |
gzip -c archive.tar > archive.tar.gz #архівуємо створений архів у gz |
This file contains 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
mojeePole = [#a b c d e f g h i k | |
[0, 0, 0, 0, 0, 0, 0, 0, 0 ,0],#1 | |
[0, 0, 0, 1, 0, 0, 0, 0, 0 ,0],#2 | |
[0, 0, 0, 1, 0, 0, 0, 0, 0 ,0],#3 | |
[0, 0, 0, 1, 0, 0, 0, 0, 0 ,0],#4 | |
[0, 0, 0, 0, 0, 0, 0, 0, 0 ,0],#5 | |
[0, 0, 0, 0, 0, 0, 0, 0, 0 ,0],#6 | |
[0, 0, 0, 0, 0, 0, 0, 0, 0 ,0],#7 | |
[0, 0, 0, 0, 0, 0, 0, 0, 0 ,0],#8 | |
[0, 0, 0, 0, 0, 0, 0, 0, 0 ,0],#9 |
This file contains 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
package org.uzhnu.homework.stack; | |
public class Stack { | |
private String [] strArray; //new arr | |
private int currEl; //pointer to Stack top | |
private static int defaultSize=10; | |
Stack(){ | |
this.strArray = new String[defaultSize]; |
This file contains 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
package org.uzhnu.homework.stack; | |
public class Driver { | |
/** | |
* @param args | |
*/ | |
public static void main(String[] args) { | |
// init empty stack | |
Stack st = new Stack(); |
OlderNewer