Skip to content

Commit

Permalink
2024-08-29 17:11:54.148933 new snippets
Browse files Browse the repository at this point in the history
  • Loading branch information
eduardocerqueira committed Aug 29, 2024
1 parent 0b083d2 commit 6507d4a
Show file tree
Hide file tree
Showing 34 changed files with 1,214 additions and 1,227 deletions.
48 changes: 48 additions & 0 deletions seeker/report.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,51 @@
--------------------------------------------------------------------------------
2024-08-29 17:11:54.148933
--------------------------------------------------------------------------------
On branch main
Your branch is up to date with 'origin/main'.

Changes not staged for commit:
(use "git add/rm <file>..." to update what will be committed)
(use "git restore <file>..." to discard changes in working directory)
deleted: snippet/3proxy.sh
deleted: snippet/Merge Cells in Word using Python.py
deleted: snippet/Welcome-to-bulkOS.sh
deleted: snippet/airwork_test.py
deleted: snippet/airwrk.py
deleted: snippet/alpine-container.sh
deleted: snippet/arch-container.sh
deleted: snippet/asdf.py
deleted: snippet/bill_req_patient.go
deleted: snippet/code.py
deleted: snippet/git checkout-all-branches.sh
deleted: snippet/install.sh
deleted: snippet/neovim.sh
deleted: snippet/pomo.py
deleted: snippet/sharepoint_connection.py
deleted: snippet/slotVerse1withgui.py
deleted: snippet/slotVerse2nogui.py
deleted: snippet/ssacli_to_json.py
deleted: snippet/thirty_seven.java
deleted: snippet/ubuntu-container.sh

Untracked files:
(use "git add <file>..." to include in what will be committed)
snippet/WikiLocation.java
snippet/WikiParser.java
snippet/adb-shell-as-root-dump-vendor.sh
snippet/chat.py
snippet/error-handling-flask.py
snippet/flask.py
snippet/pipes_1.py
snippet/repack.sh
snippet/repackepub.sh
snippet/runner.go
snippet/spbpu_schedule_to_google_calendar.py
snippet/vendor_sleuth.sh
snippet/vlm_rag.py

no changes added to commit (use "git add" and/or "git commit -a")

--------------------------------------------------------------------------------
2024-08-28 17:11:23.503361
--------------------------------------------------------------------------------
Expand Down
144 changes: 0 additions & 144 deletions seeker/snippet/3proxy.sh

This file was deleted.

51 changes: 0 additions & 51 deletions seeker/snippet/Merge Cells in Word using Python.py

This file was deleted.

10 changes: 0 additions & 10 deletions seeker/snippet/Welcome-to-bulkOS.sh

This file was deleted.

88 changes: 88 additions & 0 deletions seeker/snippet/WikiLocation.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
//date: 2024-08-29T17:03:49Z
//url: https://api.github.com/gists/a52fb5d70dcef6d431363b0f431de4e6
//owner: https://api.github.com/users/pagetronic

package live.page.wiki;

import live.page.hubd.system.json.Json;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

public class WikiLocation {
public static List<Double> findLocation(Json data) {
for (String key : data.keySet()) {
if (key.matches("object location|object location dec|location|location dec|camera location|camera location dec")) {
List<Double> coordinates = convertCoordinates(data.getList(key));
if (coordinates != null) {
return coordinates;
}
}
if (Json.class.isAssignableFrom(data.get(key).getClass())) {
List<Double> coordinates = findLocation(data.getJson(key));
if (coordinates != null) {
return coordinates;
}
}
if (List.class.isAssignableFrom(data.get(key).getClass()) &&
!data.getList(key).isEmpty()) {
for (Object item : data.getList(key)) {
if (item != null && Json.class.isAssignableFrom(item.getClass())) {
List<Double> coordinates = findLocation((Json) item);
if (coordinates != null) {
return coordinates;
}
}
}
}
}
return null;
}


private static List<Double> convertCoordinates(List<String> coordinates) {
if (coordinates == null) {
return null;
}
coordinates = new ArrayList<>(coordinates);
for (int key : new int[]{8, 2}) {
if (coordinates.size() > key) {
for (String start : new String[]{
"source", "alt", "type",
"heading", "region", "zoom", "scale",
"...", "sl", "dim", "view"}) {
if (coordinates.get(key).trim().toLowerCase().startsWith(start) || coordinates.get(key).trim().isEmpty()) {
coordinates.remove(key);
break;
}
}
}
}

try {
if (coordinates.size() >= 8 &&
(coordinates.get(3).equals("N") || coordinates.get(3).equals("S")) &&
(coordinates.get(7).equals("E") || coordinates.get(7).equals("W"))
) {
return Arrays.asList(
convertCoordinates(Double.parseDouble(coordinates.get(0)), Double.parseDouble(coordinates.get(1)), Double.parseDouble(coordinates.get(2)), coordinates.get(3)),
convertCoordinates(Double.parseDouble(coordinates.get(4)), Double.parseDouble(coordinates.get(5)), Double.parseDouble(coordinates.get(6)), coordinates.get(7)));
} else {
return Arrays.asList(Double.parseDouble(coordinates.get(0)), Double.parseDouble(coordinates.get(1)));
}
} catch (Exception e) {
e.printStackTrace();
}
return null;
}

private static double convertCoordinates(double degree, double minute, double second, String heading) {
double decimalDegrees = degree + (minute / 60.0) + (second / 3600.0);
if ("W".equals(heading) || "S".equals(heading)) {
decimalDegrees = -decimalDegrees;
}

return decimalDegrees;
}
}
Loading

0 comments on commit 6507d4a

Please sign in to comment.