This file contains 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
function download(source) { | |
const fileName = source.split("/").pop(); | |
let el = document.createElement("a"); | |
el.setAttribute("href", source); | |
el.setAttribute("download", fileName); | |
document.body.appendChild(el); | |
el.click(); | |
el.remove(); | |
} |
This file contains 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
# press Esc to exit app | |
# click mouse mid button to switch working | |
from operator import eq | |
import time | |
from pynput.mouse import Button, Controller | |
from pynput import mouse | |
from pynput import keyboard | |
mouseCtrl = Controller() |
This file contains 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
// 概念就是導向新的 iframe 裡面去, 金夭壽XDD | |
// https://stackoverflow.com/a/7089553/6573523 | |
var i = document.createElement('iframe'); | |
i.style.display = 'none'; | |
document.body.appendChild(i); | |
window.console = i.contentWindow.console; |
This file contains 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
# ref: https://stackoverflow.com/questions/2506379/add-params-to-given-url-in-python | |
import urllib.parse as urlparse | |
from urllib.parse import urlencode | |
url = "http://home.your/echo?id=22" | |
data = {'name': 'nacl', 'age': 18} | |
# 轉換並拆解成陣列 | |
url_parts = list(urlparse.urlparse(url)) |
This file contains 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/sh | |
cat <<EOF >/path/to/config.json | |
{ "ip": "$ip"} | |
EOF |
This file contains 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
function upload(txt) { | |
// wrapper by Blob | |
const blob = new Blob([txt], { type: "text/html" }); | |
// warpper by File | |
const file = new File([blob], "test.plan"); | |
const formData = new FormData(); | |
formData.append("File", file); | |
fetch("http://localhost/upload", { |
This file contains 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
// [1, 1, 1, 1, 1] | |
[...new Array(5)].map(() => 1) | |
// [0, 1, 2, 3, 4] | |
[...new Array(5)].map((_, index) => index) |
This file contains 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
function grep { | |
$input | Out-String -Stream | Select-String -Pattern $args | |
} |
This file contains 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
$PROFILE |
This file contains 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
fetch('http://localhost:8888/test', { | |
method: 'POST', | |
body: JSON.stringify({ name: 'NaCl' }), | |
headers: { | |
'content-type': 'application/json' | |
} | |
}) |
NewerOlder