Skip to content

Instantly share code, notes, and snippets.

@zeta709
Last active December 21, 2015 14:49
Show Gist options
  • Select an option

  • Save zeta709/6322465 to your computer and use it in GitHub Desktop.

Select an option

Save zeta709/6322465 to your computer and use it in GitHub Desktop.
short tips; delete a newline at end of file; pygmentize; random password generator

작은 팁 모음

  • gist 설명 부분에 내용을 적어야 빠른 검색이 된다.
# how-can-i-delete-a-newline-if-it-is-the-last-character-in-a-file
# http://stackoverflow.com/a/1654042
perl -pe 'chomp if eof' filename > filename2
# edit in place
perl -i -pe 'chomp if eof' filename
# random password generator
import random
import string
chars = string.ascii_letters + string.digits
chars += '!"#$%&\'()*+,-./:;<=>?@[\\]^_`{|}~'
size = 12
''.join(random.SystemRandom().choice(chars) for x in range(size))
pygmentize -f rtf -O style=default,fontface="Consolas" -l c -o hello.rtf hello.c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment