Skip to content

Instantly share code, notes, and snippets.

View Anselmoo's full-sized avatar
🗯️

Anselm Hahn Anselmoo

🗯️
View GitHub Profile
@Anselmoo
Anselmoo / merge_textfiles.py
Created May 24, 2024 04:27
✨Merge all types of text files 📚 into 1️⃣
import argparse
from pathlib import Path
def merge_textfiles_files(directory, output_file, file_format):
with open(output_file, 'w') as outfile:
for file in sorted(Path(directory).rglob(f'*.{file_format}')):
with open(file, 'r') as infile:
outfile.write(infile.read())
outfile.write("\n\n")
@Anselmoo
Anselmoo / cross4sourcery.py
Created February 9, 2023 16:39
Cross check of /= and += operators
def case_1() -> None:
"""Case 1: regular integer incrementation"""
for _ in range(10):
i = i + 1
print(i)
def case_2() -> None:
"""Case 2: integer incrementation with division"""
i: float = 1.0
@Anselmoo
Anselmoo / aliases.fish
Last active August 7, 2022 16:52
fish functions
alias df 'df -m'
alias j jobs
alias l ls
alias ll 'ls -la'
alias ls 'ls -FG'
alias su 'su -m'
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: check-yaml
exclude: mkdocs.yml
- id: check-toml
- id: check-json
- id: check-symlinks
- id: end-of-file-fixer
c.InteractiveShellApp.exec_lines = [
"import numpy as np",
"import pandas as pd"
]
c.TerminalInteractiveShell.color_info = True
c.TerminalInteractiveShell.colors = 'NoColor'
c.TerminalInteractiveShell.highlight_matching_brackets = True
c.TerminalInteractiveShell.highlighting_style = "dracula"
import pandas as pd
df = pd.util.testing.makeDataFrame()
@Anselmoo
Anselmoo / transformcolumn.ipynb
Created January 25, 2021 18:43
TransformColumn
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.