Skip to content

Instantly share code, notes, and snippets.

View junetech's full-sized avatar

Juntaek HONG junetech

  • Pohang, Korea
  • 07:16 (UTC +09:00)
View GitHub Profile
@ziadoz
ziadoz / .gitattributes
Last active June 3, 2024 05:40
Prevent Git Managing CSV Line Endings
# Prevent Git managing line endings of CSV files, otherwise it changes CRLF to LF on commit and checkout.
# This is useful if you're working with CSV files that come from legacy systems and have differing line endings.
#
# You can see view how Git manages line endings with this command: git ls-files --eol | grep .csv
#
# @see: https://git-scm.com/docs/gitattributes
# @see: https://stackoverflow.com/questions/17628305/windows-git-warning-lf-will-be-replaced-by-crlf-is-that-warning-tail-backwar
# @see: https://stackoverflow.com/questions/42667996/enforce-core-autocrlf-input-through-gitattributes
# @see: https://stackoverflow.com/questions/20496084/git-status-ignore-line-endings-identical-files-windows-linux-environment
# @see: https://stackoverflow.com/questions/21822650/disable-git-eol-conversions
@ByoungInKim
ByoungInKim / create_directory.py
Last active May 30, 2024 08:33
python - create directory if path if it doesn`t exist for file write
import os
directory = '/home/kenny/gist'
if not os.path.exists(directory):
os.makedirs(directory)
@jhamrick
jhamrick / savefig.py
Last active March 18, 2024 20:47
Function for saving figures from pyplot.
import os
import matplotlib.pyplot as plt
def save(path, ext='png', close=True, verbose=True):
"""Save a figure from pyplot.
Parameters
----------
path : string
The path (and filename, without the extension) to save the
from contextlib import contextmanager
import sys, os
@contextmanager
def suppress_stdout():
with open(os.devnull, "w") as devnull:
old_stdout = sys.stdout
sys.stdout = devnull
try:
yield