Skip to content

Commit

Permalink
2024-09-19 17:12:45.215182 new snippets
Browse files Browse the repository at this point in the history
  • Loading branch information
eduardocerqueira committed Sep 19, 2024
1 parent 7ce95a3 commit 2d5d3e3
Show file tree
Hide file tree
Showing 23 changed files with 1,083 additions and 340 deletions.
37 changes: 37 additions & 0 deletions seeker/report.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,40 @@
--------------------------------------------------------------------------------
2024-09-19 17:12:45.215182
--------------------------------------------------------------------------------
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/clone-github.sh
deleted: snippet/data-exploration.py
deleted: snippet/data-preprocessing.py
deleted: snippet/dataset-preparation.py
deleted: snippet/find-lambda.sh
deleted: snippet/fix-atime.py
deleted: snippet/install.sh
deleted: snippet/read-dataset.py

Untracked files:
(use "git add <file>..." to include in what will be committed)
snippet/App.java
snippet/CircleLoader.java
snippet/Download and Install Jamf Connect.zsh
snippet/Suspense3DCircle.java
snippet/SuspenseCircle.java
snippet/TechCircle.java
snippet/activate_sublime_text_4180.sh
snippet/build.sh
snippet/client.go
snippet/downloader.py
snippet/googlesender.py
snippet/open_form.py
snippet/pcp.py
snippet/server.go

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

--------------------------------------------------------------------------------
2024-09-18 17:12:23.129943
--------------------------------------------------------------------------------
Expand Down
55 changes: 55 additions & 0 deletions seeker/snippet/App.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
//date: 2024-09-19T16:54:01Z
//url: https://api.github.com/gists/ea0c3425bcbdacac7ee1fdda8ee3b33c
//owner: https://api.github.com/users/gleidsonmt

import javafx.application.Application;
import javafx.concurrent.Task;
import javafx.geometry.Pos;
import javafx.scene.Scene;
import javafx.scene.layout.FlowPane;
import javafx.stage.Stage;

/**
* @author Gleidson Neves da Silveira | [email protected]
* Create on 18/09/2024
*/
public class App extends Application {
@Override
public void start(Stage stage) {

FlowPane root = new FlowPane();
root.setHgap(20);
root.setAlignment(Pos.CENTER);

SuspenseCircle suspenseCircle = new SuspenseCircle();
TechCircle techCircle = new TechCircle();
Suspense3DCircle suspense3DCircle = new Suspense3DCircle();

root.getChildren().addAll(suspenseCircle, techCircle, suspense3DCircle);

stage.setTitle("Suspense Circle!");
stage.setScene(new Scene(root, 800, 600));
stage.getScene().getStylesheets().add(getClass().getResource("style.css").toExternalForm());


Task task = new Task() {
@Override
protected Object call() throws Exception {
Thread.sleep(2000);
updateTitle("Initializing...");
updateMessage(("Welcome!"));
return null;
}
};
Thread thread = new Thread(task);
thread.start();
suspenseCircle.titleProperty().bind(task.titleProperty());
suspenseCircle.legendProperty().bind(task.messageProperty());

stage.show();
}

public static void main(String[] args) {
launch();
}
}
96 changes: 96 additions & 0 deletions seeker/snippet/CircleLoader.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
//date: 2024-09-19T16:54:01Z
//url: https://api.github.com/gists/ea0c3425bcbdacac7ee1fdda8ee3b33c
//owner: https://api.github.com/users/gleidsonmt

package io.github.gleidsonmt.tutorial_circle;

import javafx.animation.Interpolator;
import javafx.animation.RotateTransition;
import javafx.animation.Timeline;
import javafx.beans.property.StringProperty;
import javafx.geometry.Point3D;
import javafx.geometry.Pos;
import javafx.scene.control.Label;
import javafx.scene.layout.StackPane;
import javafx.scene.layout.VBox;
import javafx.scene.shape.Circle;
import javafx.util.Duration;

