Skip to content

Instantly share code, notes, and snippets.

Avatar

Hsin Yuan Yeh iapyeh

  • IIS Academia Sinica
  • Taipei Taiwan
View GitHub Profile
@iapyeh
iapyeh / gist:6513244bd2b983b66970cf953004cbfa
Created Jan 14, 2021
Access private files on NAS by samba in python3
View gist:6513244bd2b983b66970cf953004cbfa
# 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,
@iapyeh
iapyeh / gist:7c17b8b7684557f495bd50952586f34f
Last active Jan 14, 2021
getting password and switching between debug mode and productive mode
View gist:7c17b8b7684557f495bd50952586f34f
#!/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