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 main | |
import ( | |
"fmt" | |
ffmpeg "github.com/u2takey/ffmpeg-go" | |
"log" | |
"os" | |
"path/filepath" | |
"strings" | |
) |
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
FileChooser.open((file) -> { | |
/* | |
Die Variable "file" ist null, wenn die Auswahl abgebrochen wurde. | |
Ansonsten ist dies ein valides "File" Objekt. | |
*/ | |
}); |
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
/** | |
* A method to determine the ping of a server in milliseconds | |
* @param ip The ip address of the server you want to ping | |
* @param timeout The time window in which the destination has time to respond | |
* @return If the server is reachable within the timout it returns the ping time in ms, otherwise -1 | |
* @throws IOException | |
*/ | |
public static long pingServer(String ip, int timeout) throws IOException { | |
InetAddress address = InetAddress.getByName(ip); | |
long currentTime = System.currentTimeMillis(); |
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
public class OSDetector { | |
public static OperatingSystem getOperatingSystem() { | |
//Der Name vom Betriebssystem kann aus den System Eigenschaften gelesen werden (Unter os.name) | |
String osName = System.getProperty("os.name").toLowerCase(); | |
//Enthält der osName "win", so ist das Betriebssystem Windows | |
if (osName.contains("win")) { | |
return OperatingSystem.WINDOWS; | |
} |
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 pw.navo.compression; | |
import java.io.IOException; | |
public class GzipCompressionTest { | |
public static void main(String[] args) { | |
/** | |
* Für dieses Beispiel nehme ich einen String, da diese sich viel einfacher visualisieren lassen | |
* |
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 pw.navo.compression; | |
import java.io.*; | |
import java.util.zip.GZIPInputStream; | |
import java.util.zip.GZIPOutputStream; | |
public class GzipCompression { | |
public static byte[] compress(byte[] bytes) throws IOException { | |
ByteArrayOutputStream byteStream = new ByteArrayOutputStream(bytes.length); |
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 de.navo.anything; | |
import java.awt.EventQueue; | |
import java.io.File; | |
import java.util.function.Consumer; | |
import javax.swing.JFileChooser; | |
public class DirectoryChooser { | |
/** |
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
import java.io.IOException; | |
import java.security.InvalidKeyException; | |
import java.security.NoSuchAlgorithmException; | |
import java.util.Arrays; | |
import javax.crypto.BadPaddingException; | |
import javax.crypto.IllegalBlockSizeException; | |
import javax.crypto.NoSuchPaddingException; | |
public class AESEncryptionTest { |
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
import java.io.IOException; | |
import java.security.InvalidKeyException; | |
import java.security.Key; | |
import java.security.NoSuchAlgorithmException; | |
import java.security.SecureRandom; | |
import javax.crypto.BadPaddingException; | |
import javax.crypto.Cipher; | |
import javax.crypto.IllegalBlockSizeException; | |
import javax.crypto.NoSuchPaddingException; | |
import javax.crypto.spec.SecretKeySpec; |
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
use admin | |
db.createUser({ | |
user: "<username>", | |
pwd: "<password>", | |
roles: [ | |
"userAdminAnyDatabase", | |
"dbAdminAnyDatabase", | |
"readWriteAnyDatabase" | |
] | |
}) |
NewerOlder