Skip to content

Commit

Permalink
2024-08-26 17:12:12.080171 new snippets
Browse files Browse the repository at this point in the history
  • Loading branch information
eduardocerqueira committed Aug 26, 2024
1 parent 9fd3943 commit 50b08db
Show file tree
Hide file tree
Showing 39 changed files with 1,030 additions and 932 deletions.
53 changes: 53 additions & 0 deletions seeker/report.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,56 @@
--------------------------------------------------------------------------------
2024-08-26 17:12:12.080171
--------------------------------------------------------------------------------
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/.go
deleted: snippet/Merge-XPS-Files.py
deleted: snippet/bfs2.py
deleted: snippet/check.py
deleted: snippet/compress_video
deleted: snippet/deepsparse_object_detection_cv2.py
deleted: snippet/detect_obfuscation.py
deleted: snippet/gradio_app_assistant.py
deleted: snippet/install-mysql-0.5.6.sh
deleted: snippet/llm_benchmark.py
deleted: snippet/music_visualizer.py
deleted: snippet/receive.go
deleted: snippet/send.go
deleted: snippet/setup-ledger.sh
deleted: snippet/trading_service.py
deleted: snippet/train.sh

Untracked files:
(use "git add <file>..." to include in what will be committed)
snippet/Array_Rotations.java
snippet/BankingApplication.java
snippet/Exception_Handling_ex.java
snippet/Interrupt.java
snippet/Max.java
snippet/Min.java
snippet/MultiThreading.java
snippet/String_Rotations.java
snippet/TreeMapEx.java
snippet/TreeSetEx.java
snippet/WildCard_Operators.java
snippet/analyze.py
snippet/chroot.sh
snippet/convert.py
snippet/create_fake_data.py
snippet/fileToSpeech.py
snippet/open_links.py
snippet/prepare-commit-msg
snippet/pytorch3d_objaverse.py
snippet/remove_backgroud.py
snippet/string_utils.py
snippet/wrap_text.py

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

--------------------------------------------------------------------------------
2024-08-23 17:11:29.423101
--------------------------------------------------------------------------------
Expand Down
57 changes: 0 additions & 57 deletions seeker/snippet/.go

This file was deleted.

39 changes: 39 additions & 0 deletions seeker/snippet/Array_Rotations.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
//date: 2024-08-26T16:46:54Z
//url: https://api.github.com/gists/415476a667aad137ad41f7de8877aae7
//owner: https://api.github.com/users/RamshaMohammed

import java.util.Arrays;

class Array_Rotations {
static void left_rotate(int[] arr, int n) {
n = n % arr.length;
for (int i = 0; i < n; i++) {
int copy = arr[0];
for (int j = 1; j < arr.length; j++) {
arr[j - 1] = arr[j];
}
arr[arr.length - 1] = copy;
System.out.println(Arrays.toString(arr));
}
}

static void right_rotate(int[] arr, int n) {
n = n % arr.length;
for (int i = 0; i < n; i++) {
int copy = arr[arr.length - 1];
for (int j = arr.length - 1; j > 0; j--) {
arr[j] = arr[j - 1];
}
arr[0] = copy;
System.out.println(Arrays.toString(arr));
}
}

public static void main(String[] args) {
int[] arr = {8, 4, 5, 1, 7, 3, 2, 4};
System.err.println("Original array: " + Arrays.toString(arr));
left_rotate(arr, 1);
arr = new int[]{8, 4, 5, 1, 7, 3, 2, 4};
right_rotate(arr, 1);
}
}
64 changes: 64 additions & 0 deletions seeker/snippet/BankingApplication.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
//date: 2024-08-26T16:49:19Z
//url: https://api.github.com/gists/b29aeaabf6b03dcde670c3c7b18786b3
//owner: https://api.github.com/users/RamshaMohammed

import java.util.Scanner;

class LessBalanceException extends Exception {
public LessBalanceException()
{
System.out.println("lessBalance exception");
}
}

public class BankingApplication {

public static void main(String[] args) {
BankAccount account = new BankAccount(10000);
try {
account.deposit(5000);
account.checkBalance();
account.withdraw(3500);
account.checkBalance();
account.withdraw(900);

} catch (LessBalanceException e) {
System.out.println("Exception caught: " + e.getMessage());
} finally {
System.out.println("Final balance is:");
account.checkBalance();
}
}
}