/**
* @author Gleidson Neves da Silveira | [email protected]
* Create on 17/09/2024
*/
public abstract class CircleLoader extends VBox implements SuspenseLoader {

protected final Label title;
protected final Label legend;

public CircleLoader() {
this("Loading...", "Loading tasks...");
}

public CircleLoader(String _title, String _legend) {
title = new Label(_title);
legend = new Label(_legend);

title.getStyleClass().add("title");
legend.getStyleClass().add("legend");

// setting a margin between sections
this.setSpacing(10);
this.setAlignment(Pos.CENTER);
this.getStyleClass().add(0, "circle-loader");
//
StackPane circleContainer = createCircleContainer();
circleContainer.getStyleClass().add("container-circle");
circleContainer.getChildren().add(title);
this.getChildren().setAll(circleContainer, legend);
}

protected abstract StackPane createCircleContainer(); //

protected void rotate(Circle circle, int angle, Point3D point) {
RotateTransition rotate = new RotateTransition(Duration.seconds(5), circle);

rotate.setAxis(point);
rotate.setAutoReverse(true);

rotate.setByAngle(angle);
rotate.setInterpolator(Interpolator.LINEAR);
rotate.setCycleCount(Timeline.INDEFINITE);
rotate.play();

}

protected void rotate(Circle circle, int angle, int duration) {
RotateTransition transition = new RotateTransition(Duration.seconds(duration), circle);

transition.setByAngle(angle);
// transition.setInterpolator(Interpolator.TANGENT(Duration.millis(2000), 80));
// transition.setInterpolator(Interpolator.LINEAR);
transition.setInterpolator(Interpolator.SPLINE(1, 0.8, 0.6, 0.4));
transition.setCycleCount(Timeline.INDEFINITE);
transition.play();

}

@Override
public StringProperty titleProperty() {
return title.textProperty();
}

@Override
public StringProperty legendProperty() {
return legend.textProperty();
}

@Override
public void setTitle(String _title) {
title.setText(_title);
}

@Override
public void setLegend(String _legend) {
legend.setText(_legend);
}
}
151 changes: 151 additions & 0 deletions seeker/snippet/Download and Install Jamf Connect.zsh
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
#date: 2024-09-19T17:04:17Z
#url: https://api.github.com/gists/bc4755983f2ce2a25894ab518e501be9
#owner: https://api.github.com/users/AndrewMBarnett

#!/bin/zsh

