This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Part 2 of 2: Git repo migration. For migrating git repos from old machine to new machine. | |
| # Usage: ./recreate_git_layout.sh my-repos.tsv ~/code | |
| #!/usr/bin/env bash | |
| set -euo pipefail | |
| MANIFEST_FILE="${1:-git-repos-manifest.tsv}" | |
| TARGET_ROOT="${2:-.}" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Part 1 of 2: Git repo migration. For migrating git repos on your current machine to another target machine. | |
| # Usage: ./export_git_layout.sh ~/code my-repos.tsv | |
| #!/usr/bin/env bash | |
| set -euo pipefail | |
| ROOT_DIR="${1:-.}" | |
| OUTPUT_FILE="${2:-git-repos-manifest.tsv}" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // https://www.hackerearth.com/practice/data-structures/stacks/basics-of-stacks/practice-problems/algorithm/chocolate-stack-746c1b56/ | |
| using System; | |
| using System.IO; | |
| using System.Linq; | |
| public class HelloWorld | |
| { | |
| static public void Main() | |
| { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| pallet_length = 1200 | |
| pallet_width = 1000 | |
| carton_length = 0 | |
| carton_width = 0 | |
| def set_carton_size(): | |
| global carton_length | |
| global carton_width | |
| print("Enter carton length (mm)") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| tutlist = ["1", "2", "3", "4", "5", "6", "7", "8", "9"] | |
| table = ["_", "_", "_", "_", "_", "_", "_", "_", "_"] | |
| print("") | |
| print("Welcome to Tic-Tac-Toe!") | |
| print("Player 1 = X\nPlayer 2 = O") | |
| print("") | |
| print("Game Board here Board choices") | |
| print("V=============V V=============V") | |
| print(table[:3], " - ", tutlist[:3]) | |
| print(table[3:6], " - ", tutlist[3:6]) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Generate a random number between 1 and 9 (including 1 and 9). | |
| # Ask the user to guess the number, | |
| # then tell them whether its too low, too high, or exactly right. | |
| # Extra: Keep game going until user types 'exit' | |
| # Extra2: Keep track of how many guesses made, and print it when game ends | |
| import random | |
| t = 0 | |
| x = random.randrange(1, 10) | |
| e = "exit" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import random | |
| # players choose whether to restart | |
| def res(): | |
| restart = ["Y", "N"] | |
| print("Continue? Y/N?") | |
| r = input() | |
| if r == restart[0]: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # takes this list a and makes a new list that has only the even elements of this list in it | |
| a = [1, 4, 9, 16, 25, 36, 49, 64, 81, 100] | |
| print([i for i in a if i % 2 == 0]) | |
| ''' | |
| b = [] | |
| for i in a: | |
| if i % 2 == 0: | |
| b.append(i) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Ask the user for a string and print out whether this string is a palindrome or not | |
| # after realising x[::-] gives a reverse of x ... | |
| x = input("Give me a word, numbers or a mixture of them\n") | |
| if x == x[::-1]: | |
| print(x + " is a palindrome!") | |
| else: | |
| print(x + " is not a palindrome!") |