Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/reugn/dev-tools
Browse files Browse the repository at this point in the history
  • Loading branch information
reugn committed Oct 14, 2019
2 parents cad87f7 + a7eb091 commit a98d81b
Show file tree
Hide file tree
Showing 33 changed files with 1,151 additions and 268 deletions.
33 changes: 31 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# dev-tools
Common development tools in one app
Common development tools in one app.
* [Json Editor](#json_editor)
* [UUID/Password Generator](#generator)
* [Hash Calculator](#hash_calculator)
* [Epoch Converter](#epoch_converter)
* [Regular Expression Tester](#regex)
* [Rest API Tester](#rest_api)

## Installation
This is a Maven JavaFX application.
Expand All @@ -13,33 +19,56 @@ or download the latest release.

## Tools List

<a name="json_editor"/>

### Json Editor
* Json Pretty Print with Highlighting
* Json Validation
* Search Bar (Ctrl+F)

![](./images/json_editor.png)

### Generator
<a name="generator"/>

### UUID/Password Generator
* UUID Generator
* Password Generator

![](./images/generator.png)

<a name="hash_calculator"/>

### Hash Calculator
* Hash Functions
* URL Encode/Decode
* Base64 Encode/Decode

![](./images/hash_calculator.png)

<a name="epoch_converter"/>

### Epoch Converter
* Current Unix Epoch Time
* Timestamp to Human Date
* Human Date to Timestamp

![](./images/epoch_converter.png)

<a name="regex"/>

### Regular Expression Tester
* Regex Flags
* Capturing Groups

![](./images/regex.png)

<a name="rest_api"/>

### Rest API Tester
* Rest API Testing Client

![](./images/rest_api.png)

## Contributing
If you find this project useful and want to contribute, please open an issue or create a PR.

Expand Down
Binary file modified images/epoch_converter.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/generator.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/hash_calculator.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/json_editor.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/regex.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/rest_api.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion src/main/java/com/github/reugn/devtools/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public void start(Stage primaryStage) throws Exception {
Parent root = FXMLLoader.load(getClass().getResource("/views/main.fxml"));
primaryStage.setTitle("Dev-tools");
primaryStage.getIcons().add(new Image("/images/icons8-toolbox-64.png"));
Scene scene = new Scene(root, 800, 500);
Scene scene = new Scene(root, 900, 500);
scene.getStylesheets().addAll("/css/main.css", "/css/json-highlighting.css");
primaryStage.setScene(scene);
primaryStage.show();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,46 +1,56 @@
package com.github.reugn.devtools.controllers;

import com.github.reugn.devtools.services.EpochService;
import com.github.reugn.devtools.utils.Elements;
import com.github.reugn.devtools.utils.Logger;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.geometry.Insets;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.control.TextArea;
import javafx.scene.control.TextField;
import javafx.scene.layout.*;
import javafx.scene.paint.Color;
import javafx.scene.control.*;
import javafx.scene.input.KeyEvent;
import javafx.scene.layout.Border;
import javafx.scene.layout.GridPane;
import javafx.scene.layout.HBox;

import java.net.URL;
import java.time.LocalDateTime;
import java.util.ResourceBundle;
import java.util.TimeZone;

public class EpochController implements Initializable, Logger {

public Label currentEpochLabel;

public TextField currentEpoch;

public Button currentEpochRefreshButton;

public TextField tsToHumanField;

public Button tsToHumanButton;

public TextArea tsToHumanResult;

public Button humanToTsButton;

public TextArea humanToTsResult;

public TextField epochYear;
public TextField epochMonth;
public TextField epochDay;
public TextField epochHour;
public TextField epochMinute;
public TextField epochSecond;
@FXML
private Label currentEpochLabel;
@FXML
private TextField currentEpoch;
@FXML
private Button currentEpochRefreshButton;
@FXML
private TextField tsToHumanField;
@FXML
private Button tsToHumanButton;
@FXML
private TextArea tsToHumanResult;
@FXML
private Button humanToTsButton;
@FXML
private TextArea humanToTsResult;
@FXML
private TextField epochYear;
@FXML
private TextField epochMonth;
@FXML
private TextField epochDay;
@FXML
private TextField epochHour;
@FXML
private TextField epochMinute;
@FXML
private TextField epochSecond;
@FXML
private ComboBox<String> timeZoneComboBox;
private int timeZoneComboBoxIndex;

@FXML
private void handleRefreshEpoch(final ActionEvent event) {
Expand All @@ -55,8 +65,7 @@ private void handleTsToHumanEpoch(final ActionEvent event) {
String result = EpochService.toHumanEpoch(dt);
tsToHumanResult.setText(result);
} catch (Exception e) {
tsToHumanField.setBorder(new Border(new BorderStroke(Color.RED,
BorderStrokeStyle.SOLID, new CornerRadii(3), BorderWidths.DEFAULT)));
tsToHumanField.setBorder(Elements.alertBorder);
tsToHumanResult.setText("");
}
}
Expand All @@ -71,13 +80,30 @@ private void handleHumanToTsEpoch(final ActionEvent event) {
int hour = EpochService.validate(epochHour, 0, 24);
int minute = EpochService.validate(epochMinute, 0, 59);
int second = EpochService.validate(epochSecond, 0, 59);
String result = EpochService.toTsEpoch(year, month, day, hour, minute, second);
String timeZone = timeZoneComboBox.getSelectionModel().getSelectedItem();
String result = EpochService.toTsEpoch(year, month, day, hour, minute, second, timeZone);
humanToTsResult.setText(result);
} catch (Exception e) {
humanToTsResult.setText("");
}
}

@FXML
private void handleTimeZoneSearch(KeyEvent keyEvent) {
String key = keyEvent.getText();
if (key.length() == 0) return;
int i = 0;
for (String item : timeZoneComboBox.getItems()) {
if (item.toLowerCase().startsWith(key) && i > timeZoneComboBoxIndex) {
timeZoneComboBox.setValue(item);
timeZoneComboBoxIndex = i;
return;
}
i++;
}
timeZoneComboBoxIndex = 0;
}

private void resetBorders() {
epochYear.setBorder(Border.EMPTY);
epochMonth.setBorder(Border.EMPTY);
Expand All @@ -89,11 +115,11 @@ private void resetBorders() {

@Override
public void initialize(URL location, ResourceBundle resources) {
HBox.setMargin(currentEpochLabel, new Insets(20, 5, 15, 0));
HBox.setMargin(currentEpoch, new Insets(15, 5, 15, 0));
HBox.setMargin(currentEpochRefreshButton, new Insets(15, 5, 15, 0));
HBox.setMargin(tsToHumanField, new Insets(15, 5, 15, 0));
HBox.setMargin(tsToHumanButton, new Insets(15, 5, 15, 0));
HBox.setMargin(currentEpochLabel, new Insets(15, 5, 10, 0));
HBox.setMargin(currentEpoch, new Insets(10, 5, 10, 0));
HBox.setMargin(currentEpochRefreshButton, new Insets(10, 5, 10, 0));
HBox.setMargin(tsToHumanField, new Insets(10, 5, 10, 0));
HBox.setMargin(tsToHumanButton, new Insets(10, 5, 10, 0));

GridPane.setMargin(epochYear, new Insets(10, 5, 0, 0));
GridPane.setMargin(epochMonth, new Insets(10, 5, 0, 0));
Expand All @@ -102,6 +128,7 @@ public void initialize(URL location, ResourceBundle resources) {
GridPane.setMargin(epochMinute, new Insets(10, 5, 0, 0));
GridPane.setMargin(epochSecond, new Insets(10, 5, 0, 0));
GridPane.setMargin(humanToTsButton, new Insets(10, 5, 0, 0));
GridPane.setMargin(timeZoneComboBox, new Insets(10, 5, 0, 0));

long now = System.currentTimeMillis();
currentEpoch.setText(Long.toString(now));
Expand All @@ -114,5 +141,9 @@ public void initialize(URL location, ResourceBundle resources) {
epochHour.setText(String.valueOf(date.getHour()));
epochMinute.setText(String.valueOf(date.getMinute()));
epochSecond.setText(String.valueOf(date.getSecond()));

timeZoneComboBox.getItems().setAll(TimeZone.getAvailableIDs());
timeZoneComboBox.setValue("UTC");
timeZoneComboBoxIndex = 0;
}
}
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
package com.github.reugn.devtools.controllers;

import com.github.reugn.devtools.utils.Elements;
import com.github.reugn.devtools.utils.Logger;
import com.github.reugn.devtools.utils.PasswordGenerator;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.geometry.Insets;
import javafx.scene.control.*;
import javafx.scene.layout.*;
import javafx.scene.paint.Color;
import javafx.scene.layout.Border;
import javafx.scene.layout.VBox;

import java.net.URL;
import java.security.InvalidParameterException;
Expand All @@ -19,37 +20,26 @@ public class GeneratorController implements Initializable, Logger {

@FXML
private ComboBox<Integer> uuidAmount;

@FXML
private Label uuidAmountLabel;

@FXML
private CheckBox uuidUpperCase;

@FXML
private CheckBox uuidHyphens;

@FXML
private TextArea generatorResult;

@FXML
private CheckBox pwdLowChars;

@FXML
private CheckBox pwdDigits;

@FXML
private CheckBox pwdUpperChars;

@FXML
private CheckBox pwdSymbols;

@FXML
private TextField pwdLength;

@FXML
private Label pwdLengthLabel;

@FXML
private Button clearButton;

Expand Down Expand Up @@ -77,8 +67,7 @@ private void handleGeneratePasswordAction(final ActionEvent actionEvent) {
pwdLength.setBorder(Border.EMPTY);
length = validatePasswordLength();
} catch (Exception e) {
pwdLength.setBorder(new Border(new BorderStroke(Color.RED,
BorderStrokeStyle.SOLID, new CornerRadii(3), BorderWidths.DEFAULT)));
pwdLength.setBorder(Elements.alertBorder);
return;
}
PasswordGenerator generator = new PasswordGenerator.PasswordGeneratorBuilder()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ private void handleClear(final ActionEvent event) {

@FXML
private void handleCalculate(final ActionEvent event) {
hashMessage.setText("");
try {
String enc;
String data = hashInput.getText();
Expand Down
Loading

0 comments on commit a98d81b

Please sign in to comment.