├── #130 Countdown timer ├── clock.jpg ├── counttimer.css ├── counttimer.html └── counttimer.js ├── .DS_Store ├── .github └── workflows │ └── main.yml ├── .gitignore ├── .gitmodules ├── .vscode ├── c_cpp_properties.json ├── launch.json └── settings.json ├── 153_Currency_Converter └── CurrencyConverter.html ├── Alarm Clock ├── alarm.mp3.mp3 ├── alarmclock.html └── alarmclock.js ├── BigO ├── bigo.ipynb └── bigo.py ├── Build a Responsive Card Grid ├── CardGrid.css └── CardGrid.html ├── C++ ├── 540. Single Element in a Sorted Array.cpp ├── BinarySearch.cpp ├── BinaryToDecimal.cpp ├── CircularQueue.cpp ├── DetectCycleInLinkedList.cpp ├── Factorial.cpp ├── HollowDiamond.cpp ├── House Robber.cpp ├── Intersection of Two Arrays II.cpp ├── Longest Common Prefix.cpp ├── Majority Element.cpp ├── Middle of the Linked List.cpp ├── Prims_Algorithm_MST.cpp ├── Queue.c ├── QuickSort.cpp ├── RomanToArabic.cpp ├── Segment.cpp ├── Stack_using_two_Queues.cpp ├── Valid_palindrome.cpp ├── anagram_detector.cpp ├── bubbleSort.cpp ├── consonants_and_vowels.cpp ├── defang ip address.c ├── guess_the_number.cpp ├── height.cpp ├── insertion-sort.cpp ├── insertionsort.cpp ├── joke-teller.cpp ├── knapSackProblem.cpp ├── linked_list.cpp ├── mergesort.cpp ├── morse_code_translator.cpp ├── pirorityQueue.cpp ├── postfix-evaluation.cpp ├── rabin_karp.cpp ├── radixSort.cpp ├── selectionSort.cpp ├── sieveOfEratosthenes.cpp ├── sortStackDesc.cpp ├── stack.cpp ├── subsequence.cpp ├── tribonaacci_using_DP.cpp ├── two_array_equal_or_not.cpp └── valid_paranthesis_problem.cpp ├── C ├── DDA.c ├── arthmatic.cpp ├── binarysearch.c ├── bubbleSort.c ├── calculator.c ├── celsiustofahrenhiet.c ├── cliCalculator.c ├── factorial.c ├── fibonacci.c ├── goldbach_conjecture.c ├── insertion-sort.c ├── knapSackProblem.c ├── leap-year.c ├── linearsearch.c ├── mergesort.c ├── odd-even.c ├── rockPaperScissorsGame.c ├── string-palindrome.c ├── tic_tac_toe.c └── webserver.c ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── Character Occurences └── count_char_occurences.java ├── Chat_with_pdf └── Gemini_ChatMultipdf.ipynb ├── Command-Line Quiz Application ├── questions.json └── quiz_app.py ├── Course-Builder ├── .gitignore ├── README.md ├── package-lock.json ├── package.json ├── public │ ├── Web.png │ ├── favicon.ico │ ├── index.html │ ├── logo192.png │ ├── logo512.png │ ├── manifest.json │ ├── pdf-icons.png │ └── robots.txt ├── src │ ├── App.css │ ├── App.js │ ├── App.test.js │ ├── Components │ │ ├── AddModule │ │ │ ├── AddModule.js │ │ │ └── Modal.js │ │ ├── Header │ │ │ └── index.js │ │ ├── ListContainers │ │ │ ├── ModulesContainer │ │ │ │ └── index.js │ │ │ └── ResourcesContainer │ │ │ │ └── index.js │ │ ├── Modals │ │ │ └── PrimaryModal │ │ │ │ └── index.js │ │ ├── NotFound │ │ │ └── index.js │ │ └── utils │ │ │ └── index.js │ ├── Layouts │ │ └── PrimaryLayout │ │ │ └── index.js │ ├── Pages │ │ └── CourseBuilder.js │ ├── Providers │ │ └── DataProvider │ │ │ └── index.js │ ├── index.css │ ├── index.js │ ├── logo.svg │ ├── reportWebVitals.js │ └── setupTests.js └── tailwind.config.js ├── DakrModeToggle ├── index.html ├── script.js └── styles.css ├── Dice Game Challenge ├── images │ ├── dice1.png │ ├── dice2.png │ ├── dice3.png │ ├── dice4.png │ ├── dice5.png │ └── dice6.png ├── index.html ├── index.js └── styles.css ├── Different-Time-Zones ├── index.html ├── script.js └── style.html ├── DiwaliSalesAnalysis ├── Diwali Sales Data.csv ├── DiwaliSalesAnalysis.ipynb └── DiwaliSalesAnalysis.py ├── Dropdown Menu Page └── index.html ├── Drum Kit ├── images │ ├── crash.png │ ├── kick.png │ ├── snare.png │ ├── tom1.png │ ├── tom2.png │ ├── tom3.png │ └── tom4.png ├── index.html ├── index.js ├── sounds │ ├── crash.mp3 │ ├── kick-bass.mp3 │ ├── snare.mp3 │ ├── tom-1.mp3 │ ├── tom-2.mp3 │ ├── tom-3.mp3 │ └── tom-4.mp3 └── styles.css ├── FizzBuzz ├── FizzBuzz.c ├── FizzBuzz.cpp ├── FizzBuzz.js ├── FizzBuzz.ts ├── fizzbuzz.py └── output │ └── FizzBuzz.exe ├── Form Validation ├── index.html ├── script.js └── style.css ├── Geolocation ├── geo.html ├── geo.ts └── style.css ├── Go └── Snake Game ├── Guess States Game ├── .gitignore ├── indian_states_img.gif ├── main.py └── states.csv ├── Image Carousel ├── index.html ├── script.js └── styles.css ├── Image Gallery ├── images │ ├── back.png │ ├── image-1.png │ ├── image-2.png │ ├── image-3.png │ ├── image-4.png │ ├── image-5.png │ ├── image-6.png │ └── next.png ├── index.html └── styles.css ├── Javascript ├── AnagramDetector.js ├── BasicPyramid.js ├── HollowSquare.js ├── KnapsackProblem.js ├── NumberBase_Converter.js ├── bfs.js ├── bubble-sort.js ├── convert_units.js ├── dfs.js ├── fibonacci_prime_numbers.js ├── guessingGame.js ├── linked-list.js ├── longest_common_subsequence.js ├── max-subarray-sum.js ├── remove_duplicates.js ├── reverse_string.js └── total_voewl_count.js ├── Memory ├── app.js ├── index.html └── style.css ├── Mineral Processing Technology-Image Analytics ├── README.md ├── code.py ├── input │ ├── img1.png │ ├── img2.png │ ├── img3.png │ ├── img4.png │ └── img5.png └── output │ ├── img1.png │ ├── img2.png │ ├── img3.png │ ├── img4.png │ └── img5.png ├── Music_Player ├── README.md ├── assets │ ├── css │ │ └── style.css │ ├── images │ │ ├── Avengers.webp │ │ ├── deadpool.webp │ │ ├── guardians_of_the_galaxy.webp │ │ ├── ironman.webp │ │ ├── rocket_racoon.webp │ │ ├── spiderman_NWH.webp │ │ ├── starlord.webp │ │ └── tasm_spiderman.webp │ ├── js │ │ └── app.js │ └── music │ │ ├── AC-DC-Back-in-black-djlunatique.com.mp3 │ │ ├── Binks Sake - One Piece _ Yo Ho Ho _ Violin _ Anime Ringtone......mp3 │ │ ├── Deadpool Opening.mp3 │ │ ├── Guardians Of The Galaxy Vol. 3 Song _ To The Sky _ [Rocket Raccoon Song].mp3 │ │ ├── Guardians of the Galaxy vol. 3 - Dog Days Are Over.mp3 │ │ ├── Michael Giacchino - Theme (from Spider Man Original Television Series) _ Spider-Man_ No Way Home OST.mp3 │ │ ├── Redbone - Come And Get Your Love (Lyrics) [Guardians Of The Galaxy].mp3 │ │ ├── The Amazing Spider-Man 2 - Gone, Gone, Gone (HD) By Phillip Phillips.mp3 │ │ └── The Avengers Ringtone.mp3 └── index.html ├── PHP ├── CarsListPanel │ ├── Add.php │ ├── AddCars.php │ ├── Delete.php │ ├── Images │ │ ├── i1.jfif │ │ ├── i1.png │ │ ├── i2.png │ │ ├── i3.png │ │ ├── i4.png │ │ └── i5.png │ ├── Logout.php │ ├── Update.php │ ├── UpdateCars.php │ ├── View.php │ ├── aa-error-check.php │ ├── index.php │ ├── login.php │ ├── pdo.php │ └── usersView.php ├── MathBasicOperations │ └── index.php └── Universal Time │ └── index.php ├── Progress Bar ├── index.html ├── script.js └── style.css ├── Python ├── 0-1-Knapsack.py ├── 3d_pose_estimation │ ├── 3d_pose_estimation.py │ └── README.md ├── Blackjack game.py ├── Calculator.py ├── Calender.py ├── DigitalClock.py ├── Elastic_Net_Regression_Implementation_From_Scratch.py ├── GuassElimination.py ├── Image_Viewer │ ├── Imager-viewer.png │ ├── README.md │ ├── app.py │ ├── pic.png │ ├── requirements.txt │ └── templates │ │ └── index.html ├── L2_regularization_Implementation_from_scratch.py ├── Linear_Regression_Implementation_From_Scratch.py ├── LinkedList.py ├── LongestPalindromicSubstring.py ├── Magic_Square.py ├── QueuesUsingStacks.py ├── Recipefinder.py ├── Strong_number_range.py ├── Tetris │ └── tetris.py ├── Typing_Game │ ├── README.md │ └── typing.py ├── Weather_forecasting.py ├── aiProdDev.py ├── anagram_detector.py ├── analyze_string.py ├── bank.py ├── binaryarray.py ├── calculate_BMI.py ├── car_logo_classification.py ├── cartographic_conversion_lambert.py ├── contact.py ├── continent_quiz.py ├── convert_decimal_to_binart.py ├── count_number_of_words.py ├── diamondPattern.py ├── emailwrapper │ ├── __init__.py │ ├── async_email_util.py │ ├── email_util.py │ ├── render_template.py │ └── tempclean.py ├── factorial.py ├── fibonacci.py ├── fibonnaci_sequence.py ├── find_second_largest_element_array.py ├── findingDuplicates.py ├── fizzbuzz │ └── fizzbuzz.py ├── generate_and_solve_maze.py ├── handwriting.py ├── hangmanGame │ └── hangman.py ├── helloworld.py ├── isArmstrong.py ├── knapSackProblem.py ├── lcs.py ├── leapyear.py ├── limericks.py ├── mrkdwn.py ├── num_bases.py ├── number_guessing_game.py ├── pal.py ├── pong game.py ├── prime numbers.py ├── queue.py ├── randomPasswardGenerator ├── removeDuplicate.py ├── reverse_linked_list.py ├── romanToArabic.py ├── search_and_replace.py ├── sentense_similarity.py ├── shellSort.py ├── simplePasswordGenerator.py ├── simple_paint_program.py ├── simulation.py ├── squaresum.py ├── stack.py ├── sudokuSolver.py ├── tic-tac-toe.py ├── todo.py ├── tree-sort.py ├── two-sum.py ├── url.shortener.py ├── url_shortener.py ├── wallet_poo └── web_scrapper.py ├── README.md ├── Random Forest Classifier ├── RandomForest.py ├── banks.csv ├── politics.csv └── tennis.csv ├── React_calculator ├── .eslintrc.cjs ├── .gitignore ├── README.md ├── index.html ├── package-lock.json ├── package.json ├── public │ └── vite.svg ├── src │ ├── App.css │ ├── App.jsx │ ├── assets │ │ └── react.svg │ └── main.jsx └── vite.config.js ├── RotatingCard3d └── rotating-card-3d │ ├── .gitignore │ ├── README.md │ ├── package-lock.json │ ├── package.json │ ├── public │ ├── favicon.ico │ ├── index.html │ ├── logo192.png │ ├── logo512.png │ ├── manifest.json │ └── robots.txt │ └── src │ ├── App.css │ ├── App.js │ ├── App.test.js │ ├── Card3D.js │ ├── index.css │ ├── index.js │ ├── logo.svg │ ├── reportWebVitals.js │ ├── setupTests.js │ └── styles.css ├── Scientific Calculator ├── Calc.js ├── Sci_Calc.html ├── favicon.png └── styles.css ├── Searching_Algorithms ├── C │ ├── binarySearch.c │ └── linearSearch.c └── Python │ ├── binary_search.py │ ├── interpolation_search.py │ └── linearSearch.py ├── Shell Script ├── ShellScript.sh ├── backup.sh ├── check_FilePermission.sh ├── copyFile.sh ├── dbBackup.sh ├── dirSize.sh ├── fizzBuzz │ └── fizzBuzz.sh ├── makexe.sh ├── pwdgen.sh ├── reverseargu.sh ├── shellscript.sh └── systemMonitoring.sh ├── Ships-On-Fire ├── README.md ├── Ship.log └── src │ └── SHIPS_ON_FIRE.py ├── Simon Game ├── index.js └── style.css ├── Simple Calculator ├── index.html ├── script.js └── style.css ├── Simple Clock ├── index.html ├── script.js └── style.css ├── Simple Quote Generator ├── index.html ├── script.js └── style.css ├── Snake Game ├── snake.css ├── snake.html └── snake.js ├── Snake ├── Snake.py └── resources │ ├── apple.jpg │ ├── background.jpg │ ├── bg_music_1.mp3 │ ├── block.jpg │ ├── crash.mp3 │ └── ding.mp3 ├── Sorting_Algorithms ├── C++ │ ├── bubbleSort.cpp │ ├── heapSort.cpp │ ├── insertionSort.cpp │ ├── quickSort.cpp │ ├── selectionSort.cpp │ └── shellSort.cpp └── Python │ ├── bubbleSort.py │ ├── heapSort.py │ ├── insertionSort.py │ └── mergeSort.py ├── Stop Watch ├── index.html ├── script.js └── style.css ├── TodoJs ├── todojs.html └── todojs.js ├── TypeScript ├── BinarySearchWithQuickSort.ts ├── MatrixMultiplication.ts ├── SecondSmallestNumber.ts ├── SudokuSolver.ts ├── TypeScript_Searching_and_Sorting .ts ├── cryptoGraphicHash.ts ├── jsonValidator.ts ├── matrixMultiplication.ts ├── secondSmallest.ts └── sorting_strings_array.ts ├── Weather(Responsive Web App) ├── index.html └── index.js ├── Whac-a-mole ├── bush.png ├── index.html ├── mole.png ├── script.js └── style.css ├── Whack a Mole Game ├── index.html ├── index.js └── style.css ├── animated loading spinner ├── RONALDO2.jpg └── spinner.html ├── blog#249 ├── .vscode │ └── settings.json ├── allpost.css ├── allpost.html ├── article.css ├── article.html ├── bg.png ├── index.html ├── mobile.css ├── profile.css ├── profile.html ├── style.css ├── write.css └── write.html ├── brick breaker game ├── index.html ├── index.js └── style.css ├── calendar ├── index.html ├── index.js └── style.css ├── contact page └── contact.html ├── digitrecognizer.ipynb ├── employee-turnover-prediction ├── etp.csv └── etp.ipynb ├── guess-the-number-game ├── index.html ├── script.js └── styles.css ├── java ├── AStarAlgorithm ├── ATM.class ├── ATM.java ├── BinarySeacrh.java ├── BubbleSort.java ├── ButterflyPattern.java ├── Celsius_to_Fahrenheit.java ├── HollowDiamond.java ├── InversionCount.java ├── JaggedArray.java ├── LinearSearch.java ├── Matrix_Multiplication.java ├── NKnightsSolver.class ├── NKnightsSolver.java ├── NQueens.java ├── OrderAgnosticBinarySearch.java ├── StringHasVowel.java ├── String_atoi.java ├── Tetris.java ├── Todolist.java ├── anagram_detector.java ├── binary_to_decimal.java ├── bubble-sort.java ├── circualarqueue.java ├── count_char_occurences.java ├── fizzbuzz │ └── FizzBuzz.java ├── knapsackProblem.java ├── odd-even.java ├── program_median.java ├── program_quadratic_eqn.java └── stockbuyproblem.java ├── loginBox ├── index.html ├── muhammad-nafay-by-muhammad-nafay-deer-and-the-fireflies-fant.jpg ├── script.js └── style.css ├── lorem_ipsum_generator ├── README.md ├── index.html ├── script.js └── style.css ├── responsive nav bar ├── nav.css ├── nav.html └── nav.js ├── rock_paper_scissors ├── index.html ├── script.js └── style.css ├── rust-minigrep ├── Cargo.lock ├── Cargo.toml ├── poem.txt └── src │ ├── lib.rs │ └── main.rs ├── simon Game ├── game.js ├── sounds │ ├── blue.mp3 │ ├── green.mp3 │ ├── red.mp3 │ ├── wrong.mp3 │ └── yellow.mp3 └── styles.css ├── snake ├── index.html ├── snake.js └── style.css ├── sync-upstream-repo └── urlShortener-TS ├── README.md ├── gulpFile.js ├── index.ts ├── jsFile └── index.js ├── package-lock.json ├── package.json └── tsconfig.json /#130 Countdown timer/clock.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simranlotey/Hacktoberfest/dd6a766af4ba6025b183471d88513c14b3357c00/#130 Countdown timer/clock.jpg -------------------------------------------------------------------------------- /#130 Countdown timer/counttimer.css: -------------------------------------------------------------------------------- 1 | *{ 2 | padding: 0; 3 | margin: 0; 4 | box-sizing: border-box; 5 | } 6 | .main{ 7 | width: 100%; 8 | height: 100vh; 9 | background: url('clock.jpg') center center; 10 | background-size: cover; 11 | } 12 | .overlay{ 13 | width: 100%; 14 | height: 100%; 15 | display: flex; 16 | flex-direction: column; 17 | background-color: rgba(0, 0, 0,0.8 ); 18 | } 19 | .title{ 20 | font-size: 2.5rem; 21 | color: azure; 22 | text-align: center; 23 | margin-top: 10px; 24 | } 25 | .col{ 26 | margin-top: 200px; 27 | width: 1000px; 28 | 29 | 30 | margin: 10px auto; 31 | display: flex; 32 | justify-content: center; 33 | 34 | color: antiquewhite; 35 | } 36 | .col div{ 37 | text-align: center; 38 | width: 250px; 39 | } 40 | input{ 41 | text-align: center; 42 | font-size: 30px; 43 | height: 50px; 44 | width: 60%; 45 | } -------------------------------------------------------------------------------- /#130 Countdown timer/counttimer.js: -------------------------------------------------------------------------------- 1 | const enddate='19 October 2023 04:33 pm'; 2 | document.getElementById('date').innerText=enddate; 3 | const inputs = document.querySelectorAll("input") 4 | 5 | 6 | function clock() { 7 | const end = new Date(enddate) 8 | const now = new Date() 9 | const diff = (end - now) / 1000; 10 | 11 | if (diff < 0) return; 12 | 13 | 14 | inputs[0].value = Math.floor(diff / 3600 / 24); 15 | inputs[1].value = Math.floor(diff / 3600) % 24; 16 | inputs[2].value = Math.floor(diff / 60) % 60; 17 | inputs[3].value = Math.floor(diff) % 60; 18 | } 19 | 20 | 21 | clock() 22 | 23 | 24 | 25 | setInterval( 26 | () => { 27 | clock() 28 | }, 29 | 1000 30 | ) -------------------------------------------------------------------------------- /.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simranlotey/Hacktoberfest/dd6a766af4ba6025b183471d88513c14b3357c00/.DS_Store -------------------------------------------------------------------------------- /.github/workflows/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Sync Forked Repo 3 | 4 | env: 5 | UPSTREAM_URL: "https://github.com/simranlotey/programs.git" 6 | WORKFLOW_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }} 7 | UPSTREAM_BRANCH: "master" 8 | DOWNSTREAM_BRANCH: "master" 9 | MERGE_ARGS: "" 10 | PUSH_ARGS: "" 11 | 12 | on: 13 | schedule: 14 | - cron: '55 23 * * *' 15 | # Allows manual workflow run (must in default branch to work) 16 | workflow_dispatch: 17 | 18 | jobs: 19 | build: 20 | runs-on: ubuntu-latest 21 | steps: 22 | - name: GitHub Sync to Upstream Repository 23 | uses: dabreadman/sync-upstream-repo@v1.2.0.b 24 | with: 25 | upstream_repo: ${{ env.UPSTREAM_URL }} 26 | upstream_branch: ${{ env.UPSTREAM_BRANCH }} 27 | downstream_branch: ${{ env.DOWNSTREAM_BRANCH }} 28 | token: ${{ env.WORKFLOW_TOKEN }} 29 | merge_args: ${{ env.MERGE_ARGS }} 30 | push_args: ${{ env.PUSH_ARGS }} 31 | 32 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "Hacktoberfest"] 2 | path = Hacktoberfest 3 | url = https://github.com/RashmitTopG/Thala-Calculator.git 4 | -------------------------------------------------------------------------------- /.vscode/c_cpp_properties.json: -------------------------------------------------------------------------------- 1 | { 2 | "configurations": [ 3 | { 4 | "name": "windows-gcc-x86", 5 | "includePath": [ 6 | "${workspaceFolder}/**" 7 | ], 8 | "compilerPath": "C:/MinGW/bin/gcc.exe", 9 | "cStandard": "${default}", 10 | "cppStandard": "${default}", 11 | "intelliSenseMode": "windows-gcc-x86", 12 | "compilerArgs": [ 13 | "" 14 | ] 15 | } 16 | ], 17 | "version": 4 18 | } -------------------------------------------------------------------------------- /.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "0.2.0", 3 | "configurations": [ 4 | { 5 | "name": "C/C++ Runner: Debug Session", 6 | "type": "cppdbg", 7 | "request": "launch", 8 | "args": [], 9 | "stopAtEntry": false, 10 | "externalConsole": true, 11 | "cwd": "c:/Users/ashajyothi/OneDrive/Desktop/programs/programs/FizzBuzz", 12 | "program": "c:/Users/ashajyothi/OneDrive/Desktop/programs/programs/FizzBuzz/build/Debug/outDebug", 13 | "MIMode": "gdb", 14 | "miDebuggerPath": "gdb", 15 | "setupCommands": [ 16 | { 17 | "description": "Enable pretty-printing for gdb", 18 | "text": "-enable-pretty-printing", 19 | "ignoreFailures": true 20 | } 21 | ] 22 | } 23 | ] 24 | } -------------------------------------------------------------------------------- /Alarm Clock/alarm.mp3.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simranlotey/Hacktoberfest/dd6a766af4ba6025b183471d88513c14b3357c00/Alarm Clock/alarm.mp3.mp3 -------------------------------------------------------------------------------- /Build a Responsive Card Grid/CardGrid.css: -------------------------------------------------------------------------------- 1 | body{ 2 | background-color: rgb(255, 251, 246); 3 | font-family: Cambria, Cochin, Georgia, Times, 'Times New Roman', serif; 4 | } 5 | .card-grid-container{ 6 | display: grid; 7 | grid-template-columns: 1fr 1fr 1fr; 8 | padding: 2rem; 9 | gap: 1rem; 10 | } 11 | 12 | .card-item{ 13 | background-color: white; 14 | z-index: 2; 15 | border-radius: 1rem; 16 | padding: 1rem 2rem; 17 | box-shadow: 0 0 1.5rem #00000008; 18 | } 19 | 20 | @media only screen and (max-width: 768px){ 21 | .card-grid-container{ 22 | grid-template-columns: 1fr 1fr; 23 | } 24 | } 25 | @media only screen and (max-width: 392px){ 26 | .card-grid-container{ 27 | grid-template-columns: 1fr; 28 | padding: 1rem; 29 | } 30 | .card-item{ 31 | padding: 1rem; 32 | } 33 | } -------------------------------------------------------------------------------- /C++/BinarySearch.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int binarySearch(const std::vector& arr, int target) { 5 | int left = 0; 6 | int right = arr.size() - 1; 7 | 8 | while (left <= right) { 9 | int mid = left + (right - left) / 2; 10 | 11 | if (arr[mid] == target) { 12 | return mid; // Target found 13 | } else if (arr[mid] < target) { 14 | left = mid + 1; // Target is in the right half 15 | } else { 16 | right = mid - 1; // Target is in the left half 17 | } 18 | } 19 | 20 | return -1; // Target not found 21 | } 22 | 23 | int main() { 24 | std::vector arr = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; 25 | int target = 7; 26 | 27 | int result = binarySearch(arr, target); 28 | 29 | if (result != -1) { 30 | std::cout << "Element " << target << " found at index " << result << std::endl; 31 | } else { 32 | std::cout << "Element " << target << " not found in the array." << std::endl; 33 | } 34 | 35 | return 0; 36 | } 37 | -------------------------------------------------------------------------------- /C++/BinaryToDecimal.cpp: -------------------------------------------------------------------------------- 1 | // convert binary to decimal 2 | 3 | #include 4 | #include 5 | 6 | using namespace std; 7 | 8 | // function prototype 9 | int convert(long long); 10 | 11 | int main() { 12 | long long n; 13 | cout << "Enter a binary number: "; 14 | cin >> n; 15 | cout << n << " in binary = " << convert(n) << " in decimal"; 16 | return 0; 17 | } 18 | 19 | // function definition 20 | int convert(long long n) { 21 | int dec = 0, i = 0, rem; 22 | 23 | while (n!=0) { 24 | rem = n % 10; 25 | n /= 10; 26 | dec += rem * pow(2, i); 27 | ++i; 28 | } 29 | 30 | return dec; 31 | } -------------------------------------------------------------------------------- /C++/Factorial.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | int main() { 5 | int n; 6 | long factorial = 1.0; 7 | 8 | cout << "Enter a positive integer: "; 9 | cin >> n; 10 | 11 | if (n < 0) 12 | cout << "Error! Factorial of a negative number doesn't exist."; 13 | else { 14 | for(int i = 1; i <= n; ++i) { 15 | factorial *= i; 16 | } 17 | cout << "Factorial of " << n << " = " << factorial; 18 | } 19 | 20 | return 0; 21 | } 22 | -------------------------------------------------------------------------------- /C++/HollowDiamond.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | int main() { 5 | int n; 6 | cout<<"Enter a number for hollow diamond pattern : "; 7 | cin >> n; 8 | 9 | // Upper half of the pattern 10 | for (int i = 1; i <= n; i++) { 11 | for (int j = n - i; j >= 0; j--) { 12 | cout << "*"; 13 | } 14 | 15 | for (int k = 2 * (i - 1); k > 0; k--) { 16 | cout << " "; 17 | } 18 | 19 | for (int l = n - i; l >= 0; l--) { 20 | cout << "*"; 21 | } 22 | cout << endl; 23 | } 24 | 25 | // Lower half of the pattern 26 | for (int i = 0; i < n; i++) { 27 | for (int j = 0; j <= i; j++) { 28 | cout << "*"; 29 | } 30 | 31 | for (int k = 2 * (n - i - 1); k > 0; k--) { 32 | cout << " "; 33 | } 34 | 35 | for (int m = 0; m <= i; m++) { 36 | cout << "*"; 37 | } 38 | cout << endl; 39 | } 40 | 41 | return 0; 42 | } 43 | -------------------------------------------------------------------------------- /C++/House Robber.cpp: -------------------------------------------------------------------------------- 1 | // Problem: You are a professional robber planning to rob houses along a street. Each house has a certain amount of money. Find the maximum amount you can rob without robbing two adjacent houses. 2 | 3 | #include 4 | #include 5 | using namespace std; 6 | 7 | int rob(vector& nums) { 8 | if (nums.empty()) return 0; // If no houses, return 0 9 | if (nums.size() == 1) return nums[0]; // If only one house, rob it 10 | 11 | int prev2 = 0; // This holds the value for two houses back 12 | int prev1 = 0; // This holds the value for the previous house 13 | 14 | for (int num : nums) { 15 | int temp = max(prev1, prev2 + num); // Max between robbing this house or skipping 16 | prev2 = prev1; // Update two steps back 17 | prev1 = temp; // Update one step back 18 | } 19 | 20 | return prev1; // Return the max money that can be robbed 21 | } 22 | 23 | int main() { 24 | vector houses = {2, 7, 9, 3, 1}; 25 | cout << "Maximum money robbed: " << rob(houses) << endl; 26 | return 0; 27 | } 28 | -------------------------------------------------------------------------------- /C++/Longest Common Prefix.cpp: -------------------------------------------------------------------------------- 1 | // Problem: Write a function to find the longest common prefix string amongst an array of strings. If there is no common prefix, return an empty string. 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | using namespace std; 8 | 9 | string longestCommonPrefix(vector& strs) { 10 | if (strs.empty()) return ""; 11 | 12 | string prefix = strs[0]; // Start with the first string as the prefix 13 | 14 | for (int i = 1; i < strs.size(); ++i) { 15 | while (strs[i].find(prefix) != 0) { // Check if the current prefix is found at the start 16 | prefix = prefix.substr(0, prefix.length() - 1); // Reduce the prefix length 17 | if (prefix.empty()) return ""; // No common prefix 18 | } 19 | } 20 | 21 | return prefix; 22 | } 23 | 24 | int main() { 25 | vector strs = {"flower", "flow", "flight"}; 26 | string result = longestCommonPrefix(strs); 27 | cout << "Longest Common Prefix: " << result << endl; 28 | return 0; 29 | } 30 | -------------------------------------------------------------------------------- /C++/RomanToArabic.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | using namespace std; 4 | 5 | int romanToArabic(string s) { 6 | unordered_map romanVals = { 7 | {'I', 1}, 8 | {'V', 5}, 9 | {'X', 10}, 10 | {'L', 50}, 11 | {'C', 100}, 12 | {'D', 500}, 13 | {'M', 1000} 14 | }; 15 | 16 | int result = 0; 17 | int prevValue = 0; 18 | 19 | for (char c : s) { 20 | int currValue = romanVals[c]; 21 | result += currValue; 22 | 23 | if (currValue > prevValue) { 24 | result -= 2 * prevValue; 25 | } 26 | 27 | prevValue = currValue; 28 | } 29 | 30 | return result; 31 | } 32 | 33 | int main() { 34 | string romanNumeral; 35 | 36 | cout << "Enter a Roman numeral: "; 37 | cin >> romanNumeral; 38 | 39 | int arabicNumeral = romanToArabic(romanNumeral); 40 | 41 | cout << "Arabic numeral equivalent: " << arabicNumeral << endl; 42 | 43 | return 0; 44 | } 45 | -------------------------------------------------------------------------------- /C++/Valid_palindrome.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | bool isPalindrome(const std::string& s) { 7 | int left = 0, right = s.size() - 1; 8 | while (left < right) { 9 | while (left < right && !std::isalnum(s[left])) { 10 | left++; 11 | } 12 | while (left < right && !std::isalnum(s[right])) { 13 | right--; 14 | } 15 | if (std::tolower(s[left]) != std::tolower(s[right])) { 16 | return false; 17 | } 18 | left++; 19 | right--; 20 | } 21 | return true; 22 | } 23 | 24 | int main() { 25 | std::string s; 26 | std::cout << "Enter a string: "; 27 | std::getline(std::cin, s); 28 | 29 | if (isPalindrome(s)) { 30 | std::cout << "The string is a palindrome." << std::endl; 31 | } else { 32 | std::cout << "The string is not a palindrome." << std::endl; 33 | } 34 | 35 | return 0; 36 | } 37 | -------------------------------------------------------------------------------- /C++/bubbleSort.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | void bubbleSort(int arr[], int n) { 5 | bool isUnsorted; 6 | do { 7 | isUnsorted = false; 8 | for (int i = 0; i < (n - 1); i++) { 9 | if (arr[i] > arr[i + 1]) { 10 | isUnsorted = true; 11 | for (; i < (n - 1); i++) { 12 | if (arr[i] > arr[i + 1]) { 13 | std::swap(arr[i], arr[i + 1]); 14 | } 15 | } 16 | } 17 | } 18 | } while (isUnsorted); 19 | } 20 | 21 | // Function to print an array 22 | void printArray(int arr[], int size) 23 | { 24 | int i; 25 | for (i = 0; i < size; i++) 26 | cout <<" "<< arr[i]; 27 | } 28 | 29 | // Driver program to test above functions 30 | int main() 31 | { 32 | int arr[] = {5, 3, 1, 9, 8, 2, 4, 7}; 33 | int N = sizeof(arr)/sizeof(arr[0]); 34 | bubbleSort(arr, N); 35 | cout <<"Sorted array: \n"; 36 | printArray(arr, N); 37 | return 0; 38 | } 39 | 40 | -------------------------------------------------------------------------------- /C++/consonants_and_vowels.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | using namespace std; 6 | 7 | bool isVowel(char c) { 8 | c = tolower(c); // Convert the character to lowercase for case insensitivity 9 | return (c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u'); 10 | } 11 | 12 | int countVowels(const string& input) { 13 | int count = 0; 14 | for (char c : input) { 15 | if (isalpha(c) && isVowel(c)) { 16 | count++; 17 | } 18 | } 19 | return count; 20 | } 21 | 22 | int countConsonants(const string& input) { 23 | int count = 0; 24 | for (char c : input) { 25 | if (isalpha(c) && !isVowel(c)) { 26 | count++; 27 | } 28 | } 29 | return count; 30 | } 31 | 32 | int main() { 33 | string input; 34 | cout << "Enter a string: "; 35 | getline(cin, input); 36 | 37 | int vowelCount = countVowels(input); 38 | int consonantCount = countConsonants(input); 39 | 40 | cout << "Vowels: " << vowelCount << endl; 41 | cout << "Consonants: " << consonantCount << endl; 42 | 43 | return 0; 44 | } 45 | -------------------------------------------------------------------------------- /C++/defang ip address.c: -------------------------------------------------------------------------------- 1 | #include 2 | void main() 3 | { 4 | char address[10]="1.2.3.4.7"; 5 | int i=0,l=0,j=0; 6 | 7 | while(address[i]!='\0') 8 | { 9 | if(*(address+i)=='.') 10 | { 11 | l++; 12 | } 13 | i++; 14 | } 15 | char *a=(char*)malloc(i+(2*l)+1); 16 | i=0; 17 | while(address[i]!='\0') 18 | { 19 | if(address[i]=='.') 20 | { 21 | a[j]='['; 22 | j++; 23 | a[j]='.'; 24 | j++; 25 | a[j]=']'; 26 | 27 | } 28 | else 29 | { 30 | a[j]=address[i]; 31 | } 32 | i++; 33 | j++; 34 | } 35 | 36 | a[j]='\0'; 37 | printf("%s",a); 38 | } 39 | -------------------------------------------------------------------------------- /C++/guess_the_number.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include // For rand() and srand() 3 | #include // For time() 4 | 5 | using namespace std; 6 | 7 | int main() { 8 | // Seed random number generator 9 | srand(static_cast(time(0))); 10 | 11 | // Generate a random number between 1 and 100 12 | int numberToGuess = rand() % 100 + 1; 13 | int playerGuess = 0; 14 | int attempts = 0; 15 | 16 | cout << "Welcome to the Guess the Number game!" << endl; 17 | cout << "I'm thinking of a number between 1 and 100." << endl; 18 | cout << "Can you guess what it is?" << endl; 19 | 20 | // Game loop 21 | while (playerGuess != numberToGuess) { 22 | cout << "Enter your guess: "; 23 | cin >> playerGuess; 24 | attempts++; 25 | 26 | if (playerGuess > numberToGuess) { 27 | cout << "Too high! Try again." << endl; 28 | } else if (playerGuess < numberToGuess) { 29 | cout << "Too low! Try again." << endl; 30 | } else { 31 | cout << "Congratulations! You've guessed the number in " << attempts << " attempts." << endl; 32 | } 33 | } 34 | 35 | return 0; 36 | } 37 | -------------------------------------------------------------------------------- /C++/height.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | class node{ 4 | public: 5 | int data; 6 | node* left; 7 | node* right; 8 | }; 9 | node* newNode(int value) 10 | { 11 | node* temp = new node; 12 | temp -> data = value; 13 | temp->left=NULL; 14 | temp->right=NULL; 15 | return temp; 16 | } 17 | int height(node* root) 18 | { 19 | if(root==NULL) 20 | return 0; 21 | else { 22 | int l = height(root->left); 23 | int r = height(root->right); 24 | 25 | if(l>r) 26 | return l+1; 27 | else 28 | return r+1; 29 | } 30 | } 31 | int main() 32 | { 33 | node* root = newNode(0); 34 | root -> left = newNode(1); 35 | root -> right = newNode(2); 36 | root -> left ->left = newNode(3); 37 | root -> left -> right = newNode(4); 38 | root -> right -> left = newNode(5); 39 | root -> right -> right = newNode(6); 40 | root -> right -> right -> left = newNode(7); 41 | 42 | int h = height(root); 43 | cout << h; 44 | return 0; 45 | } -------------------------------------------------------------------------------- /C++/insertion-sort.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | void insertionSort(int arr[], int size) 5 | { 6 | for(int step=1; step=0) 12 | { 13 | arr[j+1]=arr[j]; 14 | --j; 15 | } 16 | arr[j+1] = key; 17 | 18 | } 19 | } 20 | 21 | void printArray(int array[], int size) { 22 | for (int i = 0; i < size; i++) { 23 | cout << array[i] << " "; 24 | } 25 | cout << endl; 26 | } 27 | 28 | int main() { 29 | int data[] = {9, 5, 1, 4, 3}; 30 | int size = sizeof(data) / sizeof(data[0]); 31 | insertionSort(data, size); 32 | cout << "Sorted array in ascending order:\n"; 33 | printArray(data, size); 34 | } -------------------------------------------------------------------------------- /C++/insertionsort.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | void insertionsort(int a[],int n){ 5 | for(int i=0;i=0 && a[j]>key){ 9 | a[j+1] = a[j]; 10 | j = j-1; 11 | } 12 | a[j+1] = key; 13 | } 14 | } 15 | 16 | int main(){ 17 | int n; 18 | cout << "Enter the number of elements: " << endl; 19 | cin >> n; 20 | 21 | int a[n]; 22 | cout << "Enter the elements: " << endl; 23 | for(int i=0;i> a[i]; 25 | } 26 | 27 | cout << "The unsorted array is: " << endl; 28 | for(int i=0;i 2 | using namespace std; 3 | 4 | void selection_sort(int arr[], int n) { 5 | for (int i = 0; i < n - 1; i++) { 6 | int mini = i; 7 | for (int j = i + 1; j < n; j++) { 8 | if (arr[j] < arr[mini]) { 9 | mini = j; 10 | } 11 | } 12 | int temp = arr[mini]; 13 | arr[mini] = arr[i]; 14 | arr[i] = temp; 15 | } 16 | 17 | cout << "After selection sort: " << "\n"; 18 | for (int i = 0; i < n; i++) { 19 | cout << arr[i] << " "; 20 | } 21 | cout << "\n"; 22 | } 23 | 24 | int main() { 25 | int n; 26 | cout << "Enter the number of elements: "; 27 | cin >> n; 28 | 29 | int arr[n]; 30 | cout << "Enter the elements:\n"; 31 | for (int i = 0; i < n; i++) { 32 | cin >> arr[i]; 33 | } 34 | 35 | cout << "Before selection sort: " << "\n"; 36 | for (int i = 0; i < n; i++) { 37 | cout << arr[i] << " "; 38 | } 39 | cout << "\n"; 40 | 41 | selection_sort(arr, n); 42 | 43 | return 0; 44 | } 45 | -------------------------------------------------------------------------------- /C++/sieveOfEratosthenes.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | using namespace std; 4 | 5 | void sieveOfEratosthenes(int n) { 6 | vector isPrime(n + 1, true); 7 | 8 | for (int p = 2; p * p <= n; p++) { 9 | if (isPrime[p]) { 10 | for (int i = p * p; i <= n; i += p) { 11 | isPrime[i] = false; 12 | } 13 | } 14 | } 15 | 16 | cout << "Prime numbers up to " << n << " are: "; 17 | for (int p = 2; p <= n; p++) { 18 | if (isPrime[p]) { 19 | cout << p << " "; 20 | } 21 | } 22 | cout << endl; 23 | } 24 | 25 | int main() { 26 | int limit = 30; 27 | sieveOfEratosthenes(limit); 28 | return 0; 29 | } 30 | -------------------------------------------------------------------------------- /C++/sortStackDesc.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | void insert(stack &st, int n) 6 | { 7 | if (st.empty() || (st.top() <= n)) 8 | { 9 | st.push(n); 10 | return; 11 | } 12 | 13 | int temp = st.top(); 14 | st.pop(); 15 | 16 | insert(st, n); 17 | 18 | st.push(temp); 19 | } 20 | 21 | void sortStack(stack &st) 22 | { 23 | if (st.empty()) 24 | { 25 | return; 26 | } 27 | 28 | int t = st.top(); 29 | st.pop(); 30 | 31 | sortStack(st); 32 | 33 | insert(st, t); 34 | } 35 | 36 | void printStack(stack &s) 37 | { 38 | while (!s.empty()) 39 | { 40 | cout << s.top() << " "; 41 | s.pop(); 42 | } 43 | cout << endl; 44 | } 45 | 46 | int main() 47 | { 48 | stack st; 49 | st.push(5); 50 | st.push(-2); 51 | st.push(9); 52 | st.push(-7); 53 | st.push(3); 54 | 55 | sortStack(st); 56 | 57 | printStack(st); 58 | 59 | while (!st.empty()) 60 | { 61 | cout << "Stack Top: " << st.top() << endl; 62 | } 63 | 64 | return 0; 65 | } -------------------------------------------------------------------------------- /C++/tribonaacci_using_DP.cpp: -------------------------------------------------------------------------------- 1 | //This code will help you find the Nth number in a Tribonacci Sequence 2 | #include 3 | #include 4 | 5 | using namespace std; 6 | 7 | class Tribo { 8 | public: 9 | int calc(int n, map &memo) { 10 | if (memo.find(n) != memo.end()) { 11 | return memo[n]; 12 | } else { 13 | int sol = calc(n - 1, memo) + calc(n - 2, memo) + calc(n - 3, memo); 14 | memo[n] = sol; 15 | return sol; 16 | } 17 | } 18 | 19 | int tribonacci(int n) { 20 | map memo; 21 | memo[0] = 0; 22 | memo[1] = 1; 23 | memo[2] = 1; 24 | 25 | return calc(n, memo); 26 | } 27 | }; 28 | 29 | int main() { 30 | Tribo t; 31 | int n; 32 | cout << "Enter a number: "; 33 | cin >> n; 34 | int result = t.tribonacci(n); 35 | cout << "Tribonacci of " << n << " is: " << result << endl; 36 | return 0; 37 | } 38 | -------------------------------------------------------------------------------- /C++/two_array_equal_or_not.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | bool areArraysEqual(const int arr1[], const int arr2[], int size1, int size2) { 4 | // If the sizes of the arrays are different, they cannot be equal 5 | if (size1 != size2) { 6 | return false; 7 | } 8 | 9 | // Compare each element of the two arrays 10 | for (int i = 0; i < size1; i++) { 11 | if (arr1[i] != arr2[i]) { 12 | return false; // Arrays are not equal 13 | } 14 | } 15 | 16 | return true; // Arrays are equal 17 | } 18 | 19 | int main() { 20 | int array1[] = {1, 2, 3, 4, 5}; 21 | int array2[] = {1, 2, 3, 4, 5}; 22 | int size1 = sizeof(array1) / sizeof(array1[0]); 23 | int size2 = sizeof(array2) / sizeof(array2[0]); 24 | 25 | if (areArraysEqual(array1, array2, size1, size2)) { 26 | std::cout << "The two arrays are equal." << std::endl; 27 | } else { 28 | std::cout << "The two arrays are not equal." << std::endl; 29 | } 30 | 31 | return 0; 32 | } 33 | -------------------------------------------------------------------------------- /C++/valid_paranthesis_problem.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | bool isValid(string s) { 5 | // approach 1 - using stack 6 | int n = s.size(); 7 | stack st; 8 | if(n == 1) return false; 9 | for(int i = 0 ; i 2 | #include 3 | #include 4 | #include 5 | void main() 6 | { 7 | int gd=DETECT,gm,x1,y1,x2,y2,dx,dy,s1,s2,f=0,dpd,x,y,t,i,dpd1; 8 | clrscr(); 9 | printf("Enter start coordinates:\n"); 10 | scanf("%d%d",&x1,&y1); 11 | printf("Enter end coordinates:\n"); 12 | scanf("%d%d",&x2,&y2); 13 | initgraph(&gd,&gm,"..//BGI"); 14 | x=x1; 15 | y=y1; 16 | dx=fabs(x2-x1); 17 | dy=fabs(y2-y1); 18 | putpixel(x1,y1,10); 19 | if(x2-x1<0) 20 | s1=-1; 21 | else if((x2-x1)>0) 22 | s1=1; 23 | else 24 | s1=0; 25 | if(y2-y1<0) 26 | s2=-1; 27 | else if(y2-y1>0) 28 | s2=1; 29 | else 30 | s2=0; 31 | dpd=(2*dy)-dx; 32 | dpd1=dpd; 33 | if(dy>dx) 34 | { 35 | f=1; 36 | t=dy; 37 | dy=dx; 38 | dx=t; 39 | } 40 | for(i=0;i<=dx;i++) 41 | { 42 | if(dpd1<0) 43 | { 44 | if(f==0) 45 | { 46 | y=y; 47 | x=x+s1; 48 | } 49 | else{ 50 | x=x; 51 | y+=s2; 52 | } 53 | dpd1=dpd1+(2*dy);} 54 | else{ 55 | x+=s1; 56 | y+=s2; 57 | dpd1+=2*dy-2*dx; 58 | } 59 | putpixel(x,y,WHITE); 60 | } 61 | getch(); 62 | closegraph(); 63 | } 64 | -------------------------------------------------------------------------------- /C/arthmatic.cpp: -------------------------------------------------------------------------------- 1 | // Working of arithmetic operators 2 | #include 3 | int main() 4 | { 5 | int a = 9,b = 4, c; 6 | 7 | c = a+b; 8 | printf("a+b = %d \n",c); 9 | c = a-b; 10 | printf("a-b = %d \n",c); 11 | c = a*b; 12 | printf("a*b = %d \n",c); 13 | c = a/b; 14 | printf("a/b = %d \n",c); 15 | c = a%b; 16 | printf("Remainder when a divided by b = %d \n",c); 17 | 18 | return 0; 19 | } 20 | -------------------------------------------------------------------------------- /C/binarysearch.c: -------------------------------------------------------------------------------- 1 | #include 2 | int main() 3 | { 4 | int c, first, last, middle, n, search, array[100]; 5 | 6 | printf("Enter number of elements\n"); 7 | scanf("%d", &n); 8 | 9 | printf("Enter %d integers\n", n); 10 | 11 | for (c = 0; c < n; c++) 12 | scanf("%d", &array[c]); 13 | 14 | printf("Enter value to find\n"); 15 | scanf("%d", &search); 16 | 17 | first = 0; 18 | last = n - 1; 19 | middle = (first+last)/2; 20 | 21 | while (first <= last) { 22 | if (array[middle] < search) 23 | first = middle + 1; 24 | else if (array[middle] == search) { 25 | printf("%d found at location %d.\n", search, middle+1); 26 | break; 27 | } 28 | else 29 | last = middle - 1; 30 | 31 | middle = (first + last)/2; 32 | } 33 | if (first > last) 34 | printf("Not found! %d isn't present in the list.\n", search); 35 | 36 | return 0; 37 | } -------------------------------------------------------------------------------- /C/bubbleSort.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | void swap(int* xp, int* yp) 5 | { 6 | int temp = *xp; 7 | *xp = *yp; 8 | *yp = temp; 9 | } 10 | 11 | void bubbleSort(int arr[], int n) 12 | { 13 | int i, j; 14 | bool swapped; 15 | for (i = 0; i < n - 1; i++) { 16 | swapped = false; 17 | for (j = 0; j < n - i - 1; j++) { 18 | if (arr[j] > arr[j + 1]) { 19 | swap(&arr[j], &arr[j + 1]); 20 | swapped = true; 21 | } 22 | } 23 | 24 | // If no two elements were swapped by inner loop, 25 | // then break 26 | if (swapped == false) 27 | break; 28 | } 29 | } 30 | 31 | // Function to print an array 32 | void printArray(int arr[], int size) 33 | { 34 | int i; 35 | for (i = 0; i < size; i++) 36 | printf("%d ", arr[i]); 37 | } 38 | 39 | // Driver program to test above functions 40 | int main() 41 | { 42 | int arr[] = { 64, 34, 25, 12, 22, 11, 90 }; 43 | int n = sizeof(arr) / sizeof(arr[0]); 44 | bubbleSort(arr, n); 45 | printf("Sorted array: \n"); 46 | printArray(arr, n); 47 | return 0; 48 | } 49 | -------------------------------------------------------------------------------- /C/calculator.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() { 4 | char operator; 5 | double num1, num2; 6 | 7 | printf("Enter an operator (+, -, *, /): "); 8 | scanf(" %c", &operator); 9 | 10 | printf("Enter two numbers: "); 11 | scanf("%lf %lf", &num1, &num2); 12 | 13 | switch (operator) { 14 | case '+': 15 | printf("%.2lf + %.2lf = %.2lf\n", num1, num2, num1 + num2); 16 | break; 17 | case '-': 18 | printf("%.2lf - %.2lf = %.2lf\n", num1, num2, num1 - num2); 19 | break; 20 | case '*': 21 | printf("%.2lf * %.2lf = %.2lf\n", num1, num2, num1 * num2); 22 | break; 23 | case '/': 24 | if (num2 != 0) 25 | printf("%.2lf / %.2lf = %.2lf\n", num1, num2, num1 / num2); 26 | else 27 | printf("Division by zero is not allowed.\n"); 28 | break; 29 | default: 30 | printf("Invalid operator\n"); 31 | } 32 | return 0; 33 | } -------------------------------------------------------------------------------- /C/celsiustofahrenhiet.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() { 4 | float celsius, fahrenheit; 5 | 6 | // Prompt the user for input 7 | printf("Enter temperature in Celsius: "); 8 | scanf("%f", &celsius); 9 | 10 | // Convert Celsius to Fahrenheit 11 | fahrenheit = (celsius * 9 / 5) + 32; 12 | 13 | // Display the result 14 | printf("%.2f degrees Celsius is equal to %.2f degrees Fahrenheit\n", celsius, fahrenheit); 15 | 16 | return 0; 17 | } -------------------------------------------------------------------------------- /C/factorial.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() { 4 | int num, factorial = 1; 5 | 6 | printf("Enter a number: "); 7 | scanf("%d", &num); 8 | 9 | for (int i = 1; i <= num; i++) { 10 | factorial *= i; 11 | } 12 | 13 | printf("Factorial: %d\n", factorial); 14 | 15 | return 0; 16 | } 17 | -------------------------------------------------------------------------------- /C/fibonacci.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() { 4 | int n = 10; 5 | int a = 0, b = 1, next; 6 | 7 | printf("Fibonacci Series: "); 8 | 9 | for (int i = 1; i <= n; i++) { 10 | printf("%d, ", a); 11 | next = a + b; 12 | a = b; 13 | b = next; 14 | } 15 | 16 | printf("\n"); 17 | return 0; 18 | } 19 | -------------------------------------------------------------------------------- /C/goldbach_conjecture.c: -------------------------------------------------------------------------------- 1 | 2 | 3 | #include 4 | 5 | int main() 6 | { 7 | unsigned long long int n,flag,q,jj,flag2,i,j; 8 | scanf("%llu",&n); 9 | if (n<=2||n%2!=0){ 10 | printf("Wrong Input"); 11 | } 12 | else{ 13 | for(i=2;i<=n;i++){ 14 | flag=1; 15 | for (j=2;j 2 | 3 | void insertionSort(int arr[], int n) { 4 | for (int i = 1; i < n; i++) { 5 | int key = arr[i]; 6 | int j = i - 1; 7 | 8 | while (j >= 0 && arr[j] > key) { 9 | arr[j + 1] = arr[j]; 10 | j--; 11 | } 12 | arr[j + 1] = key; 13 | } 14 | } 15 | 16 | void printArr(int arr[], int sz) { 17 | for (int i = 0; i < sz; i++) 18 | printf("%d ", arr[i]); 19 | } 20 | 21 | int main() { 22 | int arr[] = {29, 10, 14, 37, 13}; 23 | int n = sizeof(arr) / sizeof(arr[0]); 24 | insertionSort(arr, n); 25 | printf("Sorted array:\n"); 26 | printArr(arr, n); 27 | return 0; 28 | } 29 | -------------------------------------------------------------------------------- /C/leap-year.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int isLeapYear(int year) { 4 | if ((year % 4 == 0 && year % 100 != 0) || (year % 400 == 0)) 5 | return 1; 6 | return 0; 7 | } 8 | 9 | int main() { 10 | int year = 2024; 11 | 12 | if (isLeapYear(year)) 13 | printf("%d is a leap year.\n", year); 14 | else 15 | printf("%d is not a leap year.\n", year); 16 | 17 | return 0; 18 | } -------------------------------------------------------------------------------- /C/linearsearch.c: -------------------------------------------------------------------------------- 1 | #include 2 | int main() 3 | { 4 | int array[100], search, c, n; 5 | 6 | printf("Enter number of elements in array\n"); 7 | scanf("%d", &n); 8 | 9 | printf("Enter %d integer(s)\n", n); 10 | 11 | for (c = 0; c < n; c++) 12 | scanf("%d", &array[c]); 13 | 14 | printf("Enter a number to search\n"); 15 | scanf("%d", &search); 16 | 17 | for (c = 0; c < n; c++) 18 | { 19 | if (array[c] == search) 20 | { 21 | printf("%d is present at location %d.\n", search, c+1); 22 | break; 23 | } 24 | } 25 | if (c == n) 26 | printf("%d isn't present in the array.\n", search); 27 | 28 | return 0; 29 | } -------------------------------------------------------------------------------- /C/odd-even.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() { 4 | int number; 5 | 6 | // Prompt the user for input 7 | printf("Enter an integer: "); 8 | scanf("%d", &number); 9 | 10 | // Check if the number is odd or even 11 | if (number % 2 == 0) { 12 | printf("%d is even.\n", number); 13 | } else { 14 | printf("%d is odd.\n", number); 15 | } 16 | 17 | return 0; 18 | } -------------------------------------------------------------------------------- /C/string-palindrome.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int isPalindrome(char str[]) { 5 | int len = strlen(str); 6 | for (int i = 0; i < len / 2; i++) { 7 | if (str[i] != str[len - i - 1]) 8 | return 0; 9 | } 10 | return 1; 11 | } 12 | 13 | int main() { 14 | char word[] = "radar"; 15 | if (isPalindrome(word)) 16 | printf("%s is a palindrome.\n", word); 17 | else 18 | printf("%s is not a palindrome.\n", word); 19 | return 0; 20 | } -------------------------------------------------------------------------------- /Character Occurences/count_char_occurences.java: -------------------------------------------------------------------------------- 1 | import java.util.Scanner; 2 | 3 | public class CountOccurrencesOfChar { 4 | 5 | public static void main(String[] args) { 6 | Scanner scanner = new Scanner(System.in); 7 | 8 | 9 | System.out.println("Enter a text: "); 10 | String text = scanner.nextLine(); 11 | 12 | 13 | System.out.println("Enter the character to count: "); 14 | char character = scanner.next().charAt(0); 15 | 16 | 17 | int count = 0; 18 | for (int i = 0; i < text.length(); i++) { 19 | if (text.charAt(i) == character) { 20 | count++; 21 | } 22 | } 23 | 24 | 25 | System.out.println("The number of occurrences of the character '" + character + "' in the text is: " + count); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Course-Builder/.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | /node_modules 5 | /.pnp 6 | .pnp.js 7 | 8 | # testing 9 | /coverage 10 | 11 | # production 12 | /build 13 | 14 | # misc 15 | .DS_Store 16 | .env.local 17 | .env.development.local 18 | .env.test.local 19 | .env.production.local 20 | 21 | npm-debug.log* 22 | yarn-debug.log* 23 | yarn-error.log* 24 | -------------------------------------------------------------------------------- /Course-Builder/public/Web.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simranlotey/Hacktoberfest/dd6a766af4ba6025b183471d88513c14b3357c00/Course-Builder/public/Web.png -------------------------------------------------------------------------------- /Course-Builder/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simranlotey/Hacktoberfest/dd6a766af4ba6025b183471d88513c14b3357c00/Course-Builder/public/favicon.ico -------------------------------------------------------------------------------- /Course-Builder/public/logo192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simranlotey/Hacktoberfest/dd6a766af4ba6025b183471d88513c14b3357c00/Course-Builder/public/logo192.png -------------------------------------------------------------------------------- /Course-Builder/public/logo512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simranlotey/Hacktoberfest/dd6a766af4ba6025b183471d88513c14b3357c00/Course-Builder/public/logo512.png -------------------------------------------------------------------------------- /Course-Builder/public/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "short_name": "React App", 3 | "name": "Create React App Sample", 4 | "icons": [ 5 | { 6 | "src": "favicon.ico", 7 | "sizes": "64x64 32x32 24x24 16x16", 8 | "type": "image/x-icon" 9 | }, 10 | { 11 | "src": "logo192.png", 12 | "type": "image/png", 13 | "sizes": "192x192" 14 | }, 15 | { 16 | "src": "logo512.png", 17 | "type": "image/png", 18 | "sizes": "512x512" 19 | } 20 | ], 21 | "start_url": ".", 22 | "display": "standalone", 23 | "theme_color": "#000000", 24 | "background_color": "#ffffff" 25 | } 26 | -------------------------------------------------------------------------------- /Course-Builder/public/pdf-icons.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simranlotey/Hacktoberfest/dd6a766af4ba6025b183471d88513c14b3357c00/Course-Builder/public/pdf-icons.png -------------------------------------------------------------------------------- /Course-Builder/public/robots.txt: -------------------------------------------------------------------------------- 1 | # https://www.robotstxt.org/robotstxt.html 2 | User-agent: * 3 | Disallow: 4 | -------------------------------------------------------------------------------- /Course-Builder/src/App.css: -------------------------------------------------------------------------------- 1 | .App { 2 | text-align: center; 3 | } 4 | 5 | .App-logo { 6 | height: 40vmin; 7 | pointer-events: none; 8 | } 9 | 10 | @media (prefers-reduced-motion: no-preference) { 11 | .App-logo { 12 | animation: App-logo-spin infinite 20s linear; 13 | } 14 | } 15 | 16 | .App-header { 17 | background-color: #282c34; 18 | min-height: 100vh; 19 | display: flex; 20 | flex-direction: column; 21 | align-items: center; 22 | justify-content: center; 23 | font-size: calc(10px + 2vmin); 24 | color: white; 25 | } 26 | 27 | .App-link { 28 | color: #61dafb; 29 | } 30 | 31 | @keyframes App-logo-spin { 32 | from { 33 | transform: rotate(0deg); 34 | } 35 | to { 36 | transform: rotate(360deg); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /Course-Builder/src/App.js: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import CourseBuilder from "./Pages/CourseBuilder"; 3 | import DataProvider from "./Providers/DataProvider"; 4 | import PrimaryLayout from "./Layouts/PrimaryLayout"; 5 | 6 | function App() { 7 | return ( 8 |
9 | 10 | 11 | 12 | 13 | 14 |
15 | ); 16 | } 17 | 18 | export default App; 19 | -------------------------------------------------------------------------------- /Course-Builder/src/App.test.js: -------------------------------------------------------------------------------- 1 | import { render, screen } from '@testing-library/react'; 2 | import App from './App'; 3 | 4 | test('renders learn react link', () => { 5 | render(); 6 | const linkElement = screen.getByText(/learn react/i); 7 | expect(linkElement).toBeInTheDocument(); 8 | }); 9 | -------------------------------------------------------------------------------- /Course-Builder/src/Components/AddModule/Modal.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { FaTimes } from 'react-icons/fa'; 3 | 4 | const Modal = ({ onClose, children }) => { 5 | return ( 6 | <> 7 | {/* Dark Grey Overlay */} 8 |
9 | 10 | {/* Modal Content */} 11 |
12 |
13 | 19 | {children} 20 |
21 |
22 | 23 | ); 24 | }; 25 | 26 | export default Modal; 27 | -------------------------------------------------------------------------------- /Course-Builder/src/Components/Header/index.js: -------------------------------------------------------------------------------- 1 | import React, { useContext } from 'react' 2 | import AddModule from '../AddModule/AddModule' 3 | import { dataContext } from '../../Providers/DataProvider'; 4 | 5 | const Header = () => { 6 | const {addModule, handleAddResource, handleAddLink} = useContext(dataContext); 7 | 8 | return ( 9 |
10 |

Course Builder

11 | 16 |
17 | ) 18 | } 19 | 20 | export default Header -------------------------------------------------------------------------------- /Course-Builder/src/Components/NotFound/index.js: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | 3 | const NotFound = () => { 4 | return ( 5 |
6 | No Content 7 |
8 | ) 9 | } 10 | 11 | export default NotFound -------------------------------------------------------------------------------- /Course-Builder/src/Components/utils/index.js: -------------------------------------------------------------------------------- 1 | import { BsFileEarmarkPdf } from "react-icons/bs"; 2 | import { CiImageOn } from "react-icons/ci"; 3 | 4 | export const getIconForFileType = (fileName) => { 5 | if (fileName.endsWith(".pdf")) { 6 | return ; 7 | } 8 | if (fileName.endsWith(".jpg") || fileName.endsWith(".jpeg") || fileName.endsWith(".png")) { 9 | return ; 10 | } 11 | return null; 12 | }; -------------------------------------------------------------------------------- /Course-Builder/src/Layouts/PrimaryLayout/index.js: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | import Header from '../../Components/Header' 3 | 4 | const PrimaryLayout = ({children}) => { 5 | return ( 6 |
7 |
8 |
9 | {children} 10 |
11 |
12 | ) 13 | } 14 | 15 | export default PrimaryLayout -------------------------------------------------------------------------------- /Course-Builder/src/Pages/CourseBuilder.js: -------------------------------------------------------------------------------- 1 | import React, { useContext } from "react"; 2 | import { DragDropContext } from "react-beautiful-dnd"; 3 | import { dataContext } from "../Providers/DataProvider"; 4 | import NotFound from "../Components/NotFound"; 5 | import ResourceContainer from "../Components/ListContainers/ResourcesContainer"; 6 | import ModulesContainer from "../Components/ListContainers/ModulesContainer"; 7 | 8 | const CourseBuilder = () => { 9 | const {onDragEnd, resources, modules} = useContext(dataContext); 10 | 11 | const hasContent = modules.length > 0 || resources.length > 0; 12 | 13 | return ( 14 |
15 | {!hasContent ? ( 16 | 17 | ) : ( 18 | <> 19 | 20 | 21 | 22 | 23 | 24 | )} 25 |
26 | ); 27 | }; 28 | 29 | export default CourseBuilder; 30 | -------------------------------------------------------------------------------- /Course-Builder/src/index.css: -------------------------------------------------------------------------------- 1 | @tailwind base; 2 | @tailwind components; 3 | @tailwind utilities; 4 | 5 | body { 6 | margin: 0; 7 | font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 8 | 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', 9 | sans-serif; 10 | -webkit-font-smoothing: antialiased; 11 | -moz-osx-font-smoothing: grayscale; 12 | } 13 | 14 | code { 15 | font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New', 16 | monospace; 17 | } 18 | -------------------------------------------------------------------------------- /Course-Builder/src/index.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import ReactDOM from 'react-dom/client'; 3 | import './index.css'; 4 | import App from './App'; 5 | 6 | const root = ReactDOM.createRoot(document.getElementById('root')); 7 | root.render(); 8 | 9 | -------------------------------------------------------------------------------- /Course-Builder/src/reportWebVitals.js: -------------------------------------------------------------------------------- 1 | const reportWebVitals = onPerfEntry => { 2 | if (onPerfEntry && onPerfEntry instanceof Function) { 3 | import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => { 4 | getCLS(onPerfEntry); 5 | getFID(onPerfEntry); 6 | getFCP(onPerfEntry); 7 | getLCP(onPerfEntry); 8 | getTTFB(onPerfEntry); 9 | }); 10 | } 11 | }; 12 | 13 | export default reportWebVitals; 14 | -------------------------------------------------------------------------------- /Course-Builder/src/setupTests.js: -------------------------------------------------------------------------------- 1 | // jest-dom adds custom jest matchers for asserting on DOM nodes. 2 | // allows you to do things like: 3 | // expect(element).toHaveTextContent(/react/i) 4 | // learn more: https://github.com/testing-library/jest-dom 5 | import '@testing-library/jest-dom'; 6 | -------------------------------------------------------------------------------- /Course-Builder/tailwind.config.js: -------------------------------------------------------------------------------- 1 | /** @type {import('tailwindcss').Config} */ 2 | module.exports = { 3 | content: [ 4 | "./src/**/*.{js,jsx,ts,tsx}", 5 | ], 6 | theme: { 7 | extend: {}, 8 | }, 9 | plugins: [], 10 | } -------------------------------------------------------------------------------- /DakrModeToggle/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Dark Mode Toggle 8 | 9 | 10 |
11 |

