Skip to content

Instantly share code, notes, and snippets.

View andxbes's full-sized avatar

Bescenniy Andrey andxbes

View GitHub Profile
private void deletefile(File path) {
if (path.isDirectory()) {
for (File f : path.listFiles()) {
if (f.isDirectory()) deletefile(f);
else f.delete();
}
}
path.delete();
}
public String get_Md5_Hash(ReadableByteChannel bch) {
String checsumm = null;
MessageDigest md5;
try {
md5 = MessageDigest.getInstance("md5");
md5.reset();
ByteBuffer bb = ByteBuffer.allocate(1024);
while (bch.read(bb) != -1) {
bb.flip();
md5.update(bb);
public Link createFolderInDisk(Field... field) throws NoSuchFieldError, ConnectException, FileNotFoundException, IOException {
//201 - ок
//409 - this folder there is , or is not
String operation = "/v1/disk/resources";
Link link = new Link();
try {
link = query.getObgect(Query.PUT, operation, field, Link.class);
} catch (ConnectException ex) {
if (query.getCode() == 409) {
public Link deleteFileOrFolder(Field... field) throws NoSuchFieldError, ConnectException, IOException {
String operation = "/v1/disk/resources";
return query.getObgect(Query.DELETE, operation, field, Link.class);
}
public interface Disk {
public Map<String, List<Resource>> getResource();
public ReadableByteChannel read(String path)throws FileNotFoundException;
public void write(String path, ReadableByteChannel i);
public void deleteFolderOrFile(String path);
}
Map<String, String> result = new Gson().fromJson(sb.toString(),
new TypeToken<Map<String, String>>() {}.getType());
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package javaapplication38;
import java.util.Collections;
import java.util.LinkedList;
import java.util.List;
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package ua.andxbes;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
sudo apt-get install -y lamp-server^
sudo apt-get install -y phpmyadmin
echo "\n\n String to in end the document \n\n "
echo "Include /etc/phpmyadmin/apache.conf"
sudo gedit /etc/apache2/apache2.conf
sudo /etc/init.d/apache2 restart
echo "restarting"
firefox http://localhost/phpmyadmin http://localhost
sudo apt-get install -y lamp-server^
sudo apt-get install -y phpmyadmin
st="Include /etc/phpmyadmin/apache.conf"
configDocument="/etc/apache2/apache2.conf"
sudo bash -c "echo $st >> $configDocument "
cat $configDocument