Skip to content

Instantly share code, notes, and snippets.

@zephyrdark
zephyrdark / recreate_git_layout.sh
Created May 18, 2026 02:43
[Git repo migration]
# 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:-.}"
@zephyrdark
zephyrdark / export_git_layout.sh
Created May 18, 2026 02:39
[Git repo migration] Part 1 of 2
# 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}"
@zephyrdark
zephyrdark / Program.cs
Last active March 17, 2024 07:42
C# HackerEarth - Chocolate stack
// 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()
{
@zephyrdark
zephyrdark / gist:a445bacda434217de8ac7b96c7e029aa
Created December 8, 2018 03:25
length width pallet pattern wip
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)")
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])
@zephyrdark
zephyrdark / gist:db3c6eb25ca7da52bd800f2e8dcaea93
Last active November 12, 2018 08:01
Practice Python 09 Guessing Game
# 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"
@zephyrdark
zephyrdark / gist:23725fe4657b091af94c43b93edfde40
Last active November 12, 2018 07:13
Practice Python 08 Rock Paper Scissors
import random
# players choose whether to restart
def res():
restart = ["Y", "N"]
print("Continue? Y/N?")
r = input()
if r == restart[0]:
@zephyrdark
zephyrdark / gist:46cf7b0222c1dc6d873417fce14be650
Created November 12, 2018 05:11
Practice Python 07 List Comprehensions
# 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)
@zephyrdark
zephyrdark / gist:d4e6756da2c90d317c36b0181349f112
Last active November 12, 2018 05:12
Practice Python 06 String Lists
# 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!")