cp -rl source_directory destination_directory
rsync -a --link-dest=/path/to/source_directory/ source_directory/ destination_directory/
#!/bin/sh | |
# Windows REN equivalent | |
ren() { | |
local source="$1" | |
local target="$2" | |
# Basic validation | |
if [ ! -e "$source" ]; then | |
echo "The system cannot find the file specified: $source" >&2 |
#!/bin/bash | |
mpushd () | |
{ | |
local newdir | |
if [ -d "$1" ]; then | |
echo "$1 exists..." | |
newdir="$1" | |
else | |
if [ -n "$2" ]; then |
To convert a list (which may contain nested lists) into a tuple that can be used as a dictionary key in Python, you need to recursively convert all lists to tuples. Here's how you can do it:
def list_to_tuple(lst):
"""Recursively convert lists to tuples to make them hashable."""
return tuple(list_to_tuple(x) if isinstance(x, list) else x for x in lst)
# Example usage:
🚀 Joining Dictionaries in Python 3: Different Versions, Different Ways! 🐍
Are you working with dictionaries in Python? Did you know the syntax for merging them has evolved across Python 3 versions? Here’s a quick guide:
Use the update()
method or dictionary unpacking inside a new dict:
dict1 = {'a': 1}
dict2 = {'b': 2}
merged = dict1.copy()
JavaScript is a powerful but quirky language with several pitfalls that can trip up developers, especially those new to the language. Here are some of the most common ones:
console.log(1 + "1"); // "11" (string concatenation)
console.log("1" - 1); // 0 (numeric subtraction)
console.log([] == ![]); // true (wat?!)
#!/bin/bash | |
# Check if input files are provided | |
if [ $# -eq 0 ]; then | |
echo "Usage: $0 file1.mp4 [file2.mp4 ...]" | |
echo "Converts MP4 files to MKV using stream copy (no re-encoding) and deletes original if successful." | |
exit 1 | |
fi | |
# Process each file |