:<<ABOUT_THIS_SCRIPT
-------------------------------------------------------------------------------
Written by:William Smith
Partner Program Manager
Jamf
[email protected]
https://gist.github.com/talkingmoose/94882adb69403a24794f6b84d4ae9de5
Originally posted: June 1, 2023
Purpose: Downloads and installs the latest available Jamf Connect software
for Mac directly on the client. This avoids having to manually download
and store an up-to-date installer on a distribution server every month.
Instructions: Optionally update the sha256Checksum value with a
known SHA 256 string. Run the script with elevated privileges.
If using Jamf Pro, consider replacing the sha256Checksum value
with "$4", entering the checksum as script parameter in a policy.
Except where otherwise noted, this work is licensed under
http://creativecommons.org/licenses/by/4.0/
"If you are going to fail, then fail gloriously."
Updated on: 09/19/2024
Updated by: @andrewmbarnett (https://gist.github.com/AndrewMBarnett)
Updates:
- Added in the option to download a targeted version of Jamf Connect
- Added in to show the latest version of Jamf Connect
- Added in a check to see if the connectVersion variable is set to either download the targeted version or the latest
-------------------------------------------------------------------------------
ABOUT_THIS_SCRIPT


# enter the SHA 256 checksum for the download file
# download the package and run '/usr/bin/shasum -a 256 /path/to/file.pkg'
# this will change with each version
# leave blank to to skip the checksum verification (less secure) or if using a $4 script parameter with Jamf Pro

sha256Checksum="" # e.g. "67b1e8e036c575782b1c9188dd48fa94d9eabcb81947c8632fd4acac7b01644b"

if [ "$4" != "" ] && [ "$sha256Checksum" = "" ]
then
sha256Checksum=$4
fi

# functions
function logcomment() {
if [ $? = 0 ] ; then
/bin/date "+%Y-%m-%d %H:%M:%S $1" >> "$logFile"
else
/bin/date "+%Y-%m-%d %H:%M:%S $2" >> "$logFile"
fi
}

# path to this script
currentDirectory=$( /usr/bin/dirname "$0" )

# name of this script
currentScript=$( /usr/bin/basename -s .sh "$0" )

# create log file in same directory as script
logFile="/Library/Logs/$currentScript - $( /bin/date '+%y-%m-%d' ).log"

echo "Log file: $logFile"

# temporary file name for downloaded package
dmgFile="JamfConnect.dmg"
pkgFile="JamfConnect.pkg"

# Jamf Connect Version target number (Leave blank for latest Connect Version)
connectVersion="2.38.0"

# Jamf Connect full download URL to the latest version
connectURL="https://files.jamfconnect.com/JamfConnect.dmg"
# Jamf Connect latest version available on the website
appNewVersion=$(curl -fsIL "${connectURL}" | grep "x-amz-meta-version" | grep -o "[0-9.].*[0-9.].*[0-9]")
echo "Latest Jamf Connect Version: $appNewVersion"

# Check if Connect Version is blank
if [ "$connectVersion" = "" ]; then
echo "Connect Version was blank, downloading latest version..."
# get the latest version of the product
downloadURL="https://files.jamfconnect.com/JamfConnect.dmg"
echo "Download URL: $downloadURL"
else
echo "Downloading Connect Version: $connectVersion"
# this is the full download URL to the latest version of the product
downloadURL="https://files.jamfconnect.com/JamfConnect-$connectVersion.dmg"
echo "Download URL: $downloadURL"
fi

# create temporary working directory
echo "Creating working directory '$tempDirectory'"
workDirectory=$( /usr/bin/basename $0 )
tempDirectory=$( /usr/bin/mktemp -d "/private/tmp/$workDirectory.XXXXXX" )

# change directory to temporary working directory
echo "Changing directory to working directory '$tempDirectory'"
cd "$tempDirectory"

# download the installer package
echo "Downloading disk image $dmgFile"
/usr/bin/curl "$downloadURL" \
--location \
--silent \
--output "$dmgFile"

# checksum the download
downloadChecksum=$( /usr/bin/shasum -a 256 "$tempDirectory/$dmgFile" | /usr/bin/awk '{ print $1 }' )
echo "Checksum for downloaded disk image: $downloadChecksum"

# install the download if checksum validates
if [ "$sha256Checksum" = "$downloadChecksum" ] || [ "$sha256Checksum" = "" ]; then
echo "Checksum verified. Installing software..."

# mounting DMG
logcomment "Mounting $dmgFile..."
appVolume=$( yes | /usr/bin/hdiutil attach -nobrowse "$tempDirectory/$dmgFile" | /usr/bin/grep /Volumes | /usr/bin/sed -e 's/^.*\/Volumes\///g' )
logcomment "Mounted $dmgFile." "Failed to mount $dmgFile."
echo "$appVolume"

# install software
logcomment "Installing software..."
/usr/sbin/installer -pkg "/Volumes/$appVolume/$pkgFile" -target /
logcomment "Installed software." "Failed to install software."

# unmount DMG
logcomment "Unmounting $dmgFile..."
/sbin/umount -f "/Volumes/$appVolume" # forcibly unmount
logcomment "Unmounting $dmgFile." "Failed to unmount $dmgFile."

else
echo "Checksum failed. Recalculate the SHA 256 checksum and try again. Or download may not be valid."
exit 1
fi

# delete DMG
logcomment "Deleting DMG..."
/bin/rm -R "$tempDirectory"
logcomment "Deleted DMG." "Failed to delete DMG."

exit $exitCode
Loading

0 comments on commit 2d5d3e3

Please sign in to comment.