Dark Mode Toggle Example

12 | 16 |

This is a simple example of a dark mode toggle switch.

17 |
18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /DakrModeToggle/script.js: -------------------------------------------------------------------------------- 1 | const toggleSwitch = document.getElementById('toggle'); 2 | 3 | toggleSwitch.addEventListener('change', () => { 4 | document.body.classList.toggle('dark-mode', toggleSwitch.checked); 5 | document.body.classList.toggle('light-mode', !toggleSwitch.checked); 6 | }); 7 | 8 | // Optional: Set default mode based on system preference 9 | if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) { 10 | toggleSwitch.checked = true; 11 | document.body.classList.add('dark-mode'); 12 | } 13 | -------------------------------------------------------------------------------- /Dice Game Challenge/images/dice1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simranlotey/Hacktoberfest/dd6a766af4ba6025b183471d88513c14b3357c00/Dice Game Challenge/images/dice1.png -------------------------------------------------------------------------------- /Dice Game Challenge/images/dice2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simranlotey/Hacktoberfest/dd6a766af4ba6025b183471d88513c14b3357c00/Dice Game Challenge/images/dice2.png -------------------------------------------------------------------------------- /Dice Game Challenge/images/dice3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simranlotey/Hacktoberfest/dd6a766af4ba6025b183471d88513c14b3357c00/Dice Game Challenge/images/dice3.png -------------------------------------------------------------------------------- /Dice Game Challenge/images/dice4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simranlotey/Hacktoberfest/dd6a766af4ba6025b183471d88513c14b3357c00/Dice Game Challenge/images/dice4.png -------------------------------------------------------------------------------- /Dice Game Challenge/images/dice5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simranlotey/Hacktoberfest/dd6a766af4ba6025b183471d88513c14b3357c00/Dice Game Challenge/images/dice5.png -------------------------------------------------------------------------------- /Dice Game Challenge/images/dice6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simranlotey/Hacktoberfest/dd6a766af4ba6025b183471d88513c14b3357c00/Dice Game Challenge/images/dice6.png -------------------------------------------------------------------------------- /Dice Game Challenge/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Dicee 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 |

