Skip to content

Instantly share code, notes, and snippets.

@ashitaka1963
ashitaka1963 / sftp.py
Created July 6, 2022 21:56
[SFTP通信] paramikoを使用したSFTP通信 #paramiko
import paramiko
with paramiko.SSHClient() as client:
HOSTNAME = '127.0.0.1'
USERNAME = 'ashitaka1963'
PASSWORD = 'password'
REMOTE_PATH = '/home/ashitaka1963/test.txt'
LOCAL_PATH = '.\\bk\\bk_test.txt'
@ashitaka1963
ashitaka1963 / ssh_connect.py
Created July 5, 2022 22:22
[SSH接続]paramikoを使用したSSH接続 #paramiko
import paramiko
with paramiko.SSHClient() as client:
HOSTNAME = '127.0.0.1'
USERNAME = 'ashitaka1963'
KEY_FILENAME = 'C:\\ssh\\wsl_ubuntu'
PASSWORD = 'password'
LINUX_COMMAND = 'pwd' # カレントディレクトリを表示
# {key1:value1,key2:value2,key3:value3}
# 宣言
mydict = {"apple":1, "orange":2, "banana":3}
# キーから値を取得
val = mydict["apple"]
print(val) # 1
print(mydict) # {'apple': 1, 'orange': 2, 'banana': 3}
@ashitaka1963
ashitaka1963 / delete_dupli_list_val.py
Created April 27, 2020 22:21
リストの重複削除
list = [1, 1, 2, 3, 3, 4]
print(set(list)) # {1, 2, 3, 4}
print(len(set(list))) # 4
# 参考
# [配列の重複を削除・抽出する|Python - suzu6](https://www.suzu6.net/posts/97-python-duplication/)
@ashitaka1963
ashitaka1963 / cnt_str.py
Created April 24, 2020 12:35
特定文字列の数をカウント
s = "ZABCDBABCQ"
cnt = s.count("ABC")
print(cnt) # 2
@ashitaka1963
ashitaka1963 / background.js
Last active April 23, 2020 22:11
DevToolsを非表示にする #Electron #Vue.js
function createWindow () {
// Create the browser window.
win = new BrowserWindow({
width: 800,
height: 600,
webPreferences: {
nodeIntegration: true
}
})
@ashitaka1963
ashitaka1963 / exponentiation.py
Created April 18, 2020 23:45
べき乗演算子
n=2
for i in range(10):
print(n**i, end="")
print(" ", end="")
print(pow(n,i), end="")
print()
# 2 2
# 4 4
@ashitaka1963
ashitaka1963 / デザインCSS.css
Last active April 18, 2020 01:44
グローバルナビゲーション
#nav{
background: #1F2123; /* ナビゲーションバー全体の背景色 */
}
#globalmenu{
width: 60%; /* ナビゲーションバークリック部分の背景色 */
margin: 0 auto 40px;
height: 50px; /* 高さ */
padding: 0;
list-style-type: none; /* リストのマーク非表示 */
@ashitaka1963
ashitaka1963 / reverse_str.py
Last active April 16, 2020 23:00
文字列の反転
# 文字列
s='abc'
print(s[::-1]) # cba
# リスト
s=['a','b','c']
print(s[::-1]) # ['c', 'b', 'a']
@ashitaka1963
ashitaka1963 / math_Ceil.py
Created April 15, 2020 13:54
切り上げ
a = 2.2
b = 3.5
print(math.ceil(a)) # 3
print(math.ceil(b)) # 4