class BankAccount {
private double balance;

public BankAccount(double initialBalance) {
this.balance = initialBalance;
}

public void deposit(double amount) {
if (amount > 0) {
balance += amount;
System.out.println("Successfully deposited " + amount);
} else {
System.out.println("Deposit amount is");
}
}

public void withdraw(double amount) throws LessBalanceException {
if (amount > balance) {
throw new LessBalanceException();
} else if (amount <= 0) {
System.out.println("Withdrawal amount is");
} else {
balance -= amount;
System.out.println("Successfully withdrwn: " + amount);
}
}

public void checkBalance() {
System.out.println("Current balance: " + balance);
}
}
36 changes: 36 additions & 0 deletions seeker/snippet/Exception_Handling_ex.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
//date: 2024-08-26T16:49:19Z
//url: https://api.github.com/gists/b29aeaabf6b03dcde670c3c7b18786b3
//owner: https://api.github.com/users/RamshaMohammed

import java.util.Scanner;

class InvalidAgeException extends Exception {
public InvalidAgeException()
{
System.out.println("To open Bank Account using Age");
}
}

class BankAccount_Registration {
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
System.out.println("Enter your age to open a bank account:");
int age = s.nextInt();

try {
validateAge(age);
System.out.println("Congrats! Your bank account has been opened.");
} catch (InvalidAgeException e) {
System.out.println("Exception caught: " + e.getMessage());
} finally {
System.out.println("Bank account registration process completed.");
s.close();
}
}
public static void validateAge(int age) throws InvalidAgeException {
if (age < 18 || age > 100)
{
throw new InvalidAgeException();
}
}
}
36 changes: 36 additions & 0 deletions seeker/snippet/Interrupt.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
//date: 2024-08-26T16:52:44Z
//url: https://api.github.com/gists/334da33b328a058c4a5bacd60a2340cf
//owner: https://api.github.com/users/RamshaMohammed

class thread extends Thread
{
public void run()
{
try {
for(int i=1;i<=7;i++)
{
System.out.println("Ramsha");
Thread.sleep(1000);
}
}
catch(InterruptedException e)
{
System.out.println("I like to explore new places");
}
}
}
public class Interrupt {
public static void main(String[] args)
{
thread t1 = new thread();
t1.start();
t1.interrupt();
System.out.println(t1.isInterrupted());
System.out.println(t1.interrupted());
for(int i = 0;i<=6;i++)
{
System.out.println("I am from vijayawada"+i);

}
}
}
27 changes: 27 additions & 0 deletions seeker/snippet/Max.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
//date: 2024-08-26T16:46:54Z
//url: https://api.github.com/gists/415476a667aad137ad41f7de8877aae7
//owner: https://api.github.com/users/RamshaMohammed

public class Max {
public static void main(String[] args) {
int[] arr = {12,3,7,19,8};
int[] r = Max(arr);
System.out.println("Max1: " + r[0]);
System.out.println("Max2: " + r[1]);
}

public static int[] Max(int[] arr) {
int max1 = Integer.MIN_VALUE;
int max2 = Integer.MIN_VALUE;

for (int i = 0; i < arr.length; i++) {
if (arr[i] > max1) {
max2 = max1;
max1 = arr[i];
} else if (arr[i] > max2) {
max2 = arr[i];
}
}
return new int[]{max1,max2};
}
}
16 changes: 0 additions & 16 deletions seeker/snippet/Merge-XPS-Files.py

This file was deleted.

27 changes: 27 additions & 0 deletions seeker/snippet/Min.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
//date: 2024-08-26T16:46:54Z
//url: https://api.github.com/gists/415476a667aad137ad41f7de8877aae7
//owner: https://api.github.com/users/RamshaMohammed

public class Min {
public static void main(String[] args) {
int[] arr = {12,3,7,19,8};
int[] r = Min(arr);
System.out.println("Min1: " + r[0]);
System.out.println("Min2: " + r[1]);
}

public static int[] Min(int[] arr) {
int min1 = Integer.MAX_VALUE;
int min2 = Integer.MAX_VALUE;

for (int i = 0; i < arr.length; i++) {
if (arr[i] < min1) {
min2 = min1;
min1 = arr[i];
} else if (arr[i] < min2) {
min2 = arr[i];
}
}
return new int[]{min1,min2};
}
}
Loading

0 comments on commit 50b08db

Please sign in to comment.