This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
echo $0 | |
fullpath=$(realpath $0) | |
echo ${fullpath} | |
dirpath=$(dirname $fullpath) | |
echo ${dirpath} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func! Encode_euckr() | |
" Don't change to euc-kr for these file formats | |
if &ft =~ 'py\|robot\|yaml' | |
return | |
endif | |
if &fileencoding != "cp949" && &fileencoding != "euc-kr" | |
if confirm("File encoding is not euc-kr. Change it?", "&Yes\n&No", 1) == 1 | |
set fileencoding=euc-kr | |
endif |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def detect_encoding(file_path): | |
with open(file_path, 'rb') as f: | |
b = f.read(4) | |
if (b[0:3] == b'\xef\xbb\xbf'): | |
return 'utf-8' | |
if ((b[0:2] == b'\xfe\xff') or (b[0:2] == b'\xff\xfe')): | |
return 'utf-16' | |
if ((b[0:5] == b'\xfe\xff\x00\x00') or (b[0:5] == b'\x00\x00\xff\xfe')): | |
return 'utf-32' | |
return 'euc-kr' # default value |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
#-*- coding: utf-8 -*- | |
# Test data including the secret key, ip, port numbers and the hash values | |
# as the result is from "Intel Ethernet Controller 710 Series Datasheet". | |
KEY=[] | |
def reset_key(): | |
global KEY |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
#-*- coding: utf-8 -*- | |
from Crypto.Cipher import PKCS1_v1_5 | |
from Crypto.PublicKey import RSA | |
from Crypto.Hash import SHA | |
from Crypto import Random | |
import base64 | |
import StringIO | |
# passphrase, random string => private key, public key pair |