Rolling...

16 | 17 |
18 |

Player 1

19 | 20 |
21 | 22 |
23 |

Player 2

24 | 25 |
26 |
27 | 28 |
29 | 32 |
33 | 34 | 35 | 36 | 37 |
38 | https://github.com/aayush105 39 |
40 | 41 | -------------------------------------------------------------------------------- /Different-Time-Zones/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Time Zone Timer 8 | 9 | 10 |

Basic Timer for Different Time Zones

11 |
12 |
13 |

New York (EST)

14 |

15 |
16 |
17 |

London (GMT)

18 |

19 |
20 |
21 |

Tokyo (JST)

22 |

23 |
24 |
25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /Different-Time-Zones/script.js: -------------------------------------------------------------------------------- 1 | function updateClock() { 2 | const newYorkTime = new Date().toLocaleString("en-US", { 3 | timeZone: "America/New_York" 4 | }); 5 | const londonTime = new Date().toLocaleString("en-GB", { 6 | timeZone: "Europe/London" 7 | }); 8 | const tokyoTime = new Date().toLocaleString("en-JP", { 9 | timeZone: "Asia/Tokyo" 10 | }); 11 | 12 | document.getElementById("new-york-time").textContent = newYorkTime; 13 | document.getElementById("london-time").textContent = londonTime; 14 | document.getElementById("tokyo-time").textContent = tokyoTime; 15 | } 16 | 17 | updateClock(); 18 | setInterval(updateClock, 1000); 19 | -------------------------------------------------------------------------------- /Different-Time-Zones/style.html: -------------------------------------------------------------------------------- 1 | body { 2 | font-family: Arial, sans-serif; 3 | text-align: center; 4 | margin: 0; 5 | padding: 0; 6 | background-color: #f0f0f0; 7 | } 8 | 9 | .timer { 10 | display: flex; 11 | justify-content: space-around; 12 | align-items: center; 13 | margin-top: 50px; 14 | } 15 | 16 | .timezone { 17 | background-color: #fff; 18 | border: 1px solid #ccc; 19 | border-radius: 5px; 20 | padding: 20px; 21 | box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1); 22 | } 23 | 24 | h2 { 25 | margin: 0; 26 | } 27 | 28 | p { 29 | font-size: 24px; 30 | } 31 | -------------------------------------------------------------------------------- /DiwaliSalesAnalysis/Diwali Sales Data.csv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simranlotey/Hacktoberfest/dd6a766af4ba6025b183471d88513c14b3357c00/DiwaliSalesAnalysis/Diwali Sales Data.csv -------------------------------------------------------------------------------- /Drum Kit/images/crash.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simranlotey/Hacktoberfest/dd6a766af4ba6025b183471d88513c14b3357c00/Drum Kit/images/crash.png -------------------------------------------------------------------------------- /Drum Kit/images/kick.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simranlotey/Hacktoberfest/dd6a766af4ba6025b183471d88513c14b3357c00/Drum Kit/images/kick.png -------------------------------------------------------------------------------- /Drum Kit/images/snare.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simranlotey/Hacktoberfest/dd6a766af4ba6025b183471d88513c14b3357c00/Drum Kit/images/snare.png -------------------------------------------------------------------------------- /Drum Kit/images/tom1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simranlotey/Hacktoberfest/dd6a766af4ba6025b183471d88513c14b3357c00/Drum Kit/images/tom1.png -------------------------------------------------------------------------------- /Drum Kit/images/tom2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simranlotey/Hacktoberfest/dd6a766af4ba6025b183471d88513c14b3357c00/Drum Kit/images/tom2.png -------------------------------------------------------------------------------- /Drum Kit/images/tom3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simranlotey/Hacktoberfest/dd6a766af4ba6025b183471d88513c14b3357c00/Drum Kit/images/tom3.png -------------------------------------------------------------------------------- /Drum Kit/images/tom4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simranlotey/Hacktoberfest/dd6a766af4ba6025b183471d88513c14b3357c00/Drum Kit/images/tom4.png -------------------------------------------------------------------------------- /Drum Kit/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Drum Kit 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 |

Drum 🥁 Kit

16 |
17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 |
25 | 26 | 27 | 28 | 29 | 32 | 33 | -------------------------------------------------------------------------------- /Drum Kit/sounds/crash.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simranlotey/Hacktoberfest/dd6a766af4ba6025b183471d88513c14b3357c00/Drum Kit/sounds/crash.mp3 -------------------------------------------------------------------------------- /Drum Kit/sounds/kick-bass.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simranlotey/Hacktoberfest/dd6a766af4ba6025b183471d88513c14b3357c00/Drum Kit/sounds/kick-bass.mp3 -------------------------------------------------------------------------------- /Drum Kit/sounds/snare.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simranlotey/Hacktoberfest/dd6a766af4ba6025b183471d88513c14b3357c00/Drum Kit/sounds/snare.mp3 -------------------------------------------------------------------------------- /Drum Kit/sounds/tom-1.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simranlotey/Hacktoberfest/dd6a766af4ba6025b183471d88513c14b3357c00/Drum Kit/sounds/tom-1.mp3 -------------------------------------------------------------------------------- /Drum Kit/sounds/tom-2.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simranlotey/Hacktoberfest/dd6a766af4ba6025b183471d88513c14b3357c00/Drum Kit/sounds/tom-2.mp3 -------------------------------------------------------------------------------- /Drum Kit/sounds/tom-3.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simranlotey/Hacktoberfest/dd6a766af4ba6025b183471d88513c14b3357c00/Drum Kit/sounds/tom-3.mp3 -------------------------------------------------------------------------------- /Drum Kit/sounds/tom-4.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simranlotey/Hacktoberfest/dd6a766af4ba6025b183471d88513c14b3357c00/Drum Kit/sounds/tom-4.mp3 -------------------------------------------------------------------------------- /FizzBuzz/FizzBuzz.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | void FizzBuzz(int data) 4 | { 5 | for(int i = 1 ; i <= data ; i++) 6 | { 7 | if(i % 3 == 0 && i % 5 == 0 ) 8 | printf(" FizzBuzz "); 9 | else if(i % 3 == 0) 10 | printf("Fizz,"); 11 | else if( i % 5 == 0) 12 | printf("Buzz,"); 13 | else 14 | printf("%d," , i); 15 | 16 | } 17 | } 18 | int main() 19 | { 20 | int limit; 21 | printf("Enter how many FizzBuzz numbers you want to generate: "); 22 | scanf("%d" , &limit); 23 | FizzBuzz(limit); 24 | return 0; 25 | } 26 | -------------------------------------------------------------------------------- /FizzBuzz/FizzBuzz.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | void FizzBuzz(int n) 4 | { 5 | for(int i = 1; i <= n; i++) 6 | { 7 | if(i % 3 == 0 && i % 5 == 0) 8 | { 9 | std::cout << "FizzBuzz" << std::endl; 10 | }else if( i % 3 == 0) 11 | {std::cout << "Fizz" << std::endl; 12 | }else if ( i % 5 == 0) 13 | { 14 | std::cout << "Buzz" << std:: endl; 15 | }else 16 | { 17 | std::cout << i << std:: endl; 18 | } 19 | } 20 | } 21 | int main() 22 | { 23 | int n; 24 | std::cout<< "Enter a number" << std::endl; 25 | std::cin >> n; 26 | FizzBuzz(n); 27 | return 0; 28 | } -------------------------------------------------------------------------------- /FizzBuzz/FizzBuzz.js: -------------------------------------------------------------------------------- 1 | // FizzBuzz implementation in JavaScript 2 | for (let i = 1; i <= 100; i++) 3 | { 4 | if (i % 3 === 0 && i % 5 === 0) { 5 | console.log('FizzBuzz'); 6 | } else if (i % 3 === 0) { 7 | console.log('Fizz'); 8 | } else if (i % 5 === 0) { 9 | console.log('Buzz'); 10 | } else { 11 | console.log(i); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /FizzBuzz/FizzBuzz.ts: -------------------------------------------------------------------------------- 1 | function FizzBuzz(n: number): void { 2 | for (let i = 1; i <= n; i++) { 3 | if (i % 3 === 0 && i % 5 === 0) { 4 | console.log('FizzBuzz'); 5 | } else if (i % 3 === 0) { 6 | console.log('Fizz'); 7 | } else if (i % 5 === 0) { 8 | console.log('Buzz'); 9 | } else { 10 | console.log(i); 11 | } 12 | } 13 | } 14 | 15 | let n: number = 30; 16 | FizzBuzz(n); 17 | -------------------------------------------------------------------------------- /FizzBuzz/fizzbuzz.py: -------------------------------------------------------------------------------- 1 | def fizzbuzz(n): 2 | for i in range(1, n + 1): 3 | if i % 3 == 0 and i % 5 == 0: 4 | print("FizzBuzz") 5 | elif i % 3 == 0: 6 | print("Fizz") 7 | elif i % 5 == 0: 8 | print("Buzz") 9 | else: 10 | print(i) 11 | 12 | # Call the function with the desired value of n 13 | n = 100 # You can change this to any positive integer 14 | fizzbuzz(n) 15 | -------------------------------------------------------------------------------- /FizzBuzz/output/FizzBuzz.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simranlotey/Hacktoberfest/dd6a766af4ba6025b183471d88513c14b3357c00/FizzBuzz/output/FizzBuzz.exe -------------------------------------------------------------------------------- /Form Validation/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | My Form 6 | 7 | 8 | 9 | 10 |
11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /Form Validation/script.js: -------------------------------------------------------------------------------- 1 | const form = document.getElementById('myForm'); 2 | 3 | form.addEventListener('submit', function (event) { 4 | event.preventDefault(); 5 | 6 | const email = form.elements.email.value; 7 | if (!email.includes('@')) { 8 | alert('Invalid email address'); 9 | return; 10 | } 11 | 12 | // Submit the form 13 | form.submit(); 14 | }); -------------------------------------------------------------------------------- /Form Validation/style.css: -------------------------------------------------------------------------------- 1 | *{ 2 | padding: 0; 3 | margin: 0; 4 | box-sizing: border-box; 5 | } 6 | 7 | body { 8 | font-family: Arial, sans-serif; 9 | background-color: #101820; 10 | display: flex; 11 | justify-content: center; 12 | align-items: center; 13 | height: 100vh; 14 | width: 100vw; 15 | } 16 | 17 | #myForm { 18 | display: flex; 19 | flex-direction: column; 20 | width: 350px; 21 | padding: 20px; 22 | background-color: #f7f7f7; 23 | border: 1px solid #ccc; 24 | box-shadow: 5px 5px 10px rgba(0, 0, 0, 0.2); 25 | border-radius: 10px; 26 | } 27 | 28 | input[type="text"], 29 | input[type="email"], 30 | button { 31 | padding: 10px; 32 | margin-bottom: 10px; 33 | border: 1px solid #aaa; 34 | border-radius: 5px; 35 | } 36 | 37 | input[type="text"], 38 | input[type="email"] { 39 | background-color: #eee; 40 | } 41 | 42 | button { 43 | background-color: #c4a748; 44 | color: #050404; 45 | font-weight: bold; 46 | cursor: pointer; 47 | box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2); 48 | margin-bottom: 0px; 49 | } 50 | 51 | button:hover { 52 | background-color: #ff4e45; 53 | } -------------------------------------------------------------------------------- /Geolocation/geo.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Geolocation Service 6 | 7 | 8 | 9 |
10 |

Geolocation Service

11 | 12 |
13 |

Latitude: N/A, Longitude: N/A

14 |
15 |
16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /Guess States Game/.gitignore: -------------------------------------------------------------------------------- 1 | # Byte-compiled files 2 | __pycache__/ 3 | *.py[cod] 4 | *$py.class 5 | 6 | # Virtual environment directories 7 | venv/ 8 | env/ 9 | .venv/ 10 | 11 | # PyCharm specific files 12 | .idea/ 13 | *.iml 14 | 15 | # Log files 16 | *.log 17 | 18 | # Jupyter Notebook checkpoints 19 | .ipynb_checkpoints/ 20 | 21 | # System files 22 | .DS_Store 23 | Thumbs.db 24 | 25 | # Python egg files 26 | *.egg 27 | *.egg-info/ 28 | dist/ 29 | build/ 30 | eggs/ 31 | parts/ 32 | wheels/ 33 | pip-wheel-metadata/ 34 | share/python-wheels/ 35 | 36 | # Unit test / coverage reports 37 | htmlcov/ 38 | .tox/ 39 | .coverage 40 | coverage.xml 41 | *.cover 42 | .hypothesis/ 43 | 44 | # mypy 45 | .mypy_cache/ 46 | .dmypy.json 47 | dmypy.json 48 | 49 | # PyInstaller 50 | # Usually these files are written by a python script from a template 51 | # before PyInstaller builds the exe, so as to inject date/other infos into it. 52 | *.manifest 53 | *.spec 54 | 55 | # C extensions 56 | *.so 57 | -------------------------------------------------------------------------------- /Guess States Game/indian_states_img.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simranlotey/Hacktoberfest/dd6a766af4ba6025b183471d88513c14b3357c00/Guess States Game/indian_states_img.gif -------------------------------------------------------------------------------- /Guess States Game/states.csv: -------------------------------------------------------------------------------- 1 | state,x,y 2 | Andhra Pradesh,-114, -214 3 | Arunachal Pradesh,279, 141 4 | Assam,238, 84 5 | Chattisgarh,-32, -45 6 | Goa,-211, -204 7 | Gujarat,-286, -31 8 | Haryana,-160, 152 9 | Himachal Pradesh,-149, 233 10 | Jharkhand,43, 8 11 | Karnataka,-182, -219 12 | Kerala,-145, -314 13 | Madhya Pradesh,-167, -22 14 | Maharashtra,-204, -103 15 | Manipur,260, 34 16 | Meghalaya,179, 55 17 | Mizoram,240, -4 18 | Nagaland,276, 71 19 | Odisha,24, -70 20 | Punjab,-186, 196 21 | Rajasthan,-266, 83 22 | Sikkim,139, 119 23 | Tamil Nadu,-114, -306 24 | Telangana,-98, -141 25 | Tripura,215, 9 26 | Uttarakhand,-91, 185 27 | Uttar Pradesh,-87, 178 28 | West Bengal,111, -7 29 | Andaman And Nicobar Islands,248, -281 30 | Jammu And Kashmir,-199, 281 31 | Lakshadweep,-272, -314 32 | Chandigarh,-192, 184 33 | Ladak,-122, 312 34 | Puducherry,-58, -285 35 | Daman And Du,-217, -68 -------------------------------------------------------------------------------- /Image Carousel/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | Document 10 | 11 | 12 |
13 | 28 |
29 | 30 | 31 | -------------------------------------------------------------------------------- /Image Carousel/script.js: -------------------------------------------------------------------------------- 1 | const buttons = document.querySelectorAll("[data-carousel-button]") 2 | 3 | buttons.forEach(button => { 4 | button.addEventListener("click", () => { 5 | const offset = button.dataset.carouselButton === "next" ? 1 : -1 6 | const slides = button 7 | .closest("[data-carousel]") 8 | .querySelector("[data-slides]") 9 | 10 | const activeSlide = slides.querySelector("[data-active]") 11 | let newIndex = [...slides.children].indexOf(activeSlide) + offset 12 | if (newIndex < 0) newIndex = slides.children.length - 1 13 | if (newIndex >= slides.children.length) newIndex = 0 14 | 15 | slides.children[newIndex].dataset.active = true 16 | delete activeSlide.dataset.active 17 | }) 18 | }) 19 | -------------------------------------------------------------------------------- /Image Gallery/images/back.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simranlotey/Hacktoberfest/dd6a766af4ba6025b183471d88513c14b3357c00/Image Gallery/images/back.png -------------------------------------------------------------------------------- /Image Gallery/images/image-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simranlotey/Hacktoberfest/dd6a766af4ba6025b183471d88513c14b3357c00/Image Gallery/images/image-1.png -------------------------------------------------------------------------------- /Image Gallery/images/image-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simranlotey/Hacktoberfest/dd6a766af4ba6025b183471d88513c14b3357c00/Image Gallery/images/image-2.png -------------------------------------------------------------------------------- /Image Gallery/images/image-3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simranlotey/Hacktoberfest/dd6a766af4ba6025b183471d88513c14b3357c00/Image Gallery/images/image-3.png -------------------------------------------------------------------------------- /Image Gallery/images/image-4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simranlotey/Hacktoberfest/dd6a766af4ba6025b183471d88513c14b3357c00/Image Gallery/images/image-4.png -------------------------------------------------------------------------------- /Image Gallery/images/image-5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simranlotey/Hacktoberfest/dd6a766af4ba6025b183471d88513c14b3357c00/Image Gallery/images/image-5.png -------------------------------------------------------------------------------- /Image Gallery/images/image-6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simranlotey/Hacktoberfest/dd6a766af4ba6025b183471d88513c14b3357c00/Image Gallery/images/image-6.png -------------------------------------------------------------------------------- /Image Gallery/images/next.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simranlotey/Hacktoberfest/dd6a766af4ba6025b183471d88513c14b3357c00/Image Gallery/images/next.png -------------------------------------------------------------------------------- /Image Gallery/styles.css: -------------------------------------------------------------------------------- 1 | * { 2 | margin: 0; 3 | padding: 0; 4 | font-family: "Poppins", sans-serif; 5 | box-sizing: border-box; 6 | } 7 | 8 | body { 9 | background: #191919; 10 | } 11 | .gallery { 12 | width: 900px; 13 | display: flex; 14 | overflow-x: scroll; 15 | } 16 | 17 | .gallery div { 18 | display: grid; 19 | width: 100%; 20 | grid-template-columns: auto auto auto; 21 | grid-gap: 20px; 22 | padding: 10px; 23 | flex: none; 24 | } 25 | 26 | .gallery div img { 27 | width: 100%; 28 | filter: grayscale(100%); 29 | transition: transform 0.5s; 30 | } 31 | 32 | .gallery::-webkit-scrollbar { 33 | display: none; 34 | } 35 | 36 | .gallery-wrap { 37 | display: flex; 38 | align-items: center; 39 | justify-content: center; 40 | margin: 10% auto; 41 | } 42 | 43 | #backBtn, 44 | #nextBtn { 45 | width: 50px; 46 | cursor: pointer; 47 | margin: 40px; 48 | } 49 | .gallery div img:hover { 50 | filter: grayscale(0); 51 | cursor: pointer; 52 | transform: scale(1.1); 53 | } 54 | -------------------------------------------------------------------------------- /Javascript/AnagramDetector.js: -------------------------------------------------------------------------------- 1 | function areAnagrams(word1, word2) { 2 | const cleanWord1 = word1.replace(/\s/g, '').toLowerCase(); 3 | const cleanWord2 = word2.replace(/\s/g, '').toLowerCase(); 4 | 5 | if (cleanWord1.length !== cleanWord2.length) { 6 | return false; 7 | } 8 | 9 | const sortedWord1 = cleanWord1.split('').sort().join(''); 10 | const sortedWord2 = cleanWord2.split('').sort().join(''); 11 | 12 | return sortedWord1 === sortedWord2; 13 | } 14 | 15 | const word1 = "listen"; 16 | const word2 = "silent"; 17 | 18 | if (areAnagrams(word1, word2)) { 19 | console.log(`${word1} and ${word2} are anagrams.`); 20 | } else { 21 | console.log(`${word1} and ${word2} are not anagrams.`); 22 | } 23 | -------------------------------------------------------------------------------- /Javascript/BasicPyramid.js: -------------------------------------------------------------------------------- 1 | function createPyramid(rows) { 2 | for (let i = 1; i <= rows; i++) { 3 | let output = ''; 4 | 5 | // Add spaces before the stars 6 | for (let j = 1; j <= rows - i; j++) { 7 | output += ' '; 8 | } 9 | 10 | // Add stars 11 | for (let k = 1; k <= 2 * i - 1; k++) { 12 | output += '*'; 13 | } 14 | 15 | console.log(output); 16 | } 17 | } 18 | 19 | // Call the function with the number of rows you want in the pyramid 20 | createPyramid(5); 21 | -------------------------------------------------------------------------------- /Javascript/HollowSquare.js: -------------------------------------------------------------------------------- 1 | let n = 5; // row or column count 2 | // defining an empty string 3 | let string = ""; 4 | 5 | for(let i = 0; i < n; i++) { // external loop 6 | for(let j = 0; j < n; j++) { // internal loop 7 | if(i === 0 || i === n - 1) { 8 | string += "*"; 9 | } 10 | else { 11 | if(j === 0 || j === n - 1) { 12 | string += "*"; 13 | } 14 | else { 15 | string += " "; 16 | } 17 | } 18 | } 19 | // newline after each row 20 | string += "\n"; 21 | } 22 | // printing the string 23 | console.log(string); -------------------------------------------------------------------------------- /Javascript/NumberBase_Converter.js: -------------------------------------------------------------------------------- 1 | const readline = require('readline'); 2 | 3 | // Create a readline interface 4 | const rl = readline.createInterface({ 5 | input: process.stdin, 6 | output: process.stdout 7 | }); 8 | 9 | // Prompt the user to enter a number and its base 10 | rl.question("Enter a number: ", (number) => { 11 | rl.question("Enter the base of the number: ", (base) => { 12 | base = parseInt(base, 10); 13 | 14 | // Convert the number to decimal 15 | const decimal = parseInt(number, base); 16 | 17 | // Convert the decimal number to other bases 18 | const binary = decimal.toString(2); 19 | const octal = decimal.toString(8); 20 | const hexadecimal = decimal.toString(16); 21 | 22 | // Output the results 23 | console.log(`Binary: ${binary}`); 24 | console.log(`Octal: ${octal}`); 25 | console.log(`Decimal: ${decimal}`); 26 | console.log(`Hexadecimal: ${hexadecimal}`); 27 | 28 | // Close the readline interface 29 | rl.close(); 30 | }); 31 | }); -------------------------------------------------------------------------------- /Javascript/bfs.js: -------------------------------------------------------------------------------- 1 | // add breadth first search algorithm in js 2 | 3 | function bfs(graph, start) { 4 | var queue = [start]; 5 | var result = []; 6 | var visited = {}; 7 | var current; 8 | 9 | visited[start] = true; 10 | 11 | while (queue.length) { 12 | current = queue.shift(); 13 | result.push(current); 14 | 15 | graph[current].forEach(function (neighbor) { 16 | if (!visited[neighbor]) { 17 | visited[neighbor] = true; 18 | queue.push(neighbor); 19 | } 20 | }); 21 | } 22 | 23 | return result; 24 | } 25 | 26 | var graph = { 27 | 'A': ['B', 'C'], 28 | 'B': ['A', 'D', 'E'], 29 | 'C': ['A', 'F'], 30 | 'D': ['B'], 31 | 'E': ['B', 'F'], 32 | 'F': ['C', 'E'] 33 | }; 34 | 35 | console.log(bfs(graph, 'A')); // ["A", "B", "C", "D", "E", "F"] -------------------------------------------------------------------------------- /Javascript/bubble-sort.js: -------------------------------------------------------------------------------- 1 | function bubbleSort(arr) { 2 | const length = arr.length; 3 | 4 | for (let i = 0; i < length; i++) { 5 | for (let j = 0; j < length - 1 - i; j++) { 6 | if (arr[j] > arr[j + 1]) { 7 | // Swap elements 8 | [arr[j], arr[j + 1]] = [arr[j + 1], arr[j]]; 9 | } 10 | } 11 | } 12 | 13 | return arr; 14 | } 15 | 16 | // Example usage 17 | const arr = [5, 3, 8, 1, 4]; 18 | console.log('Original array:', arr); 19 | bubbleSort(arr); 20 | console.log('Sorted array:', arr); 21 | -------------------------------------------------------------------------------- /Javascript/dfs.js: -------------------------------------------------------------------------------- 1 | function dfs(graph, start) { 2 | var stack = [start]; 3 | var visited = []; 4 | var node; 5 | 6 | while (stack.length) { 7 | node = stack.pop(); 8 | if (visited.indexOf(node) == -1) { 9 | visited.push(node); 10 | stack.push.apply(stack, graph[node]); 11 | } 12 | } 13 | 14 | return visited; 15 | } 16 | 17 | var graph = { 18 | a: ['b', 'c'], 19 | b: ['d'], 20 | c: ['e'], 21 | d: ['f'], 22 | e: [], 23 | f: [] 24 | }; 25 | 26 | console.log(dfs(graph, 'a')); // ['a', 'c', 'e', 'b', 'd', 'f'] 27 | -------------------------------------------------------------------------------- /Javascript/fibonacci_prime_numbers.js: -------------------------------------------------------------------------------- 1 | 2 | function fibonacci_prime_numbers(n) { 3 | let a = 1, b = 1, c = 0, count = 0; 4 | while (count < n) { 5 | c = a + b; 6 | a = b; 7 | b = c; 8 | if (is_prime(c)) { 9 | count++; 10 | console.log(c); 11 | } 12 | } 13 | } 14 | 15 | function is_prime(n) { 16 | if (n < 2) return false; 17 | for (let i = 2; i < n; i++) 18 | if (n % i === 0) return false; 19 | return true; 20 | } 21 | 22 | console.log(fibonacci_prime_numbers(10)); -------------------------------------------------------------------------------- /Javascript/guessingGame.js: -------------------------------------------------------------------------------- 1 | //Write a program to create a number guessing game where the user guesses a random number. 2 | 3 | function startGame() { 4 | const randomNumber = Math.floor(Math.random() * 100) + 1; // Generate a random number between 1 and 100 5 | let attempts = 0; 6 | 7 | function guessNumber() { 8 | const userGuess = parseInt(prompt("Enter your guess (between 1 and 100):")); 9 | 10 | if (isNaN(userGuess) || userGuess < 1 || userGuess > 100) { 11 | alert("Please enter a valid number between 1 and 100."); 12 | return guessNumber(); 13 | } 14 | 15 | attempts++; 16 | 17 | if (userGuess < randomNumber) { 18 | alert("Too low! Try again."); 19 | return guessNumber(); 20 | } else if (userGuess > randomNumber) { 21 | alert("Too high! Try again."); 22 | return guessNumber(); 23 | } else { 24 | alert(`Congratulations! You guessed the number in ${attempts} attempts.`); 25 | } 26 | } 27 | 28 | guessNumber(); 29 | } 30 | 31 | // Start the game 32 | startGame(); 33 | -------------------------------------------------------------------------------- /Javascript/longest_common_subsequence.js: -------------------------------------------------------------------------------- 1 | function lcs(x, y) { 2 | var s1 = x.length; 3 | var s2 = y.length; 4 | var a = new Array(s1+1); 5 | for(var i=0; i<=s1; i++) { 6 | a[i] = new Array(s2+1); 7 | for(var j=0; j<=s2; j++) { 8 | a[i][j] = 0; 9 | } 10 | } 11 | for(var i=1; i<=s1; i++) { 12 | for(var j=1; j<=s2; j++) { 13 | if(x[i-1] == y[j-1]) { 14 | a[i][j] = a[i-1][j-1] + 1; 15 | } else { 16 | a[i][j] = Math.max(a[i-1][j], a[i][j-1]); 17 | } 18 | } 19 | } 20 | return a[s1][s2]; 21 | } 22 | 23 | var x = "AGGTAB"; 24 | 25 | var y = "GXTXAYB"; 26 | 27 | console.log(lcs(x, y)); 28 | -------------------------------------------------------------------------------- /Javascript/max-subarray-sum.js: -------------------------------------------------------------------------------- 1 | //find the maximum sub array sum 2 | 3 | function maxSubArraySum(arr, num) { 4 | if (num > arr.length) { 5 | return null; 6 | } 7 | var max = -Infinity; 8 | for (var i = 0; i < arr.length - num + 1; i++) { 9 | var temp = 0; 10 | for (var j = 0; j < num; j++) { 11 | temp += arr[i + j]; 12 | } 13 | if (temp > max) { 14 | max = temp; 15 | } 16 | } 17 | return max; 18 | } 19 | console.log(maxSubArraySum([1, 2, 5, 2, 8, 1, 5], 2)); -------------------------------------------------------------------------------- /Javascript/remove_duplicates.js: -------------------------------------------------------------------------------- 1 | function removeDuplicates(arr) { 2 | 3 | var exists = {}, 4 | outArr = [], 5 | elm; 6 | 7 | for (var i = 0; i < arr.length; i++) { 8 | elm = arr[i]; 9 | if (!exists[elm]) { 10 | outArr.push(elm); 11 | exists[elm] = true; 12 | } 13 | } 14 | return outArr; 15 | } 16 | 17 | var arr = [1, 3, 3, 3, 1, 5, 6, 7, 8, 1]; 18 | 19 | console.log(removeDuplicates(arr)); // [1, 3, 5, 6, 7, 8] -------------------------------------------------------------------------------- /Javascript/reverse_string.js: -------------------------------------------------------------------------------- 1 | function reverseString(str) { 2 | return str.split('').reverse().join(''); 3 | } 4 | 5 | console.log(reverseString("hello")); -------------------------------------------------------------------------------- /Javascript/total_voewl_count.js: -------------------------------------------------------------------------------- 1 | // count total number of vowels in a string 2 | 3 | function countVowels(str) { 4 | let count = 0; 5 | const vowels = "aeiou"; 6 | 7 | for (let char of str.toLowerCase()) { 8 | if (vowels.includes(char)) { 9 | count++; 10 | } 11 | } 12 | 13 | return count; 14 | } 15 | 16 | console.log(countVowels("hello world")); -------------------------------------------------------------------------------- /Memory/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Memory Card Game 7 | 8 | 9 | 10 | 11 |
12 | 13 | -------------------------------------------------------------------------------- /Memory/style.css: -------------------------------------------------------------------------------- 1 | body { 2 | background: linear-gradient(to right, rgba(0,0,0,0), teal), linear-gradient(to right, rgba(255,0,100,.3), rgba(255,100,127,.2)), linear-gradient(to top right, yellow, rgba(0,0,0,0)), radial-gradient(closest-corner at 20% 80%, yellow, red); 3 | background-attachment: fixed; 4 | } 5 | 6 | .tiles{ 7 | margin: 48px auto; 8 | width: max-content; 9 | display: grid; 10 | grid-template-columns: repeat(4, 100px); 11 | gap: 16px; 12 | } 13 | 14 | .tile{ 15 | height: 100px; 16 | background: #111111; 17 | border: 5px solid #444444; 18 | cursor: pointer; 19 | 20 | } -------------------------------------------------------------------------------- /Mineral Processing Technology-Image Analytics/input/img1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simranlotey/Hacktoberfest/dd6a766af4ba6025b183471d88513c14b3357c00/Mineral Processing Technology-Image Analytics/input/img1.png -------------------------------------------------------------------------------- /Mineral Processing Technology-Image Analytics/input/img2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simranlotey/Hacktoberfest/dd6a766af4ba6025b183471d88513c14b3357c00/Mineral Processing Technology-Image Analytics/input/img2.png -------------------------------------------------------------------------------- /Mineral Processing Technology-Image Analytics/input/img3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simranlotey/Hacktoberfest/dd6a766af4ba6025b183471d88513c14b3357c00/Mineral Processing Technology-Image Analytics/input/img3.png -------------------------------------------------------------------------------- /Mineral Processing Technology-Image Analytics/input/img4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simranlotey/Hacktoberfest/dd6a766af4ba6025b183471d88513c14b3357c00/Mineral Processing Technology-Image Analytics/input/img4.png -------------------------------------------------------------------------------- /Mineral Processing Technology-Image Analytics/input/img5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simranlotey/Hacktoberfest/dd6a766af4ba6025b183471d88513c14b3357c00/Mineral Processing Technology-Image Analytics/input/img5.png -------------------------------------------------------------------------------- /Mineral Processing Technology-Image Analytics/output/img1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simranlotey/Hacktoberfest/dd6a766af4ba6025b183471d88513c14b3357c00/Mineral Processing Technology-Image Analytics/output/img1.png -------------------------------------------------------------------------------- /Mineral Processing Technology-Image Analytics/output/img2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simranlotey/Hacktoberfest/dd6a766af4ba6025b183471d88513c14b3357c00/Mineral Processing Technology-Image Analytics/output/img2.png -------------------------------------------------------------------------------- /Mineral Processing Technology-Image Analytics/output/img3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simranlotey/Hacktoberfest/dd6a766af4ba6025b183471d88513c14b3357c00/Mineral Processing Technology-Image Analytics/output/img3.png -------------------------------------------------------------------------------- /Mineral Processing Technology-Image Analytics/output/img4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simranlotey/Hacktoberfest/dd6a766af4ba6025b183471d88513c14b3357c00/Mineral Processing Technology-Image Analytics/output/img4.png -------------------------------------------------------------------------------- /Mineral Processing Technology-Image Analytics/output/img5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simranlotey/Hacktoberfest/dd6a766af4ba6025b183471d88513c14b3357c00/Mineral Processing Technology-Image Analytics/output/img5.png -------------------------------------------------------------------------------- /Music_Player/README.md: -------------------------------------------------------------------------------- 1 | ## Marvel music player 2 | 3 | https://www.purnashrestha.com.np/MCU-music-player/ 4 | 5 | ![image](https://github.com/purnasth/programs/assets/107195487/413c9291-9ebb-4f6e-95ca-6ada11014510) 6 | -------------------------------------------------------------------------------- /Music_Player/assets/images/Avengers.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simranlotey/Hacktoberfest/dd6a766af4ba6025b183471d88513c14b3357c00/Music_Player/assets/images/Avengers.webp -------------------------------------------------------------------------------- /Music_Player/assets/images/deadpool.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simranlotey/Hacktoberfest/dd6a766af4ba6025b183471d88513c14b3357c00/Music_Player/assets/images/deadpool.webp -------------------------------------------------------------------------------- /Music_Player/assets/images/guardians_of_the_galaxy.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simranlotey/Hacktoberfest/dd6a766af4ba6025b183471d88513c14b3357c00/Music_Player/assets/images/guardians_of_the_galaxy.webp -------------------------------------------------------------------------------- /Music_Player/assets/images/ironman.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simranlotey/Hacktoberfest/dd6a766af4ba6025b183471d88513c14b3357c00/Music_Player/assets/images/ironman.webp -------------------------------------------------------------------------------- /Music_Player/assets/images/rocket_racoon.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simranlotey/Hacktoberfest/dd6a766af4ba6025b183471d88513c14b3357c00/Music_Player/assets/images/rocket_racoon.webp -------------------------------------------------------------------------------- /Music_Player/assets/images/spiderman_NWH.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simranlotey/Hacktoberfest/dd6a766af4ba6025b183471d88513c14b3357c00/Music_Player/assets/images/spiderman_NWH.webp -------------------------------------------------------------------------------- /Music_Player/assets/images/starlord.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simranlotey/Hacktoberfest/dd6a766af4ba6025b183471d88513c14b3357c00/Music_Player/assets/images/starlord.webp -------------------------------------------------------------------------------- /Music_Player/assets/images/tasm_spiderman.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simranlotey/Hacktoberfest/dd6a766af4ba6025b183471d88513c14b3357c00/Music_Player/assets/images/tasm_spiderman.webp -------------------------------------------------------------------------------- /Music_Player/assets/music/AC-DC-Back-in-black-djlunatique.com.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simranlotey/Hacktoberfest/dd6a766af4ba6025b183471d88513c14b3357c00/Music_Player/assets/music/AC-DC-Back-in-black-djlunatique.com.mp3 -------------------------------------------------------------------------------- /Music_Player/assets/music/Binks Sake - One Piece _ Yo Ho Ho _ Violin _ Anime Ringtone......mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simranlotey/Hacktoberfest/dd6a766af4ba6025b183471d88513c14b3357c00/Music_Player/assets/music/Binks Sake - One Piece _ Yo Ho Ho _ Violin _ Anime Ringtone......mp3 -------------------------------------------------------------------------------- /Music_Player/assets/music/Deadpool Opening.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simranlotey/Hacktoberfest/dd6a766af4ba6025b183471d88513c14b3357c00/Music_Player/assets/music/Deadpool Opening.mp3 -------------------------------------------------------------------------------- /Music_Player/assets/music/Guardians Of The Galaxy Vol. 3 Song _ To The Sky _ [Rocket Raccoon Song].mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simranlotey/Hacktoberfest/dd6a766af4ba6025b183471d88513c14b3357c00/Music_Player/assets/music/Guardians Of The Galaxy Vol. 3 Song _ To The Sky _ [Rocket Raccoon Song].mp3 -------------------------------------------------------------------------------- /Music_Player/assets/music/Guardians of the Galaxy vol. 3 - Dog Days Are Over.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simranlotey/Hacktoberfest/dd6a766af4ba6025b183471d88513c14b3357c00/Music_Player/assets/music/Guardians of the Galaxy vol. 3 - Dog Days Are Over.mp3 -------------------------------------------------------------------------------- /Music_Player/assets/music/Michael Giacchino - Theme (from Spider Man Original Television Series) _ Spider-Man_ No Way Home OST.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simranlotey/Hacktoberfest/dd6a766af4ba6025b183471d88513c14b3357c00/Music_Player/assets/music/Michael Giacchino - Theme (from Spider Man Original Television Series) _ Spider-Man_ No Way Home OST.mp3 -------------------------------------------------------------------------------- /Music_Player/assets/music/Redbone - Come And Get Your Love (Lyrics) [Guardians Of The Galaxy].mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simranlotey/Hacktoberfest/dd6a766af4ba6025b183471d88513c14b3357c00/Music_Player/assets/music/Redbone - Come And Get Your Love (Lyrics) [Guardians Of The Galaxy].mp3 -------------------------------------------------------------------------------- /Music_Player/assets/music/The Amazing Spider-Man 2 - Gone, Gone, Gone (HD) By Phillip Phillips.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simranlotey/Hacktoberfest/dd6a766af4ba6025b183471d88513c14b3357c00/Music_Player/assets/music/The Amazing Spider-Man 2 - Gone, Gone, Gone (HD) By Phillip Phillips.mp3 -------------------------------------------------------------------------------- /Music_Player/assets/music/The Avengers Ringtone.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simranlotey/Hacktoberfest/dd6a766af4ba6025b183471d88513c14b3357c00/Music_Player/assets/music/The Avengers Ringtone.mp3 -------------------------------------------------------------------------------- /PHP/CarsListPanel/Delete.php: -------------------------------------------------------------------------------- 1 | \n$sql\n\n"; 9 | $stmt = $pdo->prepare($sql); 10 | $stmt->execute(array(':user_id' => $_SESSION['varname'])); 11 | $_SESSION['delete'] = "Successfully deleted."; 12 | header("Location:View.php"); 13 | return; 14 | } 15 | if ( isset($_GET['cancel']) ) { 16 | header("Location:View.php"); 17 | return; 18 | } 19 | 20 | ?> 21 | 22 | 23 | 24 | SEAN MANJALY 25 | 26 | 27 |
28 |

Delete the user ? 29 |

30 |

31 |

32 |
33 | 34 | -------------------------------------------------------------------------------- /PHP/CarsListPanel/Images/i1.jfif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simranlotey/Hacktoberfest/dd6a766af4ba6025b183471d88513c14b3357c00/PHP/CarsListPanel/Images/i1.jfif -------------------------------------------------------------------------------- /PHP/CarsListPanel/Images/i1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simranlotey/Hacktoberfest/dd6a766af4ba6025b183471d88513c14b3357c00/PHP/CarsListPanel/Images/i1.png -------------------------------------------------------------------------------- /PHP/CarsListPanel/Images/i2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simranlotey/Hacktoberfest/dd6a766af4ba6025b183471d88513c14b3357c00/PHP/CarsListPanel/Images/i2.png -------------------------------------------------------------------------------- /PHP/CarsListPanel/Images/i3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simranlotey/Hacktoberfest/dd6a766af4ba6025b183471d88513c14b3357c00/PHP/CarsListPanel/Images/i3.png -------------------------------------------------------------------------------- /PHP/CarsListPanel/Images/i4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simranlotey/Hacktoberfest/dd6a766af4ba6025b183471d88513c14b3357c00/PHP/CarsListPanel/Images/i4.png -------------------------------------------------------------------------------- /PHP/CarsListPanel/Images/i5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simranlotey/Hacktoberfest/dd6a766af4ba6025b183471d88513c14b3357c00/PHP/CarsListPanel/Images/i5.png -------------------------------------------------------------------------------- /PHP/CarsListPanel/Logout.php: -------------------------------------------------------------------------------- 1 | 9 | 10 | 11 | Logout from the application 12 | 13 | 14 |

Logging out........

15 | 16 | 17 | -------------------------------------------------------------------------------- /PHP/CarsListPanel/pdo.php: -------------------------------------------------------------------------------- 1 | setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); 4 | ?> 5 | -------------------------------------------------------------------------------- /Progress Bar/index.html: -------------------------------------------------------------------------------- 1 | 2 | Progress Bar 3 | 4 | 5 | 6 | 7 |

Progress Bar

8 |
9 |
10 |
11 | 12 | -------------------------------------------------------------------------------- /Progress Bar/script.js: -------------------------------------------------------------------------------- 1 | var i = 0; 2 | function progressing() { 3 | if (i == 0) { 4 | i = 1; 5 | var elem = document.getElementById("progress"); 6 | var width = 1; 7 | var id = setInterval(frame, 10); 8 | function frame() { 9 | if (width >= 100) { 10 | clearInterval(id); 11 | i = 0; 12 | } else { 13 | width++; 14 | elem.style.width = width + "%"; 15 | } 16 | } 17 | } 18 | } -------------------------------------------------------------------------------- /Progress Bar/style.css: -------------------------------------------------------------------------------- 1 | #bar { 2 | width: 100%; 3 | background-color: rgb(184, 174, 240); 4 | } 5 | 6 | #progress { 7 | width: 1%; 8 | height: 30px; 9 | background-color: rgb(87, 63, 228); 10 | } 11 | 12 | #button{ 13 | margin-top: 10px; 14 | background-color: rgb(87, 63, 228); 15 | border: none; 16 | color: white; 17 | padding: 15px 32px; 18 | text-align: center; 19 | text-decoration: none; 20 | display: inline-block; 21 | font-size: 16px; 22 | cursor: pointer; 23 | } 24 | 25 | #title{ 26 | color: rgb(87, 63, 228); 27 | } -------------------------------------------------------------------------------- /Python/3d_pose_estimation/README.md: -------------------------------------------------------------------------------- 1 | ### 3D POSE ESTIMATION 2 | # 3D pose estimation has been done using mediapipe's solutions.pose library -------------------------------------------------------------------------------- /Python/Calender.py: -------------------------------------------------------------------------------- 1 | import calendar 2 | 3 | def display_calendar(year, month): 4 | cal = calendar.month(year, month) 5 | return cal 6 | 7 | def main(): 8 | print("Basic Calendar Display\n") 9 | 10 | while True: 11 | year = int(input("Enter the year (e.g., 2023): ")) 12 | month = int(input("Enter the month (1-12): ")) 13 | 14 | if 1 <= month <= 12: 15 | cal = display_calendar(year, month) 16 | print("\n", cal) 17 | else: 18 | print("Invalid month. Please enter a valid month (1-12).\n") 19 | 20 | choice = input("Do you want to view another calendar (yes/no)? ") 21 | if choice.lower() != "yes": 22 | break 23 | 24 | if __name__ == "__main__": 25 | main() 26 | -------------------------------------------------------------------------------- /Python/Image_Viewer/Imager-viewer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simranlotey/Hacktoberfest/dd6a766af4ba6025b183471d88513c14b3357c00/Python/Image_Viewer/Imager-viewer.png -------------------------------------------------------------------------------- /Python/Image_Viewer/README.md: -------------------------------------------------------------------------------- 1 | ##Installation 2 | 3 | 4 | Use the package manager [pip](https://pip.pypa.io/en/stable/) to install flask. 5 | 6 | ```bash 7 | pip install flask 8 | ``` 9 | 10 | or use the requirements.txt 11 | 12 | ```bash 13 | pip install -r requirements.txt 14 | ``` 15 | 16 | 17 | ## Usage 18 | 19 | Start app.py go with your browser to : http://127.0.0.1:5000 20 | 21 | add the path of your image folder to the website. 22 | 23 | now you can open your image with a click 24 | 25 | ![Overview](Imager-viewer.png) 26 | 27 | ![Pic](pic.png) -------------------------------------------------------------------------------- /Python/Image_Viewer/app.py: -------------------------------------------------------------------------------- 1 | from flask import Flask, render_template, request, send_from_directory 2 | import os 3 | 4 | app = Flask(__name__) 5 | 6 | app.config["UPLOAD_FOLDER"] = "" # path to pic folder 7 | 8 | @app.route("/", methods=["GET", "POST"]) 9 | def index(): 10 | if request.method == "POST": 11 | user_directory = request.form.get("image_directory") 12 | 13 | if os.path.exists(user_directory): 14 | app.config["UPLOAD_FOLDER"] = user_directory # set pic folder dynamic 15 | image_files = os.listdir(app.config["UPLOAD_FOLDER"]) 16 | return render_template("index.html", image_files=image_files, user_directory=user_directory) 17 | else: 18 | return "The folder doesn't exists." 19 | 20 | return render_template("index.html", image_files=None, user_directory=app.config["UPLOAD_FOLDER"]) 21 | 22 | @app.route("/view/") 23 | def view_image(image_path): 24 | return send_from_directory(app.config["UPLOAD_FOLDER"], image_path) 25 | 26 | if __name__ == "__main__": 27 | app.run(debug=True) 28 | -------------------------------------------------------------------------------- /Python/Image_Viewer/pic.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simranlotey/Hacktoberfest/dd6a766af4ba6025b183471d88513c14b3357c00/Python/Image_Viewer/pic.png -------------------------------------------------------------------------------- /Python/Image_Viewer/requirements.txt: -------------------------------------------------------------------------------- 1 | flask~=3.0.0 -------------------------------------------------------------------------------- /Python/Image_Viewer/templates/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Imager-viewer 5 | 6 | 7 |

Imager-viewer

8 |
9 | 10 | 11 | 12 |
13 | {% if image_files %} 14 |

Picture in this folder:

15 |
    16 | {% for image in image_files %} 17 |
  • 18 | {{ image }} 19 |
  • 20 | {% endfor %} 21 |
22 | {% endif %} 23 | 24 | 25 | -------------------------------------------------------------------------------- /Python/LongestPalindromicSubstring.py: -------------------------------------------------------------------------------- 1 | def longest_palindrome(s): 2 | 3 | def expand_around_center(s, left, right): 4 | while left >= 0 and right < len(s) and s[left] == s[right]: 5 | left -= 1 6 | right += 1 7 | return right - left - 1 8 | 9 | start = 0 10 | end = 0 11 | 12 | for i in range(len(s)): 13 | len1 = expand_around_center(s, i, i) 14 | len2 = expand_around_center(s, i, i+1) 15 | max_len = max(len1, len2) 16 | 17 | if max_len > end - start: 18 | start = i - (max_len - 1) // 2 19 | end = i + max_len // 2 20 | 21 | return s[start:end+1] 22 | 23 | # Example usage: 24 | s = "yuziizuy" 25 | result = longest_palindrome(s) 26 | print(result) 27 | -------------------------------------------------------------------------------- /Python/Strong_number_range.py: -------------------------------------------------------------------------------- 1 | '''A Strong Number is defined as a number where the sum of the factorials of its digits equals the original number itself.''' 2 | def find_strong_numbers_in_range(a, b): 3 | for i in range (a,b+1): 4 | i1=i 5 | i2=0 6 | while i1>0: 7 | r=i1%10 8 | i3=1 9 | for j in range(1,r+1): 10 | i3=i3*j 11 | i2=i2+i3 12 | i1=i1//10 13 | if i2==i: 14 | print(i2) 15 | else: 16 | pass 17 | x=int(input()) 18 | y=int(input()) 19 | find_strong_numbers_in_range(x,y) 20 | -------------------------------------------------------------------------------- /Python/anagram_detector.py: -------------------------------------------------------------------------------- 1 | def are_anagrams(word1, word2): 2 | clean_word1 = word1.replace(' ', '').lower() 3 | clean_word2 = word2.replace(' ', '').lower() 4 | 5 | if len(clean_word1) != len(clean_word2): 6 | return False 7 | 8 | sorted_word1 = sorted(clean_word1) 9 | sorted_word2 = sorted(clean_word2) 10 | 11 | return sorted_word1 == sorted_word2 12 | 13 | word1 = "listen" 14 | word2 = "silent" 15 | 16 | if are_anagrams(word1, word2): 17 | print(f"{word1} and {word2} are anagrams.") 18 | else: 19 | 20 | print(f"{word1} and {word2} are not anagrams.") -------------------------------------------------------------------------------- /Python/analyze_string.py: -------------------------------------------------------------------------------- 1 | def analyze_string(_str): 2 | # Initialize counters 3 | vc = 0 4 | cc = 0 5 | nc = 0 6 | sc = 0 7 | 8 | # Define the set of vowels 9 | vowels = "AEIOUaeiou" 10 | 11 | # Iterate through each character in the input string 12 | for char in _str: 13 | if char.isalpha(): 14 | if char in vowels: 15 | vc += 1 16 | else: 17 | cc += 1 18 | else: 19 | if char.isnumeric(): 20 | nc += 1 21 | else: 22 | sc += 1 23 | 24 | return vc, cc, nc, sc 25 | 26 | 27 | if __name__ == "__main__": 28 | input_string = input("Enter a string: ") 29 | 30 | vowel_count, consonant_count, number_count, special_char_count = analyze_string(input_string) 31 | 32 | print(f"Vowels: {vowel_count}") 33 | print(f"Consonants: {consonant_count}") 34 | print(f"Numbers: {number_count}") 35 | print(f"Special Characters: {special_char_count}") 36 | -------------------------------------------------------------------------------- /Python/binaryarray.py: -------------------------------------------------------------------------------- 1 | # Python3 code to implement iterative Binary 2 | # Search. 3 | 4 | 5 | # It returns location of x in given array arr 6 | def binarySearch(arr, l, r, x): 7 | 8 | while l <= r: 9 | 10 | mid = l + (r - l) // 2 11 | 12 | # Check if x is present at mid 13 | if arr[mid] == x: 14 | return mid 15 | 16 | # If x is greater, ignore left half 17 | elif arr[mid] < x: 18 | l = mid + 1 19 | 20 | # If x is smaller, ignore right half 21 | else: 22 | r = mid - 1 23 | 24 | # If we reach here, then the element 25 | # was not present 26 | return -1 27 | 28 | 29 | # Driver Code 30 | if __name__ == '__main__': 31 | arr = [2, 3, 4, 10, 40] 32 | x = 10 33 | 34 | # Function call 35 | result = binarySearch(arr, 0, len(arr)-1, x) 36 | if result != -1: 37 | print("Element is present at index", result) 38 | else: 39 | print("Element is not present in array") 40 | -------------------------------------------------------------------------------- /Python/convert_decimal_to_binart.py: -------------------------------------------------------------------------------- 1 | def convert_to_binary(decimal): 2 | if decimal == 0: 3 | return "0" 4 | 5 | bits = [] 6 | while decimal: 7 | bits.append(str(decimal & 1)) 8 | decimal >>= 1 9 | 10 | return ''.join(reversed(bits)) 11 | 12 | # Collect user input 13 | num = int(input("Provide a decimal number: ")) 14 | 15 | # Convert and display the result 16 | print(f"Binary of {num} is: {convert_to_binary(num)}") 17 | -------------------------------------------------------------------------------- /Python/count_number_of_words.py: -------------------------------------------------------------------------------- 1 | # Develop a program that counts the number of words in a given text input. 2 | 3 | # Provide the text whose number of words you want to count. 4 | text = input("Enter you text: ") 5 | 6 | word = text.split() 7 | 8 | print(f"The number of words in your given text is {len(word)}") -------------------------------------------------------------------------------- /Python/diamondPattern.py: -------------------------------------------------------------------------------- 1 | i = int(input("Enter diamond's height: ")) 2 | for x in range(i): 3 | print(" " * (i - x), "*" * (2*x + 1)) 4 | for x in range(i - 2, -1, -1): 5 | print(" " * (i - x), "*" * (2*x + 1)) -------------------------------------------------------------------------------- /Python/emailwrapper/__init__.py: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /Python/emailwrapper/tempclean.py: -------------------------------------------------------------------------------- 1 | import gc 2 | import os 3 | import shutil 4 | import tempfile 5 | 6 | 7 | # Clean temporary files 8 | def clean_temp_files(): 9 | """Remove temporary files.""" 10 | temp_dir = tempfile.gettempdir() 11 | try: 12 | for root, dirs, files in os.walk(temp_dir): 13 | for name in files: 14 | file_path = os.path.join(root, name) 15 | try: 16 | os.remove(file_path) 17 | except Exception as e: 18 | print(f"Failed to remove {file_path}: {e}") 19 | for name in dirs: 20 | dir_path = os.path.join(root, name) 21 | try: 22 | shutil.rmtree(dir_path) 23 | except Exception as e: 24 | print(f"Failed to remove {dir_path}: {e}") 25 | except Exception as e: 26 | print(f"Error cleaning temporary files: {e}") 27 | 28 | 29 | # Clean RAM 30 | def clean_ram(): 31 | """Force garbage collection to clean up RAM.""" 32 | gc.collect() 33 | -------------------------------------------------------------------------------- /Python/factorial.py: -------------------------------------------------------------------------------- 1 | def factorial(n): 2 | """ 3 | Calculate the factorial of a non-negative integer. 4 | 5 | Args: 6 | n (int): The non-negative integer for which to calculate the factorial. 7 | 8 | Returns: 9 | int: The factorial of the input number. 10 | 11 | Examples: 12 | >>> factorial(0) 13 | 1 14 | >>> factorial(5) 15 | 120 16 | >>> factorial(10) 17 | 3628800 18 | """ 19 | if n < 0: 20 | raise ValueError("Factorial is defined only for non-negative integers.") 21 | if n == 0 or n==1: 22 | return 1 23 | 24 | result = 1 25 | for i in range(2, n + 1): 26 | result *= i 27 | 28 | return result 29 | 30 | 31 | if __name__ == "__main__": 32 | import doctest 33 | 34 | doctest.testmod() 35 | print(factorial(5)) 36 | -------------------------------------------------------------------------------- /Python/fibonacci.py: -------------------------------------------------------------------------------- 1 | def fibonacci(n): 2 | """ 3 | Generate the Fibonacci series up to the nth term. 4 | 5 | Args: 6 | n (int): The number of terms to generate in the Fibonacci series. 7 | 8 | Returns: 9 | list: A list containing the Fibonacci series up to the nth term. 10 | 11 | Examples: 12 | >>> fibonacci(0) 13 | [] 14 | >>> fibonacci(1) 15 | [0] 16 | >>> fibonacci(5) 17 | [0, 1, 1, 2, 3] 18 | >>> fibonacci(10) 19 | [0, 1, 1, 2, 3, 5, 8, 13, 21, 34] 20 | """ 21 | 22 | if n <= 0: 23 | return [] # Return an empty list for n <= 0. 24 | elif n == 1: 25 | return [0] # Return [0] for n = 1. 26 | 27 | fib_series = [0, 1] # Initialize the Fibonacci series with the first two terms. 28 | 29 | while len(fib_series) < n: 30 | next_term = ( 31 | fib_series[-1] + fib_series[-2] 32 | ) # Calculate the next Fibonacci term. 33 | fib_series.append(next_term) 34 | 35 | return fib_series 36 | 37 | 38 | if __name__ == "__main__": 39 | import doctest 40 | 41 | doctest.testmod() 42 | print(fibonacci(10)) 43 | -------------------------------------------------------------------------------- /Python/fibonnaci_sequence.py: -------------------------------------------------------------------------------- 1 | def f(n): 2 | if(n==0): 3 | return 0 4 | elif(n==1): 5 | return 1 6 | else: 7 | return f(n-1)+ f(n-2) 8 | a=int(input('Enter the number:')) 9 | print (f(a)) -------------------------------------------------------------------------------- /Python/find_second_largest_element_array.py: -------------------------------------------------------------------------------- 1 | def print2largest(arr, arr_size): 2 | 3 | # There should be 4 | # atleast two elements 5 | if (arr_size < 2): 6 | print(" Invalid Input ") 7 | return 8 | 9 | # Sort the array 10 | arr.sort 11 | 12 | # Start from second last 13 | # element as the largest 14 | # element is at last 15 | for i in range(arr_size-2, -1, -1): 16 | 17 | # If the element is not 18 | # equal to largest element 19 | if (arr[i] != arr[arr_size - 1]): 20 | 21 | print("The second largest element is", arr[i]) 22 | return 23 | 24 | print("There is no second largest element") 25 | 26 | 27 | # Driver code 28 | arr = [12, 35, 1, 10, 34, 1] 29 | n = len(arr) 30 | print2largest(arr, n) 31 | 32 | -------------------------------------------------------------------------------- /Python/findingDuplicates.py: -------------------------------------------------------------------------------- 1 | def findingDuplicates(arr): 2 | tortoise = arr[0] 3 | hare = arr[arr[0]] 4 | while tortoise != hare: 5 | tortoise = arr[tortoise] 6 | hare = arr[arr[hare]] 7 | 8 | hare = 0 9 | while tortoise != hare: 10 | tortoise = arr[tortoise] 11 | hare = arr[hare] 12 | 13 | return tortoise 14 | 15 | 16 | arr = [2, 5, 3, 1, 0, 3] 17 | ans = findingDuplicates(arr) 18 | print(ans) 19 | -------------------------------------------------------------------------------- /Python/fizzbuzz/fizzbuzz.py: -------------------------------------------------------------------------------- 1 | for num in range(1, 50): 2 | if num % 15 == 0: 3 | print("FizzBuzz") 4 | elif num % 3 == 0: 5 | print("Fizz") 6 | elif num % 5 == 0: 7 | print("Buzz") 8 | else: 9 | print(num) 10 | -------------------------------------------------------------------------------- /Python/handwriting.py: -------------------------------------------------------------------------------- 1 | import pywhatkit 2 | pywhatkit.text_to_handwriting('''Learning Python from the basics is 3 | extremely important. Before starting to learn python,understanding a 4 | base language like c is a must and 5 | some of the oops concepts.Python program has many modulesand packages, 6 | which helps with efficient programming. 7 | Understanding these modules and 1proper usage of many syntax and libraries is recommended. 8 | In this article, a few modules and packages are used in the program. 9 | Python includes tons of libraries and some of them are quiet intresting''') -------------------------------------------------------------------------------- /Python/helloworld.py: -------------------------------------------------------------------------------- 1 | import string 2 | import time 3 | 4 | out = "hello world" 5 | 6 | letters = string.printable 7 | 8 | cur = "" 9 | 10 | for i in out: 11 | for j in letters: 12 | time.sleep(0.05) 13 | print(cur,j,sep="") 14 | if i == j: 15 | cur += j 16 | break 17 | -------------------------------------------------------------------------------- /Python/isArmstrong.py: -------------------------------------------------------------------------------- 1 | import math 2 | 3 | def isArmstrong(num): 4 | n = num 5 | numDigits = 0 6 | sum = 0 7 | 8 | # Find number of digits in num 9 | while n > 0: 10 | n //= 10 11 | numDigits += 1 12 | 13 | n = num 14 | 15 | # Calculate sum of digits raised to the power of numDigits 16 | while n > 0: 17 | digit = n % 10 18 | sum += math.pow(digit, numDigits) 19 | n //= 10 20 | 21 | # Check if num is Armstrong number or not 22 | if sum == num: 23 | return True 24 | return False 25 | 26 | # Example 1 27 | num1 = 1634 28 | if isArmstrong(num1): 29 | print(num1, "is an Armstrong number.") 30 | else: 31 | print(num1, "is not an Armstrong number.") 32 | 33 | # Example 2 34 | num2 = 120 35 | if isArmstrong(num2): 36 | print(num2, "is an Armstrong number.") 37 | else: 38 | print(num2, "is not an Armstrong number.") 39 | -------------------------------------------------------------------------------- /Python/leapyear.py: -------------------------------------------------------------------------------- 1 | # Python program to check if year is a leap year or not 2 | 3 | year = 2000 4 | 5 | # To get year (integer input) from the user 6 | # year = int(input("Enter a year: ")) 7 | 8 | # divided by 100 means century year (ending with 00) 9 | # century year divided by 400 is leap year 10 | if (year % 400 == 0) and (year % 100 == 0): 11 | print("{0} is a leap year".format(year)) 12 | 13 | # not divided by 100 means not a century year 14 | # year divided by 4 is a leap year 15 | elif (year % 4 ==0) and (year % 100 != 0): 16 | print("{0} is a leap year".format(year)) 17 | 18 | # if not divided by both 400 (century year) and 4 (not century year) 19 | # year is not leap year 20 | else: 21 | print("{0} is not a leap year".format(year)) 22 | -------------------------------------------------------------------------------- /Python/limericks.py: -------------------------------------------------------------------------------- 1 | #program to generate random limericks. 2 | #In this program defines three functions: 1)generate_line_a() generates a random line for the A parts of the limerick. 2)generate_line_b() generates a random line for the B parts of the limerick. 3)generate_limerick() puts together the complete limerick with random lines for A and B parts. 3 | 4 | import random 5 | 6 | def generate_line_a(): 7 | return random.choice(["There once was a cat", "A mouse ran so fast", "In a land far away", "A clever young rat", "Once a dog named Max"]) 8 | 9 | def generate_line_b(): 10 | return random.choice(["In a hat full of cheese", "With a tail that would twitch", "That loved to chase mice", "With a plan, oh so slick", "Whose bark had a pitch"]) 11 | 12 | def generate_limerick(): 13 | line_a1 = generate_line_a() 14 | line_a2 = generate_line_a() 15 | line_b1 = generate_line_b() 16 | line_b2 = generate_line_b() 17 | line_a3 = generate_line_a() 18 | 19 | limerick = f"{line_a1}\n{line_a2}\n{line_b1}\n{line_b2}\n{line_a3}" 20 | return limerick 21 | 22 | if __name__ == "__main__": 23 | limerick = generate_limerick() 24 | print("Random Limerick:") 25 | print(limerick) 26 | -------------------------------------------------------------------------------- /Python/num_bases.py: -------------------------------------------------------------------------------- 1 | def convert_base(number, from_base, to_base): 2 | try: 3 | # Convert the number from the source base to decimal 4 | decimal_number = int(number, from_base) 5 | 6 | # Convert the decimal number to the target base 7 | result = format(decimal_number, 'x' if to_base == 16 else 'b' if to_base == 2 else 'd') 8 | 9 | return result 10 | except ValueError: 11 | return "Invalid input" 12 | 13 | if __name__ == "__main__": 14 | number = input("Enter a number: ") 15 | from_base = int(input("Enter the source base (e.g., 2 for binary, 8 for octal, 10 for decimal, 16 for hexadecimal): ")) 16 | to_base = int(input("Enter the target base (e.g., 2 for binary, 8 for octal, 10 for decimal, 16 for hexadecimal): ")) 17 | 18 | converted_number = convert_base(number, from_base, to_base) 19 | if converted_number == "Invalid input": 20 | print("Invalid input. Please check the number and base.") 21 | else: 22 | print(f"Converted number: {converted_number}") 23 | -------------------------------------------------------------------------------- /Python/pal.py: -------------------------------------------------------------------------------- 1 | x=int(input("Enter the number: ")) 2 | temp=x 3 | rev=0 4 | while(temp>0): 5 | dig=temp%10 6 | rev=rev*10+dig 7 | temp=temp//10 8 | 9 | if(rev==x): 10 | print("The number is palindrome") 11 | else: 12 | print("The number is not palindrome") 13 | -------------------------------------------------------------------------------- /Python/prime numbers.py: -------------------------------------------------------------------------------- 1 | n=int(input("enter any number: ")) 2 | count=0 3 | i=1 4 | while(i<=n): 5 | if (n%i==0): 6 | count =count+1 7 | i=i+1 8 | 9 | if (count==2): 10 | print ("prime number.") 11 | else: 12 | print ("composite number.") 13 | -------------------------------------------------------------------------------- /Python/queue.py: -------------------------------------------------------------------------------- 1 | class Queue: 2 | def __init__(self): 3 | self.items = [] 4 | 5 | def enqueue(self, item): 6 | self.items.append(item) 7 | 8 | def dequeue(self): 9 | if not self.is_empty(): 10 | return self.items.pop(0) 11 | 12 | def front(self): 13 | if not self.is_empty(): 14 | return self.items[0] 15 | 16 | def is_empty(self): 17 | return len(self.items) == 0 18 | 19 | def size(self): 20 | return len(self.items) 21 | # Create a new queue 22 | q = Queue() 23 | 24 | # Enqueue some items onto the queue 25 | q.enqueue(1) 26 | q.enqueue(2) 27 | q.enqueue(3) 28 | 29 | # Dequeue an item from the queue 30 | print(q.dequeue()) # Output: 1 31 | 32 | # Get the front item in the queue 33 | print(q.front()) # Output: 2 34 | 35 | # Check if the queue is empty 36 | print(q.is_empty()) # Output: False 37 | 38 | # Get the size of the queue 39 | print(q.size()) # Output: 2 -------------------------------------------------------------------------------- /Python/randomPasswardGenerator: -------------------------------------------------------------------------------- 1 | import random 2 | import string 3 | 4 | def generate_password(length, use_digits=True, use_special_chars=True): 5 | # Define character sets 6 | chars = string.ascii_letters 7 | if use_digits: 8 | chars += string.digits 9 | if use_special_chars: 10 | chars += string.punctuation 11 | 12 | # Generate the password 13 | password = ''.join(random.choice(chars) for _ in range(length)) 14 | return password 15 | 16 | def main(): 17 | print("Password Generator") 18 | length = int(input("Enter the desired password length: ")) 19 | 20 | use_digits = input("Include digits (yes/no)? ").strip().lower() in ["yes", "y"] 21 | use_special_chars = input("Include special characters (yes/no)? ").strip().lower() in ["yes", "y"] 22 | 23 | password = generate_password(length, use_digits, use_special_chars) 24 | print("Your random password is:", password) 25 | 26 | if __name__ == "__main__": 27 | main() 28 | 29 | 30 | -------------------------------------------------------------------------------- /Python/removeDuplicate.py: -------------------------------------------------------------------------------- 1 | # Function to remove all duplicates from string 2 | 3 | def removeDuplicate(str): 4 | s=set(str) 5 | s="".join(s) 6 | print("Without Order:",s) 7 | t="" 8 | for i in str: 9 | if(i in t): 10 | pass 11 | else: 12 | t=t+i 13 | print("With Order:",t) 14 | 15 | str="geeksforgeeks" 16 | removeDuplicate(str) 17 | -------------------------------------------------------------------------------- /Python/search_and_replace.py: -------------------------------------------------------------------------------- 1 | class FileModifier: 2 | def __init__(self, file_path): 3 | self.file_path = file_path 4 | 5 | def _load_content(self): 6 | with open(self.file_path, 'r') as f: 7 | return f.read() 8 | 9 | def _save_content(self, new_content): 10 | with open(self.file_path, 'w') as f: 11 | f.write(new_content) 12 | 13 | def modify(self, target, replacement): 14 | content = self._load_content() 15 | if target in content: 16 | updated_content = content.replace(target, replacement) 17 | self._save_content(updated_content) 18 | print(f"Occurrences of '{target}' have been replaced with '{replacement}'.") 19 | else: 20 | print(f"'{target}' not found in the file.") 21 | 22 | def main(): 23 | path = input("Provide the file path: ").strip() 24 | target_text = input("Text to find: ").strip() 25 | replacement_text = input("Text to replace with: ").strip() 26 | 27 | modifier = FileModifier(path) 28 | modifier.modify(target_text, replacement_text) 29 | 30 | if __name__ == "__main__": 31 | main() 32 | -------------------------------------------------------------------------------- /Python/sentense_similarity.py: -------------------------------------------------------------------------------- 1 | class Solution: 2 | def areSentencesSimilar(self, sentence1: str, sentence2: str) -> bool: 3 | # Split the sentences into words 4 | words1 = sentence1.split() 5 | words2 = sentence2.split() 6 | 7 | # Ensure words1 is the longer sentence 8 | if len(words1) < len(words2): 9 | words1, words2 = words2, words1 10 | 11 | start, end = 0, 0 12 | n1, n2 = len(words1), len(words2) 13 | 14 | # Compare from the start 15 | while start < n2 and words1[start] == words2[start]: 16 | start += 1 17 | 18 | # Compare from the end 19 | while end < n2 and words1[n1 - end - 1] == words2[n2 - end - 1]: 20 | end += 1 21 | 22 | # Check if the remaining unmatched part is in the middle 23 | return start + end >= n2 -------------------------------------------------------------------------------- /Python/shellSort.py: -------------------------------------------------------------------------------- 1 | # Shell sort in python 2 | 3 | 4 | def shellSort(array, n): 5 | 6 | # Rearrange elements at each n/2, n/4, n/8, ... intervals 7 | interval = n // 2 8 | while interval > 0: 9 | for i in range(interval, n): 10 | temp = array[i] 11 | j = i 12 | while j >= interval and array[j - interval] > temp: 13 | array[j] = array[j - interval] 14 | j -= interval 15 | 16 | array[j] = temp 17 | interval //= 2 18 | 19 | 20 | data = [9, 8, 3, 7, 5, 6, 4, 1] 21 | size = len(data) 22 | shellSort(data, size) 23 | print('Sorted Array in Ascending Order:') 24 | print(data) 25 | -------------------------------------------------------------------------------- /Python/simplePasswordGenerator.py: -------------------------------------------------------------------------------- 1 | import random 2 | import string 3 | 4 | def generate_password(length): 5 | characters = string.ascii_letters + string.digits + string.punctuation 6 | password = ''.join(random.choice(characters) for _ in range(length)) 7 | return password 8 | 9 | def main(): 10 | try: 11 | length = int(input("Enter the desired length of the password: ")) 12 | if length < 1: 13 | print("Password length should be at least 1 character.") 14 | else: 15 | password = generate_password(length) 16 | print(f"Generated password: {password}") 17 | except ValueError: 18 | print("Invalid input. Please enter a positive integer for password length.") 19 | 20 | if __name__ == "__main__": 21 | main() -------------------------------------------------------------------------------- /Python/squaresum.py: -------------------------------------------------------------------------------- 1 | # Program to find sum of square of first n natural numbers 2 | 3 | # Return the sum of 4 | # square of first n 5 | # natural numbers 6 | 7 | def squaresum(n): 8 | 9 | # Iterate i from 1 10 | # and n finding 11 | # square of i and 12 | # add to sum. 13 | sm = 0 14 | for i in range(1, n+1): 15 | sm = sm + (i * i) 16 | 17 | return sm 18 | 19 | 20 | # Driven Program 21 | n = 4 22 | print(squaresum(n)) 23 | -------------------------------------------------------------------------------- /Python/stack.py: -------------------------------------------------------------------------------- 1 | class Stack: 2 | def __init__(self): 3 | self.items = [] 4 | 5 | def push(self, item): 6 | self.items.append(item) 7 | 8 | def pop(self): 9 | if not self.is_empty(): 10 | return self.items.pop() 11 | 12 | def peek(self): 13 | if not self.is_empty(): 14 | return self.items[-1] 15 | 16 | def is_empty(self): 17 | return len(self.items) == 0 18 | 19 | def size(self): 20 | return len(self.items) 21 | 22 | # Create a new stack 23 | s = Stack() 24 | 25 | # Push some items onto the stack 26 | s.push(1) 27 | s.push(2) 28 | s.push(3) 29 | 30 | # Pop an item from the stack 31 | print(s.pop()) # Output: 3 32 | 33 | # Peek at the top item in the stack 34 | print(s.peek()) # Output: 2 35 | 36 | # Check if the stack is empty 37 | print(s.is_empty()) # Output: False 38 | 39 | # Get the size of the stack 40 | print(s.size()) # Output: 2 -------------------------------------------------------------------------------- /Python/two-sum.py: -------------------------------------------------------------------------------- 1 | class Solution: 2 | def twoSum(self, nums: List[int], target: int) -> List[int]: 3 | for i in range(0, len(nums)): 4 | for j in range(i+1, len(nums)): 5 | if nums[i]+nums[j]== target: 6 | return [i,j] -------------------------------------------------------------------------------- /Python/url_shortener.py: -------------------------------------------------------------------------------- 1 | import pyshorteners 2 | 3 | def shorten_url(url_to_shorten): 4 | s = pyshorteners.Shortener() 5 | shortened_url = s.tinyurl.short(url_to_shorten) 6 | return shortened_url 7 | 8 | if __name__ == "__main__": 9 | url_to_shorten = input("Enter the URL to shorten: ") 10 | shortened_url = shorten_url(url_to_shorten) 11 | print("Shortened URL:", shortened_url) 12 | -------------------------------------------------------------------------------- /Python/web_scrapper.py: -------------------------------------------------------------------------------- 1 | import requests 2 | from bs4 import BeautifulSoup 3 | 4 | def scrape_and_extract_titles(url): 5 | try: 6 | 7 | response = requests.get(url) 8 | 9 | 10 | if response.status_code == 200: 11 | 12 | soup = BeautifulSoup(response.text, 'html.parser') 13 | 14 | 15 | titles = soup.find_all('h2') 16 | 17 | 18 | for title in titles: 19 | print(title.text) 20 | 21 | else: 22 | print(f"Failed to retrieve the web page. Status code: {response.status_code}") 23 | except Exception as e: 24 | print(f"An error occurred: {str(e)}") 25 | 26 | if __name__ == "__main__": 27 | user_url = input("Enter the URL of the web page you want to scrape: ") 28 | scrape_and_extract_titles(user_url) 29 | -------------------------------------------------------------------------------- /Random Forest Classifier/tennis.csv: -------------------------------------------------------------------------------- 1 | outlook,temperature,humidity,windy,class 2 | overcast,hot,high,FALSE,yes 3 | overcast,cool,normal,TRUE,yes 4 | overcast,mild,high,TRUE,yes 5 | overcast,hot,normal,FALSE,yes 6 | rainy,mild,high,FALSE,yes 7 | rainy,cool,normal,FALSE,yes 8 | rainy,cool,normal,TRUE,no 9 | rainy,mild,normal,FALSE,yes 10 | rainy,mild,high,TRUE,no 11 | sunny,hot,high,FALSE,no 12 | sunny,hot,high,TRUE,no 13 | sunny,mild,high,FALSE,no 14 | sunny,cool,normal,FALSE,yes 15 | sunny,mild,normal,TRUE,yes 16 | -------------------------------------------------------------------------------- /React_calculator/.eslintrc.cjs: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | root: true, 3 | env: { browser: true, es2020: true }, 4 | extends: [ 5 | 'eslint:recommended', 6 | 'plugin:react/recommended', 7 | 'plugin:react/jsx-runtime', 8 | 'plugin:react-hooks/recommended', 9 | ], 10 | ignorePatterns: ['dist', '.eslintrc.cjs'], 11 | parserOptions: { ecmaVersion: 'latest', sourceType: 'module' }, 12 | settings: { react: { version: '18.2' } }, 13 | plugins: ['react-refresh'], 14 | rules: { 15 | 'react/jsx-no-target-blank': 'off', 16 | 'react-refresh/only-export-components': [ 17 | 'warn', 18 | { allowConstantExport: true }, 19 | ], 20 | }, 21 | } 22 | -------------------------------------------------------------------------------- /React_calculator/.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | npm-debug.log* 5 | yarn-debug.log* 6 | yarn-error.log* 7 | pnpm-debug.log* 8 | lerna-debug.log* 9 | 10 | node_modules 11 | dist 12 | dist-ssr 13 | *.local 14 | 15 | # Editor directories and files 16 | .vscode/* 17 | !.vscode/extensions.json 18 | .idea 19 | .DS_Store 20 | *.suo 21 | *.ntvs* 22 | *.njsproj 23 | *.sln 24 | *.sw? 25 | -------------------------------------------------------------------------------- /React_calculator/README.md: -------------------------------------------------------------------------------- 1 | # React + Vite 2 | 3 | This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules. 4 | 5 | Currently, two official plugins are available: 6 | 7 | - [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react/README.md) uses [Babel](https://babeljs.io/) for Fast Refresh 8 | - [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh 9 | -------------------------------------------------------------------------------- /React_calculator/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Vite + React 8 | 9 | 10 |
11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /React_calculator/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "x_calculator", 3 | "private": true, 4 | "version": "0.0.0", 5 | "type": "module", 6 | "scripts": { 7 | "dev": "vite", 8 | "build": "vite build", 9 | "lint": "eslint . --ext js,jsx --report-unused-disable-directives --max-warnings 0", 10 | "preview": "vite preview" 11 | }, 12 | "dependencies": { 13 | "react": "^18.2.0", 14 | "react-dom": "^18.2.0" 15 | }, 16 | "devDependencies": { 17 | "@types/react": "^18.2.66", 18 | "@types/react-dom": "^18.2.22", 19 | "@vitejs/plugin-react": "^4.2.1", 20 | "eslint": "^8.57.0", 21 | "eslint-plugin-react": "^7.34.1", 22 | "eslint-plugin-react-hooks": "^4.6.0", 23 | "eslint-plugin-react-refresh": "^0.4.6", 24 | "vite": "^5.2.0" 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /React_calculator/src/App.css: -------------------------------------------------------------------------------- 1 | .calculator { 2 | width: 300px; 3 | margin: auto; 4 | text-align: center; 5 | justify-content: center; 6 | } 7 | 8 | input[type="text"] { 9 | width: 100%; 10 | margin-bottom: 10px; 11 | padding: 10px; 12 | font-size: 20px; 13 | } 14 | 15 | .buttons { 16 | display: grid; 17 | grid-template-columns: repeat(4, 1fr); 18 | grid-gap: 5px; 19 | } 20 | 21 | button { 22 | padding: 10px; 23 | font-size: 20px; 24 | cursor: pointer; 25 | } 26 | 27 | button:hover { 28 | background-color: #ccc; 29 | } 30 | body { 31 | background-color: black; 32 | color: white; /* Optionally, set text color to white for better visibility */ 33 | } 34 | -------------------------------------------------------------------------------- /React_calculator/src/main.jsx: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | import ReactDOM from 'react-dom/client' 3 | import App from './App.jsx' 4 | 5 | ReactDOM.createRoot(document.getElementById('root')).render( 6 | 7 | 8 | , 9 | ) 10 | -------------------------------------------------------------------------------- /React_calculator/vite.config.js: -------------------------------------------------------------------------------- 1 | import { defineConfig } from 'vite' 2 | import react from '@vitejs/plugin-react' 3 | 4 | // https://vitejs.dev/config/ 5 | export default defineConfig({ 6 | plugins: [react()], 7 | }) 8 | -------------------------------------------------------------------------------- /RotatingCard3d/rotating-card-3d/.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | /node_modules 5 | /.pnp 6 | .pnp.js 7 | 8 | # testing 9 | /coverage 10 | 11 | # production 12 | /build 13 | 14 | # misc 15 | .DS_Store 16 | .env.local 17 | .env.development.local 18 | .env.test.local 19 | .env.production.local 20 | 21 | npm-debug.log* 22 | yarn-debug.log* 23 | yarn-error.log* 24 | -------------------------------------------------------------------------------- /RotatingCard3d/rotating-card-3d/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "rotating-card-3d", 3 | "version": "0.1.0", 4 | "private": true, 5 | "dependencies": { 6 | "@testing-library/jest-dom": "^5.17.0", 7 | "@testing-library/react": "^13.4.0", 8 | "@testing-library/user-event": "^13.5.0", 9 | "react": "^18.3.1", 10 | "react-dom": "^18.3.1", 11 | "react-scripts": "5.0.1", 12 | "web-vitals": "^2.1.4" 13 | }, 14 | "scripts": { 15 | "start": "react-scripts start", 16 | "build": "react-scripts build", 17 | "test": "react-scripts test", 18 | "eject": "react-scripts eject" 19 | }, 20 | "eslintConfig": { 21 | "extends": [ 22 | "react-app", 23 | "react-app/jest" 24 | ] 25 | }, 26 | "browserslist": { 27 | "production": [ 28 | ">0.2%", 29 | "not dead", 30 | "not op_mini all" 31 | ], 32 | "development": [ 33 | "last 1 chrome version", 34 | "last 1 firefox version", 35 | "last 1 safari version" 36 | ] 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /RotatingCard3d/rotating-card-3d/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simranlotey/Hacktoberfest/dd6a766af4ba6025b183471d88513c14b3357c00/RotatingCard3d/rotating-card-3d/public/favicon.ico -------------------------------------------------------------------------------- /RotatingCard3d/rotating-card-3d/public/logo192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simranlotey/Hacktoberfest/dd6a766af4ba6025b183471d88513c14b3357c00/RotatingCard3d/rotating-card-3d/public/logo192.png -------------------------------------------------------------------------------- /RotatingCard3d/rotating-card-3d/public/logo512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simranlotey/Hacktoberfest/dd6a766af4ba6025b183471d88513c14b3357c00/RotatingCard3d/rotating-card-3d/public/logo512.png -------------------------------------------------------------------------------- /RotatingCard3d/rotating-card-3d/public/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "short_name": "React App", 3 | "name": "Create React App Sample", 4 | "icons": [ 5 | { 6 | "src": "favicon.ico", 7 | "sizes": "64x64 32x32 24x24 16x16", 8 | "type": "image/x-icon" 9 | }, 10 | { 11 | "src": "logo192.png", 12 | "type": "image/png", 13 | "sizes": "192x192" 14 | }, 15 | { 16 | "src": "logo512.png", 17 | "type": "image/png", 18 | "sizes": "512x512" 19 | } 20 | ], 21 | "start_url": ".", 22 | "display": "standalone", 23 | "theme_color": "#000000", 24 | "background_color": "#ffffff" 25 | } 26 | -------------------------------------------------------------------------------- /RotatingCard3d/rotating-card-3d/public/robots.txt: -------------------------------------------------------------------------------- 1 | # https://www.robotstxt.org/robotstxt.html 2 | User-agent: * 3 | Disallow: 4 | -------------------------------------------------------------------------------- /RotatingCard3d/rotating-card-3d/src/App.css: -------------------------------------------------------------------------------- 1 | .App { 2 | text-align: center; 3 | } 4 | 5 | .App-logo { 6 | height: 40vmin; 7 | pointer-events: none; 8 | } 9 | 10 | @media (prefers-reduced-motion: no-preference) { 11 | .App-logo { 12 | animation: App-logo-spin infinite 20s linear; 13 | } 14 | } 15 | 16 | .App-header { 17 | background-color: #282c34; 18 | min-height: 100vh; 19 | display: flex; 20 | flex-direction: column; 21 | align-items: center; 22 | justify-content: center; 23 | font-size: calc(10px + 2vmin); 24 | color: white; 25 | } 26 | 27 | .App-link { 28 | color: #61dafb; 29 | } 30 | 31 | @keyframes App-logo-spin { 32 | from { 33 | transform: rotate(0deg); 34 | } 35 | to { 36 | transform: rotate(360deg); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /RotatingCard3d/rotating-card-3d/src/App.js: -------------------------------------------------------------------------------- 1 | // App.js 2 | import React from 'react'; 3 | import Card3D from './Card3D'; 4 | import './styles.css'; 5 | 6 | function App() { 7 | return ( 8 |
9 |

3D Rotating Card on Hover with React

10 |

Frontend Dev

Hover to learn more

} 12 | backContent={

Projects

Check out my work

} 13 | /> 14 | 15 | ); 16 | } 17 | 18 | export default App; 19 | -------------------------------------------------------------------------------- /RotatingCard3d/rotating-card-3d/src/App.test.js: -------------------------------------------------------------------------------- 1 | import { render, screen } from '@testing-library/react'; 2 | import App from './App'; 3 | 4 | test('renders learn react link', () => { 5 | render(); 6 | const linkElement = screen.getByText(/learn react/i); 7 | expect(linkElement).toBeInTheDocument(); 8 | }); 9 | -------------------------------------------------------------------------------- /RotatingCard3d/rotating-card-3d/src/Card3D.js: -------------------------------------------------------------------------------- 1 | // Card3D.jsx 2 | import React from 'react'; 3 | import './styles.css'; 4 | 5 | const Card3D = ({ frontContent, backContent }) => { 6 | return ( 7 |
8 |
9 |
10 | {frontContent || ( 11 | <> 12 |

Front Side

13 |

Hover to see more

14 | 15 | )} 16 |
17 |
18 | {backContent || ( 19 | <> 20 |

Back Side

21 |

This card flips on hover with Glassmorphism!

22 | 23 | )} 24 |
25 |
26 |
27 | ); 28 | }; 29 | 30 | export default Card3D; 31 | -------------------------------------------------------------------------------- /RotatingCard3d/rotating-card-3d/src/index.css: -------------------------------------------------------------------------------- 1 | body { 2 | margin: 0; 3 | font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 4 | 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', 5 | sans-serif; 6 | -webkit-font-smoothing: antialiased; 7 | -moz-osx-font-smoothing: grayscale; 8 | } 9 | 10 | code { 11 | font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New', 12 | monospace; 13 | } 14 | -------------------------------------------------------------------------------- /RotatingCard3d/rotating-card-3d/src/index.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import ReactDOM from 'react-dom/client'; 3 | import './index.css'; 4 | import App from './App'; 5 | import reportWebVitals from './reportWebVitals'; 6 | 7 | const root = ReactDOM.createRoot(document.getElementById('root')); 8 | root.render( 9 | 10 | 11 | 12 | ); 13 | 14 | // If you want to start measuring performance in your app, pass a function 15 | // to log results (for example: reportWebVitals(console.log)) 16 | // or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals 17 | reportWebVitals(); 18 | -------------------------------------------------------------------------------- /RotatingCard3d/rotating-card-3d/src/reportWebVitals.js: -------------------------------------------------------------------------------- 1 | const reportWebVitals = onPerfEntry => { 2 | if (onPerfEntry && onPerfEntry instanceof Function) { 3 | import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => { 4 | getCLS(onPerfEntry); 5 | getFID(onPerfEntry); 6 | getFCP(onPerfEntry); 7 | getLCP(onPerfEntry); 8 | getTTFB(onPerfEntry); 9 | }); 10 | } 11 | }; 12 | 13 | export default reportWebVitals; 14 | -------------------------------------------------------------------------------- /RotatingCard3d/rotating-card-3d/src/setupTests.js: -------------------------------------------------------------------------------- 1 | // jest-dom adds custom jest matchers for asserting on DOM nodes. 2 | // allows you to do things like: 3 | // expect(element).toHaveTextContent(/react/i) 4 | // learn more: https://github.com/testing-library/jest-dom 5 | import '@testing-library/jest-dom'; 6 | -------------------------------------------------------------------------------- /Scientific Calculator/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simranlotey/Hacktoberfest/dd6a766af4ba6025b183471d88513c14b3357c00/Scientific Calculator/favicon.png -------------------------------------------------------------------------------- /Searching_Algorithms/C/binarySearch.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() 4 | { 5 | int i, low, high, mid, n, found = 0, size; 6 | printf("Enter the size of the array:"); 7 | scanf("%d", &size); 8 | int a[size]; 9 | printf("Binary Search:\n"); 10 | printf("\nEnter the elements of the array: "); 11 | for (i = 0; i < size; i++) 12 | { 13 | scanf("%d", &a[i]); 14 | } 15 | 16 | printf("\nEnter the element to be searched: "); 17 | scanf("%d", &n); 18 | 19 | low = 0; 20 | high = size - 1; 21 | while (high >= low) 22 | { 23 | mid = (low + high) / 2; 24 | if (n == a[mid]) 25 | { 26 | found = 1; 27 | break; 28 | } 29 | else if (n < a[mid]) 30 | { 31 | high = mid - 1; 32 | } 33 | else 34 | { 35 | low = mid + 1; 36 | } 37 | } 38 | if (found == 1) 39 | { 40 | printf("%d is present in index %d.\n", n, mid); 41 | } 42 | else 43 | { 44 | printf("%d is not present in the array.\n", n); 45 | } 46 | return 0; 47 | } 48 | -------------------------------------------------------------------------------- /Searching_Algorithms/C/linearSearch.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int linearSearch(int array[], int n, int x) 4 | { 5 | 6 | // Going through array sequencially 7 | for (int i = 0; i < n; i++) 8 | if (array[i] == x) 9 | return i; 10 | return -1; 11 | } 12 | 13 | int main() 14 | { 15 | int array[10], size; 16 | int key, i; 17 | printf("Enter the size of the array:"); 18 | scanf("%d",&size); 19 | printf("Linear Search:\n"); 20 | printf("Enter Array Elements:"); 21 | for (i = 0; i < size; i++) 22 | { 23 | scanf("%d", &array[i]); 24 | } 25 | printf("Enter the element to be searched:"); 26 | scanf("%d", &key); 27 | int result = linearSearch(array, size, key); 28 | 29 | (result == -1) ? printf("Element not found\n") : printf("Element found at index: %d\n", result); 30 | } -------------------------------------------------------------------------------- /Searching_Algorithms/Python/binary_search.py: -------------------------------------------------------------------------------- 1 | def binary_search(arr, target): 2 | """ 3 | Perform binary search on the given sorted list. 4 | 5 | Parameters: 6 | - arr: The sorted list to search. 7 | - target: The element to search for. 8 | 9 | Returns: 10 | - index: The index of the target if found, otherwise -1. 11 | """ 12 | low, high = 0, len(arr) - 1 13 | 14 | while low <= high: 15 | mid = (low + high) // 2 16 | if arr[mid] == target: 17 | return mid 18 | elif arr[mid] < target: 19 | low = mid + 1 20 | else: 21 | high = mid - 1 22 | 23 | return -1 24 | 25 | # Example usage: 26 | my_sorted_list = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] 27 | target_value = 7 28 | result = binary_search(my_sorted_list, target_value) 29 | print(f"Binary Search: Target {target_value} {'found' if result != -1 else 'not found'} at index {result}") 30 | -------------------------------------------------------------------------------- /Searching_Algorithms/Python/interpolation_search.py: -------------------------------------------------------------------------------- 1 | def interpolation_search(arr, target): 2 | """ 3 | Perform interpolation search on the given sorted list. 4 | 5 | Parameters: 6 | - arr: The sorted list to search. 7 | - target: The element to search for. 8 | 9 | Returns: 10 | - index: The index of the target if found, otherwise -1. 11 | """ 12 | low, high = 0, len(arr) - 1 13 | 14 | while low <= high and arr[low] <= target <= arr[high]: 15 | mid = low + ((high - low) // (arr[high] - arr[low])) * (target - arr[low]) 16 | 17 | if arr[mid] == target: 18 | return mid 19 | elif arr[mid] < target: 20 | low = mid + 1 21 | else: 22 | high = mid - 1 23 | 24 | return -1 25 | 26 | # Example usage: 27 | my_sorted_list = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] 28 | target_value = 7 29 | result = interpolation_search(my_sorted_list, target_value) 30 | print(f"Interpolation Search: Target {target_value} {'found' if result != -1 else 'not found'} at index {result}") 31 | -------------------------------------------------------------------------------- /Searching_Algorithms/Python/linearSearch.py: -------------------------------------------------------------------------------- 1 | def linear_search(arr, target): 2 | # Iterate through the array element by element. 3 | for i in range(len(arr)): 4 | # If the current element is equal to the target, return its index. 5 | if arr[i] == target: 6 | return i 7 | 8 | # If the target is not found in the array, return -1 to indicate it's not present. 9 | return -1 10 | 11 | # Example usage: 12 | arr = [68, 33, 25, 15, 22, 11, 80] 13 | target = 25 14 | result = linear_search(arr, target) 15 | 16 | if result != -1: 17 | print(f"Element {target} found at index {result}") 18 | else: 19 | print(f"Element {target} not found in the array") 20 | -------------------------------------------------------------------------------- /Shell Script/ShellScript.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Initialize score 4 | score=0 5 | 6 | # Function to ask a question and check the answer 7 | ask_question() { 8 | local question="$1" 9 | local answer="$2" 10 | 11 | echo -e "Question: $question" 12 | read -p "Your answer: " user_answer 13 | 14 | if [ "$user_answer" = "$answer" ]; then 15 | echo "Correct!" 16 | ((score++)) 17 | else 18 | echo "Incorrect. The correct answer is: $answer" 19 | fi 20 | echo 21 | } 22 | 23 | # Main quiz 24 | clear 25 | echo "Welcome to the Quiz!" 26 | echo 27 | 28 | ask_question "What is the capital of France?" "Paris" 29 | ask_question "What is the largest planet in our solar system?" "Jupiter" 30 | ask_question "How many continents are there on Earth?" "7" 31 | ask_question "What is the boiling point of water in Celsius?" "100" 32 | 33 | # Display the final score 34 | clear 35 | echo "Quiz completed! Your score: $score / 4" 36 | -------------------------------------------------------------------------------- /Shell Script/backup.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # To use, make sure you have rsync pkg 4 | # And then, 5 | # -> backup folderName folderNameForBackup 6 | # 7 | # Check to make sure the user has entered exactly two arguements. 8 | if [ $# -ne 2 ] 9 | then 10 | echo "Usage: backup.sh " 11 | echo "Please try again." 12 | exit 1 13 | fi 14 | 15 | # Check rsync installation 16 | if ! command -v rsync > /dev/null 2>&1 17 | # command -v packageName, to check for package and send msgs to /dev/null 18 | then 19 | echo "This script requires rsync to be installed." 20 | echo "Please use your distribution's package manager to install it" 21 | exit 2 22 | fi 23 | 24 | # get date and store in the format YYYY-MM-DD 25 | current_date=$(date +%Y-%m-%d) 26 | 27 | rsync_options="-avb --backup-dir $2/$current_date --delete" 28 | # -a(archieve) v(verbose) b( Creates backups), $2/$current_date -> our fileName , --delete will sync with files ( meaning, if we delete one script that has backup, then backup file will be deleted too 29 | 30 | $(which rsync) $rsync_options $1 $2/current >> backup_$current_date.log # $(which rsync) runs rsync in sub-shell 31 | 32 | -------------------------------------------------------------------------------- /Shell Script/check_FilePermission.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Check the permissions on the file 3 | 4 | echo "Enter file path:" 5 | read filepath 6 | if [ -r $filepath ]; then 7 | echo "File is readable." 8 | fi 9 | if [ -w $filepath ]; then 10 | echo "File is writable." 11 | fi 12 | if [ -x $filepath ]; then 13 | echo "File is executable." 14 | fi 15 | -------------------------------------------------------------------------------- /Shell Script/copyFile.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Copy a file in [new] directory (location) 3 | 4 | echo "Enter source file: " 5 | read source 6 | 7 | echo "Enter destination file: " 8 | read dest 9 | 10 | cp $source $dest 11 | echo "File copied successfully!" -------------------------------------------------------------------------------- /Shell Script/dbBackup.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # To backup database 3 | 4 | username="enter username here" 5 | password="enter password here" 6 | database="database_name" 7 | backup_dir="/Users/ab01/Library/CloudStorage/OneDrive-AmityUniversity/Programming/Shell" 8 | 9 | mysqldump -u $username -p$password $database > $backup_dir/db_backup_$(date +%Y%m%d%H%M%S).sql 10 | echo "Database backup created: db_backup_$(date +%Y%m%d%H%M%S).sql" 11 | -------------------------------------------------------------------------------- /Shell Script/dirSize.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Calculte the size of a directory 3 | 4 | echo "Enter directory path:" 5 | read dirpath 6 | total_size=$(du -sh $dirpath | cut -f1) 7 | echo "Total size of $dirpath: $total_size" 8 | -------------------------------------------------------------------------------- /Shell Script/fizzBuzz/fizzBuzz.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | for ((i = 1; i <= 100; i++)); do 4 | if ((i % 3 == 0)) && ((i % 5 == 0)); then 5 | echo "FizzBuzz" 6 | elif ((i % 3 == 0)); then 7 | echo "Fizz" 8 | elif ((i % 5 == 0)); then 9 | echo "Buzz" 10 | else 11 | echo "$i" 12 | fi 13 | done 14 | -------------------------------------------------------------------------------- /Shell Script/makexe.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | sudo chmod +x $1 3 | 4 | # Makes any file executable 5 | # To use: 6 | # -> makexe fileName.extension -------------------------------------------------------------------------------- /Shell Script/pwdgen.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Password Generator 4 | # To use: 5 | # -> pwdgen.sh lengthValueInString 6 | # E.g: pwdgen.sh 9 7 | 8 | all_chars="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%^&*(_)-+=<>?" 9 | 10 | pwd_gen(){ 11 | local password_len="$1" 12 | local password="" 13 | 14 | for ((i = 0; i < password_len; i++)); do 15 | # $RANDOM = random num from 0-32767, ${#string} -> gives length, basically generate a index of 0 - str_len -1; 16 | index=$((RANDOM % ${#all_chars})) 17 | # extracting text of generated index. 18 | password="$password${all_chars:index:1}" 19 | done 20 | 21 | echo $password 22 | } 23 | 24 | pwd_generated=$(pwd_gen $1) 25 | echo $pwd_generated; 26 | 27 | 28 | -------------------------------------------------------------------------------- /Shell Script/reverseargu.sh: -------------------------------------------------------------------------------- 1 | // QUESTION:: reverse a string using shell script 2 | // reverse a string is in linux and unix 3 | 4 | 5 | 6 | #!/ bin / bash 7 | 8 | // reading a string 9 | // using via user input 10 | 11 | read - p "Enter string:" string 12 | 13 | // getting the length of given string 14 | 15 | 16 | len 17 | = $ 18 | { 19 | #string 20 | } 21 | 22 | 23 | // looping for reversing a string 24 | // initialize i=len-1 for reversing a string and run till i=0 25 | // printing in the reverse order of the given string 26 | 27 | 28 | for ((i = $len - 1; i >= 0; i--)) 29 | do 30 | 31 | // "${string:$i:1}"extract single character from string. 32 | 33 | reverse = "$reverse${string:$i:1}" done 34 | echo "$reverse" 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /Shell Script/shellscript.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Initialize score 4 | score=0 5 | 6 | # Function to ask a question and check the answer 7 | ask_question() { 8 | local question="$1" 9 | local answer="$2" 10 | 11 | echo -e "Question: $question" 12 | read -p "Your answer: " user_answer 13 | 14 | if [ "$user_answer" = "$answer" ]; then 15 | echo "Correct!" 16 | ((score++)) 17 | else 18 | echo "Incorrect. The correct answer is: $answer" 19 | fi 20 | echo 21 | } 22 | 23 | # Main quiz 24 | clear 25 | echo "Welcome to the Quiz!" 26 | echo 27 | 28 | ask_question "What is the capital of France?" "Paris" 29 | ask_question "What is the largest planet in our solar system?" "Jupiter" 30 | ask_question "How many continents are there on Earth?" "7" 31 | ask_question "What is the boiling point of water in Celsius?" "100" 32 | 33 | # Display the final score 34 | clear 35 | echo "Quiz completed! Your score: $score / 4" 36 | -------------------------------------------------------------------------------- /Shell Script/systemMonitoring.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Monitors the CPU and Memory usage of the system using ps 3 | # To use, make sure to grant execute permissions to the script using: 4 | # -> chmod +x SystemMonitoring.sh 5 | 6 | # Get CPU Usage 7 | cpu_usage=$(ps aux | awk 'NR > 0 { s +=$3 }; END {print s "%"}') 8 | 9 | # Get Memory Usage 10 | memory_usage=$(ps aux | awk 'NR > 0 { s +=$4 }; END {print s "%"}') 11 | 12 | echo "CPU Usage: $cpu_usage" 13 | echo "Memory Usage: $memory_usage" 14 | -------------------------------------------------------------------------------- /Ships-On-Fire/Ship.log: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simranlotey/Hacktoberfest/dd6a766af4ba6025b183471d88513c14b3357c00/Ships-On-Fire/Ship.log -------------------------------------------------------------------------------- /Simple Calculator/script.js: -------------------------------------------------------------------------------- 1 | function appendToDisplay(value) { 2 | document.getElementById('display').value += value; 3 | } 4 | 5 | function clearDisplay() { 6 | document.getElementById('display').value = ''; 7 | } 8 | 9 | function calculateResult() { 10 | try { 11 | const expression = document.getElementById('display').value; 12 | const result = eval(expression); 13 | document.getElementById('display').value = result; 14 | } catch (error) { 15 | document.getElementById('display').value = 'Error'; 16 | } 17 | } -------------------------------------------------------------------------------- /Simple Calculator/style.css: -------------------------------------------------------------------------------- 1 | body { 2 | font-family: Arial, sans-serif; 3 | background-color: #101820; 4 | 5 | display: flex; 6 | justify-content: center; 7 | align-items: center; 8 | height: 100vh; 9 | margin: 0; 10 | } 11 | 12 | .calculator { 13 | background-color: #dbce80; 14 | box-shadow: 0 0 10px rgba(0, 0, 0, 0.2); 15 | border-radius: 5px; 16 | padding: 20px; 17 | text-align: center; 18 | } 19 | 20 | h1 { 21 | color: #333; 22 | } 23 | 24 | #display { 25 | width: 90%; 26 | padding: 10px; 27 | margin: 10px 0; 28 | font-size: 24px; 29 | background-color: #eaf7d6; 30 | border: none; 31 | border-radius: 10px; 32 | color: #333; 33 | } 34 | 35 | button { 36 | width: 50px; 37 | height: 50px; 38 | margin: 5px; 39 | font-size: 20px; 40 | border: none; 41 | background-color: #4CAF50; 42 | color: #fff; 43 | border-radius: 5px; 44 | cursor: pointer; 45 | } 46 | 47 | button:hover { 48 | background-color: #45a049; 49 | } -------------------------------------------------------------------------------- /Simple Clock/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Digital Clock 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /Simple Clock/script.js: -------------------------------------------------------------------------------- 1 | function updateClock() { 2 | const clockElement = document.getElementById("clock"); 3 | const now = new Date(); 4 | 5 | const hours = now.getHours().toString().padStart(2, "0"); 6 | const minutes = now.getMinutes().toString().padStart(2, "0"); 7 | const seconds = now.getSeconds().toString().padStart(2, "0"); 8 | 9 | clockElement.textContent = `${hours}:${minutes}:${seconds}`; 10 | } 11 | 12 | setInterval(updateClock, 1000); 13 | 14 | updateClock(); -------------------------------------------------------------------------------- /Simple Clock/style.css: -------------------------------------------------------------------------------- 1 | body { 2 | font-family: Arial, sans-serif; 3 | background-color: #1f1f1f; 4 | display: flex; 5 | justify-content: center; 6 | align-items: center; 7 | height: 100vh; 8 | margin: 0; 9 | flex-direction: column; 10 | } 11 | 12 | #clock { 13 | font-size: 12vw; 14 | background-color: #2a2a2a; 15 | color: #fff; 16 | padding: 10px 20px; 17 | border-radius: 2vw; 18 | box-shadow: 0 0 20px rgba(0, 0, 0, 0.5); 19 | } -------------------------------------------------------------------------------- /Simple Quote Generator/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Random Quote Generator 7 | 8 | 9 | 10 |
11 |

Click the button to get a random quote.

12 |

13 | 14 |
15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /Simple Quote Generator/style.css: -------------------------------------------------------------------------------- 1 | body { 2 | font-family: Arial, sans-serif; 3 | text-align: center; 4 | } 5 | 6 | #quote-container { 7 | max-width: 400px; 8 | margin: 0 auto; 9 | padding: 20px; 10 | border: 1px solid #ccc; 11 | border-radius: 5px; 12 | background-color: #f9f9f9; 13 | } 14 | 15 | #quote { 16 | font-size: 18px; 17 | margin-bottom: 10px; 18 | } 19 | 20 | #author { 21 | font-style: italic; 22 | } 23 | 24 | #new-quote-button { 25 | background-color: #0074D9; 26 | color: #fff; 27 | border: none; 28 | border-radius: 5px; 29 | padding: 10px 20px; 30 | cursor: pointer; 31 | transition: background-color 0.3s; 32 | } 33 | 34 | #new-quote-button:hover { 35 | background-color: #0056b3; 36 | } 37 | -------------------------------------------------------------------------------- /Snake Game/snake.css: -------------------------------------------------------------------------------- 1 | /* Write CSS Here */ 2 | body { 3 | text-align: center; 4 | } 5 | .geeks { 6 | font-size: 40px; 7 | font-weight: bold; 8 | color: green; 9 | } 10 | -------------------------------------------------------------------------------- /Snake Game/snake.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 8 | Snake Game with GFG 9 | 10 | 11 | 12 | 13 | 14 |

Snake Game 15 |
SNAKE
16 |

17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /Snake/resources/apple.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simranlotey/Hacktoberfest/dd6a766af4ba6025b183471d88513c14b3357c00/Snake/resources/apple.jpg -------------------------------------------------------------------------------- /Snake/resources/background.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simranlotey/Hacktoberfest/dd6a766af4ba6025b183471d88513c14b3357c00/Snake/resources/background.jpg -------------------------------------------------------------------------------- /Snake/resources/bg_music_1.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simranlotey/Hacktoberfest/dd6a766af4ba6025b183471d88513c14b3357c00/Snake/resources/bg_music_1.mp3 -------------------------------------------------------------------------------- /Snake/resources/block.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simranlotey/Hacktoberfest/dd6a766af4ba6025b183471d88513c14b3357c00/Snake/resources/block.jpg -------------------------------------------------------------------------------- /Snake/resources/crash.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simranlotey/Hacktoberfest/dd6a766af4ba6025b183471d88513c14b3357c00/Snake/resources/crash.mp3 -------------------------------------------------------------------------------- /Snake/resources/ding.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simranlotey/Hacktoberfest/dd6a766af4ba6025b183471d88513c14b3357c00/Snake/resources/ding.mp3 -------------------------------------------------------------------------------- /Sorting_Algorithms/C++/bubbleSort.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int main() 5 | { 6 | int i, j, n, temp, arr[10]; 7 | printf("Bubble Sort:\n"); 8 | 9 | printf("Enter the numbers element of the array: "); 10 | scanf("%d", &n); 11 | 12 | printf("\nEnter the elements of the array: "); 13 | for (i = 0; i < n; i++) 14 | { 15 | scanf("%d", &arr[i]); 16 | } 17 | 18 | for (i = 0; i < n; i++) 19 | { 20 | for (j = 0; j < n - i - 1; j++) 21 | { 22 | if (arr[j] > arr[j + 1]) 23 | { 24 | temp = arr[j]; 25 | arr[j] = arr[j + 1]; 26 | arr[j + 1] = temp; 27 | } 28 | } 29 | } 30 | 31 | printf("\nSorted Array is: \n"); 32 | for (i = 0; i < n; i++) 33 | { 34 | printf("%d ", arr[i]); 35 | } 36 | printf("\n"); 37 | getch(); 38 | return 0; 39 | } 40 | -------------------------------------------------------------------------------- /Sorting_Algorithms/C++/insertionSort.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | int main() 3 | { 4 | int n, i, j, temp; 5 | int arr[64]; 6 | printf("Insertion Sort:\n"); 7 | printf("Enter number of elements\n"); 8 | scanf("%d", &n); 9 | printf("Enter the numbers:"); 10 | for (i = 0; i < n; i++) 11 | { 12 | scanf("%d", &arr[i]); 13 | } 14 | for (i = 1; i < n; i++) 15 | { 16 | j = i; 17 | while (j > 0 && arr[j - 1] > arr[j]) 18 | { 19 | temp = arr[j]; 20 | arr[j] = arr[j - 1]; 21 | arr[j - 1] = temp; 22 | j--; 23 | } 24 | } 25 | printf("Sorted list in ascending order:"); 26 | for (i = 0; i < n; i++) 27 | printf("\t%d", arr[i]); 28 | printf("\n"); 29 | return 0; 30 | } 31 | -------------------------------------------------------------------------------- /Sorting_Algorithms/C++/selectionSort.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | int main() 3 | { 4 | int a[100], n, i, j, position, swap; 5 | printf("Selection Sort:\n"); 6 | printf("Enter number of elements:"); 7 | scanf("%d", &n); 8 | printf("Enter %d Numbers:", n); 9 | for (i = 0; i < n; i++) 10 | scanf("%d", &a[i]); 11 | for (i = 0; i < n - 1; i++) 12 | { 13 | position = i; 14 | for (j = i + 1; j < n; j++) 15 | { 16 | if (a[position] > a[j]) 17 | position = j; 18 | } 19 | if (position != i) 20 | { 21 | swap = a[i]; 22 | a[i] = a[position]; 23 | a[position] = swap; 24 | } 25 | } 26 | printf("Sorted Array:"); 27 | for (i = 0; i < n; i++) 28 | printf("\t%d", a[i]); 29 | printf("\n"); 30 | return 0; 31 | } 32 | -------------------------------------------------------------------------------- /Sorting_Algorithms/C++/shellSort.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | void ShellSort(int a[], int n) 3 | { 4 | int i, j, increment, tmp; 5 | for (increment = n / 2; increment > 0; increment /= 2) 6 | { 7 | for (i = increment; i < n; i++) 8 | { 9 | tmp = a[i]; 10 | for (j = i; j >= increment; j -= increment) 11 | { 12 | if (tmp < a[j - increment]) 13 | a[j] = a[j - increment]; 14 | else 15 | break; 16 | } 17 | a[j] = tmp; 18 | } 19 | } 20 | } 21 | 22 | int main() 23 | { 24 | int i, n, a[10]; 25 | printf("Shell Sort:\n"); 26 | printf("Enter the number of elements : "); 27 | scanf("%d", &n); 28 | printf("Enter the elements : "); 29 | for (i = 0; i < n; i++) 30 | { 31 | scanf("%d", &a[i]); 32 | } 33 | ShellSort(a, n); 34 | printf("The sorted elements are : "); 35 | for (i = 0; i < n; i++) 36 | printf("%d ", a[i]); 37 | printf("\n"); 38 | return 0; 39 | } 40 | -------------------------------------------------------------------------------- /Sorting_Algorithms/Python/heapSort.py: -------------------------------------------------------------------------------- 1 | 2 | def heapify(arr, N, i): 3 | largest = i # Initialize largest as root 4 | l = 2 * i + 1 # left = 2*i + 1 5 | r = 2 * i + 2 # right = 2*i + 2 6 | 7 | # See if left child of root exists and is 8 | # greater than root 9 | if l < N and arr[largest] < arr[l]: 10 | largest = l 11 | 12 | # See if right child of root exists and is 13 | # greater than root 14 | if r < N and arr[largest] < arr[r]: 15 | largest = r 16 | 17 | # Change root, if needed 18 | if largest != i: 19 | arr[i], arr[largest] = arr[largest], arr[i] # swap 20 | 21 | # Heapify the root. 22 | heapify(arr, N, largest) 23 | 24 | def heapSort(arr): 25 | N = len(arr) 26 | 27 | # Build a maxheap. 28 | for i in range(N//2 - 1, -1, -1): 29 | heapify(arr, N, i) 30 | 31 | # One by one extract elements 32 | for i in range(N-1, 0, -1): 33 | arr[i], arr[0] = arr[0], arr[i] # swap 34 | heapify(arr, i, 0) 35 | 36 | 37 | # Driver's code 38 | if __name__ == '__main__': 39 | arr = [12, 11, 13, 5, 6, 7] 40 | 41 | # Function call 42 | heapSort(arr) 43 | N = len(arr) 44 | 45 | print("Sorted array is") 46 | for i in range(N): 47 | print("%d" % arr[i], end=" ") 48 | -------------------------------------------------------------------------------- /Stop Watch/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 8 | 10 | Stopwatch 11 | 12 | 13 | 14 | 15 |
16 |

Stop Watch

17 |
18 | 19 | 00 20 | : 21 | 22 | 00 23 | : 24 | 25 | 00 26 | : 27 | 28 | 00 29 |
30 |
31 | 33 | 35 | 37 |
38 |
39 | 40 | 41 | 42 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /Stop Watch/style.css: -------------------------------------------------------------------------------- 1 | body { 2 | padding: 0; 3 | margin: 0; 4 | font-family: verdana; 5 | } 6 | 7 | .container { 8 | display: flex; 9 | flex-direction: column; 10 | justify-content: center; 11 | align-items: center; 12 | width: 100%; 13 | height: 100vh; 14 | } 15 | 16 | h1 { 17 | text-align: center; 18 | } 19 | 20 | .digit, 21 | .txt { 22 | font-size: 100px; 23 | } 24 | 25 | #buttons { 26 | margin-top: 50px; 27 | } 28 | 29 | .btn { 30 | width: 100px; 31 | margin: 0px 20px; 32 | border-top-right-radius: 10px; 33 | border-bottom-left-radius: 10px; 34 | border-bottom-right-radius: 4px; 35 | border-top-left-radius: 4px; 36 | transition: 0.5s; 37 | font-weight: 500; 38 | padding: 10px 20px; 39 | font-size: 1em; 40 | background-color: #0074d9; 41 | color: #fff; 42 | border: none; 43 | cursor: pointer; 44 | } -------------------------------------------------------------------------------- /TodoJs/todojs.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Document 7 | 8 | 9 |

TODO List

10 | 11 | 12 |
    13 |
  • sleep
  • 14 |
  • study
  • 15 |
  • playing
  • 16 |
17 | 18 | 19 | -------------------------------------------------------------------------------- /TodoJs/todojs.js: -------------------------------------------------------------------------------- 1 | let input=document.querySelector("input"); 2 | let btn=document.querySelector("button"); 3 | let ull=document.querySelector("ul"); 4 | 5 | btn.addEventListener("click", function (){ 6 | let i=document.createElement("li"); 7 | i.innerText=input.value; 8 | let del=document.createElement("button"); 9 | del.innerText="delete"; 10 | del.classList.add("delete"); 11 | i.appendChild(del); 12 | 13 | ull.appendChild(i); 14 | input.value=" "; 15 | }) 16 | //let dell=document.querySelectorAll(".delete"); 17 | // for(btns of dell){ 18 | // btns.addEventListener("click",function(){ 19 | // let par=this.parentElement; 20 | // par.remove(); 21 | // }) 22 | // } 23 | ull.addEventListener("click",function(event){ 24 | if(event.target.nodeName=="BUTTON"){ 25 | let ff=event.target.parentElement; 26 | ff.remove(); 27 | } 28 | }) -------------------------------------------------------------------------------- /TypeScript/MatrixMultiplication.ts: -------------------------------------------------------------------------------- 1 | function multiplyMatrices(matrixA: number[][], matrixB: number[][]): number[][] { 2 | const rowsA = matrixA.length; 3 | const colsA = matrixA[0].length; 4 | const rowsB = matrixB.length; 5 | const colsB = matrixB[0].length; 6 | 7 | if (colsA !== rowsB) { 8 | throw new Error("Incompatible matrices for multiplication"); 9 | } 10 | 11 | const result: number[][] = new Array(rowsA); 12 | for (let i = 0; i < rowsA; i++) { 13 | result[i] = new Array(colsB).fill(0); 14 | } 15 | 16 | for (let i = 0; i < rowsA; i++) { 17 | for (let j = 0; j < colsB; j++) { 18 | for (let k = 0; k < colsA; k++) { 19 | result[i][j] += matrixA[i][k] * matrixB[k][j]; 20 | } 21 | } 22 | } 23 | 24 | return result; 25 | } 26 | 27 | /* Testcase: 28 | const matrixA: number[][] = [[2, 3], [4, 1]]; 29 | const matrixB: number[][] = [[5, 6], [7, 8]]; 30 | 31 | try { 32 | const result = multiplyMatrices(matrixA, matrixB); 33 | console.log("Matrix A * Matrix B:"); 34 | for (let row of result) { 35 | console.log(row.join(" ")); 36 | } 37 | } catch (error) { 38 | console.error(error.message); 39 | } 40 | */ 41 | -------------------------------------------------------------------------------- /TypeScript/SecondSmallestNumber.ts: -------------------------------------------------------------------------------- 1 | function findSecondSmallestNumber(arr: number[]): number { 2 | if (arr.length < 2) { 3 | throw new Error("Array should contain at least two elements"); 4 | } 5 | 6 | let smallest = Number.MAX_VALUE; 7 | let secondSmallest = Number.MAX_VALUE; 8 | 9 | for (const num of arr) { 10 | if (num < smallest) { 11 | secondSmallest = smallest; 12 | smallest = num; 13 | } else if (num < secondSmallest && num !== smallest) { 14 | secondSmallest = num; 15 | } 16 | } 17 | 18 | if (secondSmallest === Number.MAX_VALUE) { 19 | throw new Error("No second smallest number found in the array"); 20 | } 21 | 22 | return secondSmallest; 23 | } 24 | 25 | // Testcase: 26 | /*const numbers = [5, 2, 9, 1, 5, 6]; 27 | const secondSmallest = findSecondSmallestNumber(numbers); 28 | console.log("The second smallest number is: " + secondSmallest); 29 | */ 30 | -------------------------------------------------------------------------------- /TypeScript/cryptoGraphicHash.ts: -------------------------------------------------------------------------------- 1 | // write program to convert string into SHA-256 hash code 2 | 3 | import * as crypto from "crypto" 4 | 5 | function calculateSHA256Hash(data: string): string { 6 | // Create a hash object 7 | const sha256Hash = crypto.createHash("sha256") 8 | 9 | // Update the hash with the data 10 | sha256Hash.update(data, "utf8") 11 | 12 | // hexadecimal representation of the hash 13 | const hashHex: string = sha256Hash.digest("hex") 14 | 15 | return hashHex 16 | } 17 | 18 | const data: string = "Hello World" 19 | const hash: string = calculateSHA256Hash(data) 20 | 21 | console.log("SHA-256 Hash:", hash) 22 | -------------------------------------------------------------------------------- /TypeScript/jsonValidator.ts: -------------------------------------------------------------------------------- 1 | type Schema = Record; 2 | 3 | function validateJSONAgainstSchema(json: any, schema: Schema): boolean { 4 | for (const key in schema) { 5 | if (schema.hasOwnProperty(key)) { 6 | const expectedType = schema[key]; 7 | const actualType = typeof json[key]; 8 | 9 | if (actualType !== expectedType) { 10 | console.error(`Validation error for key "${key}": Expected type "${expectedType}", but got "${actualType}".`); 11 | return false; 12 | } 13 | } 14 | } 15 | 16 | return true; 17 | } 18 | 19 | // Example usage 20 | const jsonToValidate = { 21 | name: "John Doe", 22 | age: 30, 23 | email: "johndoe@example.com", 24 | }; 25 | 26 | const userSchema: Schema = { 27 | name: "string", 28 | age: "number", 29 | email: "string", 30 | }; 31 | 32 | const isValid = validateJSONAgainstSchema(jsonToValidate, userSchema); 33 | if (isValid) { 34 | console.log("JSON is valid according to the schema."); 35 | } else { 36 | console.error("JSON is not valid according to the schema."); 37 | } 38 | -------------------------------------------------------------------------------- /TypeScript/matrixMultiplication.ts: -------------------------------------------------------------------------------- 1 | function multiplyMatrices(matrixA: number[][], matrixB: number[][]): number[][] { 2 | const rowsA = matrixA.length; 3 | const colsA = matrixA[0].length; 4 | const rowsB = matrixB.length; 5 | const colsB = matrixB[0].length; 6 | 7 | if (colsA !== rowsB) { 8 | throw new Error("Incompatible matrices for multiplication"); 9 | } 10 | 11 | const result: number[][] = new Array(rowsA); 12 | for (let i = 0; i < rowsA; i++) { 13 | result[i] = new Array(colsB).fill(0); 14 | } 15 | 16 | for (let i = 0; i < rowsA; i++) { 17 | for (let j = 0; j < colsB; j++) { 18 | for (let k = 0; k < colsA; k++) { 19 | result[i][j] += matrixA[i][k] * matrixB[k][j]; 20 | } 21 | } 22 | } 23 | 24 | return result; 25 | } 26 | 27 | /* Testcase: 28 | const matrixA: number[][] = [[2, 3], [4, 1]]; 29 | const matrixB: number[][] = [[5, 6], [7, 8]]; 30 | 31 | try { 32 | const result = multiplyMatrices(matrixA, matrixB); 33 | console.log("Matrix A * Matrix B:"); 34 | for (let row of result) { 35 | console.log(row.join(" ")); 36 | } 37 | } catch (error) { 38 | console.error(error.message); 39 | } 40 | */ 41 | -------------------------------------------------------------------------------- /TypeScript/secondSmallest.ts: -------------------------------------------------------------------------------- 1 | function findSecondSmallest(arr: number[]): number | null { 2 | if (arr.length < 2) { 3 | console.error("The array should contain at least two numbers."); 4 | return null; 5 | } 6 | 7 | let smallest = Infinity; 8 | let secondSmallest = Infinity; 9 | 10 | for (let num of arr) { 11 | if (num < smallest) { 12 | secondSmallest = smallest; 13 | smallest = num; 14 | } else if (num < secondSmallest && num !== smallest) { 15 | secondSmallest = num; 16 | } 17 | } 18 | 19 | if (secondSmallest === Infinity) { 20 | console.error("There is no second smallest number in the array."); 21 | return null; 22 | } 23 | 24 | return secondSmallest; 25 | } 26 | 27 | // Example usage 28 | const array = [5, 3, 8, 1, 9, 2, 4]; 29 | const secondSmallest = findSecondSmallest(array); 30 | 31 | if (secondSmallest !== null) { 32 | console.log("The second smallest number is:", secondSmallest); 33 | } 34 | -------------------------------------------------------------------------------- /TypeScript/sorting_strings_array.ts: -------------------------------------------------------------------------------- 1 | function sortStringsArray(arr: string[]): string[] { 2 | let res: string[] = Object.assign([], arr); 3 | return res.sort((a, b) => a.toLowerCase().localeCompare(b.toLowerCase())); 4 | } -------------------------------------------------------------------------------- /Whac-a-mole/bush.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simranlotey/Hacktoberfest/dd6a766af4ba6025b183471d88513c14b3357c00/Whac-a-mole/bush.png -------------------------------------------------------------------------------- /Whac-a-mole/mole.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simranlotey/Hacktoberfest/dd6a766af4ba6025b183471d88513c14b3357c00/Whac-a-mole/mole.png -------------------------------------------------------------------------------- /Whack a Mole Game/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | Whack a Mole 9 | 10 | 11 | 12 |

Whack-a-mole! 0

13 | 14 |
15 | 16 |
17 | 18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /animated loading spinner/RONALDO2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simranlotey/Hacktoberfest/dd6a766af4ba6025b183471d88513c14b3357c00/animated loading spinner/RONALDO2.jpg -------------------------------------------------------------------------------- /blog#249/.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "liveServer.settings.port": 5501 3 | } -------------------------------------------------------------------------------- /blog#249/bg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simranlotey/Hacktoberfest/dd6a766af4ba6025b183471d88513c14b3357c00/blog#249/bg.png -------------------------------------------------------------------------------- /blog#249/mobile.css: -------------------------------------------------------------------------------- 1 | @media(max-width:810px){ 2 | .search{ 3 | display: none; 4 | } 5 | .about{ 6 | display: none; 7 | } 8 | } 9 | @media(max-width:690px){ 10 | .sidebar_container{ 11 | display: none; 12 | } 13 | .articles_space{ 14 | display: flex; 15 | justify-content: center; 16 | align-items: center; 17 | } 18 | } -------------------------------------------------------------------------------- /blog#249/write.css: -------------------------------------------------------------------------------- 1 | body{ 2 | background: linear-gradient(90deg, #12122a, #1818ac); 3 | } 4 | 5 | 6 | .art_single_title{width: 100%; 7 | border: none; 8 | outline: none; 9 | border-radius: 6px; 10 | background: rgba(0,0,0,0.2); 11 | height: 2.5rem; 12 | padding-left: 6px; 13 | border-left: 3px solid blue; 14 | 15 | } 16 | 17 | .art_single_post { 18 | border: none; 19 | padding: 17px; 20 | background-color: rgb(0, 0, 0,0.2); 21 | border-radius: 10px; 22 | font-size: 17px; 23 | height: 100vh; 24 | width: 100%; 25 | outline: none; 26 | margin-bottom: -1rem; 27 | border-left: 3px solid blue; 28 | 29 | } 30 | 31 | .articles_space{ 32 | flex-wrap: wrap; 33 | } 34 | 35 | .art_btn{ 36 | margin-top: 3rem; 37 | border: none; 38 | margin-bottom: 5px; 39 | outline: none; 40 | padding: 1rem 1rem; 41 | font-weight: bolder; 42 | letter-spacing: 2px; 43 | text-transform: uppercase; 44 | font-size: 1rem; 45 | margin-bottom: 2rem; 46 | } -------------------------------------------------------------------------------- /brick breaker game/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | Brick Breaker 9 | 10 | 11 |

Brick Breaker

12 | 13 |

Click to begin. Use the mouse to move the paddle. If there are no bricks left, let the ball touch the paddle to 14 | finish the game.

15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /brick breaker game/style.css: -------------------------------------------------------------------------------- 1 | body { 2 | display: flex; 3 | flex-direction: column; 4 | justify-content: center; 5 | text-align: center; 6 | font-family: monospace; 7 | background-color: #DDD; 8 | } 9 | 10 | p { 11 | font-size: 1.5em; 12 | font-weight: bold; 13 | width: 600px; 14 | margin: auto; 15 | margin-bottom: 20px; 16 | } 17 | 18 | #gameCanvas { 19 | margin: auto; 20 | border-radius: 5px; 21 | } -------------------------------------------------------------------------------- /guess-the-number-game/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Guess the Number Game 5 | 6 | 7 | 8 | 9 |
10 |

Guess the Number Game

11 |

Guess a number between 1 and 100:

12 | 13 | 14 |

15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /guess-the-number-game/script.js: -------------------------------------------------------------------------------- 1 | const randomNumber = Math.floor(Math.random() * 100) + 1; 2 | 3 | let attempts = 0; 4 | 5 | function checkGuess() { 6 | const guessInput = document.getElementById('guess'); 7 | const message = document.getElementById('message'); 8 | const userGuess = parseInt(guessInput.value); 9 | attempts++; 10 | 11 | if (userGuess === randomNumber) { 12 | message.innerHTML = `Congratulations! You guessed the number ${randomNumber} in ${attempts} attempts.`; 13 | message.style.color = 'green'; 14 | guessInput.disabled = true; 15 | } else if (userGuess < randomNumber) { 16 | message.innerHTML = `Try a higher number. Attempts: ${attempts}`; 17 | message.style.color = 'red'; 18 | } else { 19 | message.innerHTML = `Try a lower number. Attempts: ${attempts}`; 20 | message.style.color = 'red'; 21 | } 22 | 23 | guessInput.value = ''; 24 | } -------------------------------------------------------------------------------- /guess-the-number-game/styles.css: -------------------------------------------------------------------------------- 1 | body { 2 | font-family: Arial, sans-serif; 3 | text-align: center; 4 | } 5 | 6 | #container { 7 | margin: 20px auto; 8 | max-width: 400px; 9 | border: 1px solid #ccc; 10 | padding: 20px; 11 | background-color: #f5f5f5; 12 | } -------------------------------------------------------------------------------- /java/ATM.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simranlotey/Hacktoberfest/dd6a766af4ba6025b183471d88513c14b3357c00/java/ATM.class -------------------------------------------------------------------------------- /java/BubbleSort.java: -------------------------------------------------------------------------------- 1 | class BubbleSort { 2 | void bubbleSort(int arr[]) 3 | { 4 | int n = arr.length; 5 | 6 | for (int i = 0; i < n - 1; i++) 7 | for (int j = 0; j < n - i - 1; j++) 8 | if (arr[j] > arr[j + 1]) { 9 | //swapping 10 | int temp = arr[j]; 11 | arr[j] = arr[j + 1]; 12 | arr[j + 1] = temp; 13 | } 14 | } 15 | public static void main(String args[]) 16 | { 17 | BubbleSort ob = new BubbleSort(); 18 | int a[] = { 64, 34, 25, 12 }; 19 | 20 | ob.bubbleSort(a); 21 | 22 | int n = a.length; 23 | 24 | for (int i = 0; i < n; ++i) 25 | System.out.print(a[i] + " "); 26 | System.out.println(); 27 | } 28 | } -------------------------------------------------------------------------------- /java/ButterflyPattern.java: -------------------------------------------------------------------------------- 1 | import java.util.Scanner; 2 | 3 | public class ButterflyPattern { 4 | public static void main(String[] args) { 5 | int i, j, n; 6 | Scanner sc = new Scanner(System.in); 7 | n = sc.nextInt(); 8 | // upper half of the pattern 9 | for (i = 0; i < n; i++) { 10 | for (j = 0; j < (2 * n); j++) { 11 | if (i >= j) // upper left triangle 12 | System.out.print("*"); 13 | else 14 | System.out.print(" "); 15 | if (i >= (2 * n - 1) - j) // upper right triangle 16 | System.out.print("*"); 17 | else 18 | System.out.print(" "); 19 | } 20 | System.out.println(""); 21 | } 22 | // bottom half of the pattern 23 | for (i = 0; i < n; i++) { 24 | for (j = 0; j < (2 * n); j++) { 25 | if (i + j <= n - 1) // bottom left triangle 26 | System.out.print("*"); 27 | else 28 | System.out.print(" "); 29 | if ((i + n) <= j) // bottom right triangle 30 | System.out.print("*"); 31 | else 32 | System.out.print(" "); 33 | } 34 | System.out.println(""); 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /java/Celsius_to_Fahrenheit.java: -------------------------------------------------------------------------------- 1 | import java.util.Scanner; 2 | 3 | public class CelsiusToFahrenheit { 4 | public static void main(String[] args) { 5 | Scanner scanner = new Scanner(System.in); 6 | 7 | System.out.print("Enter a temperature in Celsius: "); 8 | double celsius = scanner.nextDouble(); 9 | 10 | double fahrenheit = (celsius * 9/5) + 32; 11 | 12 | System.out.println("The temperature in Fahrenheit is: " + fahrenheit); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /java/HollowDiamond.java: -------------------------------------------------------------------------------- 1 | public class hollow { 2 | public static void main(String[] args){ 3 | Scanner sc=new Scanner(System.in); 4 | System.out.println("Enter a number for Hollow Diamond Pattern : "); 5 | int n=sc.nextInt(); 6 | 7 | // upper half of the pattern 8 | for(int i=1;i<=n;i++){ 9 | 10 | for(int j=n-i;j>=0;j--){ 11 | System.out.print("*"); 12 | } 13 | 14 | for(int k=2*(i-1);k>0;k--){ 15 | System.out.print(" "); 16 | } 17 | for(int l=n-i;l>=0;l--){ 18 | System.out.print("*"); 19 | } 20 | System.out.println(); 21 | } 22 | // lower half of the pattern 23 | for(int i=0;i0;k--){ 28 | System.out.print(" "); 29 | } 30 | for(int m=0;m<=i;m++){ 31 | System.out.print("*"); 32 | } 33 | System.out.println(); 34 | } 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /java/JaggedArray.java: -------------------------------------------------------------------------------- 1 | public class JaggedArray 2 | { 3 | public static void main(String[] args) { 4 | int[][] jaggedArray={{1,2},{3,4,5},{6,7},{8,9,10,11}}; 5 | for(int i=0;iarr[mid]) start=mid+1; 12 | else end=mid-1; 13 | } 14 | else{ 15 | if(target= 0; i--) { 14 | int digit = binaryNumber.charAt(i) - '0'; 15 | decimalNumber += digit * Math.pow(2, power); 16 | power++; 17 | } 18 | 19 | System.out.println("The decimal equivalent of the binary number is: " + decimalNumber); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /java/bubble-sort.java: -------------------------------------------------------------------------------- 1 | package sorting; 2 | 3 | import java.util.Scanner; 4 | 5 | public class bubble_sort { 6 | static void bubblesort(int arr[], int n, int i, int j) 7 | { 8 | int temp; 9 | for(i=0;iarr[j+1]){ 12 | temp=arr[j]; 13 | arr[j]=arr[j+1]; 14 | arr[j+1]=temp; 15 | } 16 | } 17 | } 18 | 19 | } 20 | 21 | public static void main(String[] args) { 22 | Scanner input = new Scanner(System.in); 23 | System.out.println("Enter the size of array: "); 24 | int n = input.nextInt(); 25 | int [] arr = new int[n]; 26 | int i; 27 | System.out.print("Enter "+ n + " element of array: "); 28 | for(i=0;i{ 8 | loginbox.classList.add('active'); 9 | }) 10 | loginLink.addEventListener('click',()=>{ 11 | loginbox.classList.remove('active'); 12 | }) 13 | 14 | navbtnlog.addEventListener('click',()=>{ 15 | loginbox.classList.add('active-popup'); 16 | }) 17 | 18 | closebutton.addEventListener('click',()=>{ 19 | loginbox.classList.remove('active-popup'); 20 | }) -------------------------------------------------------------------------------- /responsive nav bar/nav.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Responsive Navigation Bar 8 | 9 | 10 |
11 | 24 |
25 |
26 | 27 |
28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /responsive nav bar/nav.js: -------------------------------------------------------------------------------- 1 | function toggleMenu() { 2 | const menu = document.querySelector('.nav-links'); 3 | menu.classList.toggle('active'); 4 | } 5 | -------------------------------------------------------------------------------- /rock_paper_scissors/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Rock Paper Scissors 7 | 8 | 9 | 10 | 11 |

rock-paper-scissors

12 |
13 | 14 | 15 | 16 |
17 | 18 |
19 |
20 | You: 21 | 0 22 |
23 |
24 | Computer: 25 | 0 26 |
27 |
28 | 29 |
30 | 31 | 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /rock_paper_scissors/style.css: -------------------------------------------------------------------------------- 1 | 2 | 3 | @import url('https://fonts.googleapis.com/css?family=Acme&display=swap'); 4 | 5 | body { 6 | margin-top: 100px; 7 | background-color: white; 8 | } 9 | 10 | .selections { 11 | display: flex; 12 | justify-content: center; 13 | } 14 | 15 | .selection { 16 | background: none; 17 | border: none; 18 | outline: none; 19 | cursor: pointer; 20 | font-size: 4rem; 21 | transition: 100ms; 22 | } 23 | 24 | .selection:hover { 25 | transform: scale(1.2); 26 | } 27 | 28 | .results { 29 | margin-top: 1rem; 30 | display: grid; 31 | justify-content: center; 32 | grid-template-columns: repeat(2, 1fr); 33 | justify-items: center; 34 | font-size: 30px; 35 | font-family: Acme; 36 | align-items: center; 37 | } 38 | 39 | .result-score { 40 | margin-left: .1rem; 41 | font-size: 1.5rem; 42 | color: #333; 43 | } 44 | 45 | .result-selection { 46 | opacity: .5; 47 | } 48 | 49 | .result-selection.winner { 50 | opacity: 1; 51 | font-size: 2rem; 52 | } 53 | 54 | .h1 { 55 | text-align: center; 56 | font-size: 50px; 57 | font-family: Acme; 58 | } -------------------------------------------------------------------------------- /rust-minigrep/Cargo.lock: -------------------------------------------------------------------------------- 1 | # This file is automatically @generated by Cargo. 2 | # It is not intended for manual editing. 3 | version = 3 4 | 5 | [[package]] 6 | name = "minigrep" 7 | version = "0.1.0" 8 | -------------------------------------------------------------------------------- /rust-minigrep/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "minigrep" 3 | version = "0.1.0" 4 | edition = "2021" 5 | 6 | [dependencies] 7 | -------------------------------------------------------------------------------- /rust-minigrep/poem.txt: -------------------------------------------------------------------------------- 1 | I'm nobody! Who are you? 2 | Are you nobody, too? 3 | Then there's a pair of us - don't tell! 4 | They'd banish us, you know. 5 | 6 | How dreary to be somebody! 7 | How public, like a frog 8 | To tell your name the livelong day 9 | To an admiring bog! 10 | -------------------------------------------------------------------------------- /rust-minigrep/src/main.rs: -------------------------------------------------------------------------------- 1 | use std::{env,process}; 2 | use minigrep::Config; 3 | 4 | fn main() { 5 | 6 | let config = Config::build(env::args()).unwrap_or_else(|err|{ 7 | eprintln!("Problem prasing {}" ,err); 8 | process::exit(0); 9 | }); 10 | 11 | println!("Searching for {}", config.query); 12 | println!("In file {}", config.file_path); 13 | 14 | if let Err(e) = minigrep::run(config){ 15 | eprintln!("An error {e} occured"); 16 | process::exit(0); 17 | }; 18 | 19 | } 20 | 21 | -------------------------------------------------------------------------------- /simon Game/sounds/blue.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simranlotey/Hacktoberfest/dd6a766af4ba6025b183471d88513c14b3357c00/simon Game/sounds/blue.mp3 -------------------------------------------------------------------------------- /simon Game/sounds/green.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simranlotey/Hacktoberfest/dd6a766af4ba6025b183471d88513c14b3357c00/simon Game/sounds/green.mp3 -------------------------------------------------------------------------------- /simon Game/sounds/red.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simranlotey/Hacktoberfest/dd6a766af4ba6025b183471d88513c14b3357c00/simon Game/sounds/red.mp3 -------------------------------------------------------------------------------- /simon Game/sounds/wrong.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simranlotey/Hacktoberfest/dd6a766af4ba6025b183471d88513c14b3357c00/simon Game/sounds/wrong.mp3 -------------------------------------------------------------------------------- /simon Game/sounds/yellow.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simranlotey/Hacktoberfest/dd6a766af4ba6025b183471d88513c14b3357c00/simon Game/sounds/yellow.mp3 -------------------------------------------------------------------------------- /snake/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Snake Game 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /snake/style.css: -------------------------------------------------------------------------------- 1 | #game-canvas { 2 | border: 1px solid black; 3 | border-radius: 5px; 4 | box-shadow: 0 0 5px rgba(0, 0, 0, 0.5); 5 | background-image: linear-gradient(to right, rgb(20, 20, 20), rgb(59, 58, 58),rgb(35, 34, 34)); 6 | } 7 | 8 | .snake { 9 | position: absolute; 10 | background-color: rgb(255, 255, 255); 11 | animation: snake-move 1s linear infinite; 12 | } 13 | 14 | @keyframes snake-move { 15 | 0% { 16 | transform: translateX(0px); 17 | } 18 | 19 | 100% { 20 | transform: translateX(10px); 21 | } 22 | } 23 | 24 | .food { 25 | position: absolute; 26 | background-color: red; 27 | outline: 2px solid yellow; 28 | } -------------------------------------------------------------------------------- /sync-upstream-repo: -------------------------------------------------------------------------------- 1 | sync-upstream-repo https://github.com/dabreadman/sync-upstream-repo keeping CI alive. UNIX Time: 1699027111 2 | -------------------------------------------------------------------------------- /urlShortener-TS/README.md: -------------------------------------------------------------------------------- 1 | # Url Shortener 2 | 3 | ## To Use 4 | 5 | 1. Navigate to the jsFile directory: 6 | ```sh 7 | cd ./jsFile 8 | ``` 9 | 10 | 2. Run file 11 | ```sh 12 | node . 13 | ``` 14 | 15 | ## To make changes 16 | 17 | 1. Install packages dependency: 18 | ```sh 19 | npm install 20 | ``` 21 | 22 | 2. Run gulpFile: 23 | ```sh 24 | gulp 25 | ``` 26 | ### You can now make changes to "index.ts" and it'll automatically be reflected in "./jsFile/index.js" -------------------------------------------------------------------------------- /urlShortener-TS/gulpFile.js: -------------------------------------------------------------------------------- 1 | // for typescript 2 | const gulp = require('gulp'); 3 | const ts = require('gulp-typescript'); 4 | const tsProject = ts.createProject('tsconfig.json') 5 | 6 | const { src, dest, watch, series} = require ('gulp') 7 | 8 | 9 | // compile ts 10 | function buildTs(){ 11 | return gulp.src("./*.ts") 12 | .pipe(tsProject()) 13 | .js.pipe(dest('./jsFile')) 14 | } 15 | 16 | function watchTask() { 17 | watch(['./*.ts'], buildTs) 18 | } 19 | 20 | exports.default = series(buildTs, watchTask) -------------------------------------------------------------------------------- /urlShortener-TS/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "urlshortner-ts", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "keywords": [], 10 | "author": "", 11 | "license": "ISC", 12 | "devDependencies": { 13 | "gulp": "^4.0.2", 14 | "gulp-typescript": "^6.0.0-alpha.1" 15 | }, 16 | "dependencies": { 17 | "urlshortner-ts": "file:" 18 | } 19 | } 20 | --------------------------------------------------------------------------------