Skip to content

Instantly share code, notes, and snippets.

View iapyeh's full-sized avatar

Hsin Yuan Yeh iapyeh

  • IIS Academia Sinica
  • Taipei Taiwan
View GitHub Profile
@iapyeh
iapyeh / gist:7c17b8b7684557f495bd50952586f34f
Last active January 14, 2021 08:31
getting password and switching between debug mode and productive mode
#!/bin/bash
# getdatafromemail.py read password by password = sys.stdin.read()
if [ -z "$1" ] || [ "productive" != "$1" ]; then
# run by "run.getdatafromemail.sh" or "run.getdatafromemail.sh whatever_except_productive"
password=PASSWORD
echo "----debugging mode----"
if [ $password = "PASSWORD" ]; then
echo "entr password to receive email"
read -s password
@iapyeh
iapyeh / gist:6513244bd2b983b66970cf953004cbfa
Created January 14, 2021 04:27
Access private files on NAS by samba in python3
# install the dependence by "python3 -m pip install pysmb"
from smb import SMBConnection
def CheckFilesInNASbySamba():
username = 'username'
password = 'password'
path = r'fs/folder/whatever'
system_name = '192.168.0.1'
domain = ''
try:
conn = SMBConnection.SMBConnection(username,password,path,system_name,domain,