Thursday, January 2, 2025
Friday, December 27, 2024
Nextcloud on Nginx Proxy Manager Network
##### nextcloud http with nginx network without exposing ports ### find nginx proxy manager ports with docker network ls ### attach to the network with docker run -d \ --name=nextcloud \ --network=nginx_default \ -e PUID=1000 \ -e PGID=1000 \ -e TZ=Etc/UTC \ -v /home/j/nextcloud/config:/config \ -v /home/j/nextcloud/data:/data \ --restart unless-stopped \ lscr.io/linuxserver/nextcloud:latest
Nginx Proxy Manager on Raspberry Pi
### cmds
mkdir nginx
docker compose up -d
### docker-compose.yml
services:
app:
image: 'jc21/nginx-proxy-manager:latest'
restart: unless-stopped
ports:
- '80:80'
- '81:81'
- '443:443'
volumes:
- ./data:/data
- ./letsencrypt:/etc/letsencrypt
Nextcloud on Docker
##### nextcloud https docker run -d \ --name=nextcloud \ -e PUID=1000 \ -e PGID=1000 \ -e TZ=Etc/UTC \ -p 443:443 \ -v /home/j/nextcloud/config:/config \ -v /home/j/nextcloud/data:/data \ --restart unless-stopped \ lscr.io/linuxserver/nextcloud:latest ##### nextcloud http docker run -d \ --name=nextcloud \ -e PUID=1000 \ -e PGID=1000 \ -e TZ=Etc/UTC \ -p 8080:80 \ -v /home/j/nextcloud/config:/config \ -v /home/j/nextcloud/data:/data \ --restart unless-stopped \ lscr.io/linuxserver/nextcloud:latest ##### nextcloud remove docker rm -f 412f2933d1ec sudo rm -Rf nextcloud/
Sunday, November 10, 2024
Sunday, October 13, 2024
Verify ISO
Download the iso and checksums (sha256sum.txt) and use the below commands to verify
CertUtil -hashfile linuxmint-22-mate-64bit.iso SHA256 grep 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX' ./sha256sum.txt
References :
Wednesday, October 9, 2024
Roman Numerals in Java
package com.example.demo.utils.math;
import java.io.IOException;
import java.util.TreeMap;
public class RomanNumeral {
private final static TreeMap map = new TreeMap();
static {
map.put(1000, "M");
map.put(900, "CM");
map.put(500, "D");
map.put(400, "CD");
map.put(100, "C");
map.put(90, "XC");
map.put(50, "L");
map.put(40, "XL");
map.put(10, "X");
map.put(9, "IX");
map.put(5, "V");
map.put(4, "IV");
map.put(1, "I");
}
public final static String toRoman(int number) {
int l = map.floorKey(number);
if ( number == l ) {
return map.get(number);
}
return map.get(l) + toRoman(number-l);
}
public static void main(String[] args) throws IOException {
int v = 113;
System.out.println("############################################");
System.out.println("\t\t\t\t" + v + " = " + toRoman(v));
System.out.println("############################################");
}
}
References :
Friday, September 27, 2024
List of Files in Java
################################## Example 2 ##################################
package com.example.demo.utils.scan;
import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.nio.file.StandardOpenOption;
public class FileScanner {
public static void main(String[] args) throws IOException {
Files.write(
Paths.get("C:\\Users\\j\\Documents\\out.csv"),
getList(new File("C:\\").listFiles(), new StringBuffer()).toString().getBytes(),
StandardOpenOption.TRUNCATE_EXISTING);
}
public static StringBuffer getList(File[] listOfFiles, StringBuffer sb) {
if (listOfFiles != null)
for (File i : listOfFiles)
if (i.isFile()) {
sb.append("\"" + i.getPath() + "\"" + "," + "\""
+ i.length() + "\"" + "," + "\"" + i.lastModified() + "\"" + "\n");
System.out.println(i.getName());
} else if (i.isDirectory()) getList(new File(i.getPath()).listFiles(), sb);
return sb;
}
}
################################## Example 1 ##################################
package org.example;
import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.nio.file.StandardOpenOption;
public class Main {
public static void main(String[] args) throws IOException {
String out = "C:\\Users\\j\\Documents\\out.txt";
clearfile("", out);
getList("C:\\");
//writefile("in", "C:\\Users\\j\\Documents\\out.txt");
}
public static void getList(String path) throws IOException {
// System.out.println("Hello jeetu!");
String out = "C:\\Users\\j\\Documents\\out.txt";
File folder = new File(path);
File[] listOfFiles = folder.listFiles();
if (listOfFiles != null) {
for (int i = 0; i < listOfFiles.length; i++) {
if (listOfFiles[i].isFile()) {
long fileSizeInBytes = listOfFiles[i].length();
// Convert the bytes to Kilobytes (1 KB = 1024 Bytes)
//long fileSizeInKB = fileSizeInBytes / 1024;
// Convert the KB to MegaBytes (1 MB = 1024 KBytes)
//long fileSizeInMB = fileSizeInKB / 1024;
// System.out.println(listOfFiles[i].getName());
writefile(listOfFiles[i].getPath(), out);
writefile("," + fileSizeInBytes, out);
writefile("\n", out);
System.out.println(listOfFiles[i].getName() + "," + fileSizeInBytes);
} else if (listOfFiles[i].isDirectory()) {
//System.out.println("Directory " + listOfFiles[i].getName());
//System.out.println("Directory " + listOfFiles[i].getPath());
getList(listOfFiles[i].getPath());
}
}
}
}
public static void writefile(String content, String path) throws IOException {
Files.write(
Paths.get(path),
content.getBytes(),
StandardOpenOption.APPEND);
}
public static void clearfile(String content, String path) throws IOException {
Files.write(
Paths.get(path),
content.getBytes(),
StandardOpenOption.TRUNCATE_EXISTING);
}
}
References :
Tuesday, September 24, 2024
Kafka on Docker
### KAFKA DEV NODE - with GUI git clone https://github.com/jeethualex/kafka-development-node.git cd kafka-development-node docker compose up # Check urls - http://localhost:3000/ # and http:/localhost:8080/ui/clusters/local/all-topics/demo/messages?limit=100&mode=LATEST docker compose down ### BASIC KAFKA TESTS docker run -d --name=kafka -p 9092:9092 apache/kafka docker ps ## Start cluster docker exec -ti kafka /opt/kafka/bin/kafka-cluster.sh cluster-id --bootstrap-server :9092 docker ps ## Publich to topic - Crtl + C to exit ## Keep entering messages using enter docker exec -ti kafka /opt/kafka/bin/kafka-console-producer.sh --bootstrap-server :9092 --topic demo ## Consume from topic - Crtl + C to exit ## Open in new terminal ## Keep receiving messages docker exec -ti kafka /opt/kafka/bin/kafka-console-consumer.sh --bootstrap-server :9092 --topic demo --from-beginning
References :
Subscribe to:
Posts
(
Atom
)