View download-file-in-web.js
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(); | |
} |
View auto-click.py
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() |
View restore.js
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; |
View update_query.py
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)) |
View cat_style.sh
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 |
View upload_file.js
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", { |
View create_array.js
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) |
View grep.ps1
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 | |
} |
View show.ps1
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 |
View test.js
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