Skip to content

Instantly share code, notes, and snippets.

View iamspark1e's full-sized avatar
🎶
The Real Folk Blues

Wenbo iamspark1e

🎶
The Real Folk Blues
View GitHub Profile
@iamspark1e
iamspark1e / npx-npm-update.sh
Last active March 28, 2022 05:34
Using interactive mode with npm, like `yarn upgrade-interactive`
# Using interactive mode, like `yarn upgrade-interactive`
npx npm-check -u
function changepic(obj) {
//console.log(obj.files[0]);//这里可以获取上传文件的name
var newsrc = getObjectURL(obj.files[0]);
document.getElementById('show').src = newsrc;
}
//建立一個可存取到該file的url
function getObjectURL(file) {
var url = null;
// 下面函数执行的效果是一样的,只是需要针对不同的浏览器执行不同的 js 函数而已
if (window.createObjectURL != undefined) { // basic
@iamspark1e
iamspark1e / serialize.js
Last active October 30, 2023 06:00
Javascript Form Serialize with pure JS, modified from "https://code.google.com/archive/p/form-serialize/"
function serialize(form, hashmode) {
if (!form || form.nodeName !== "FORM") {
return
}
var i, j, q = [];
var hashmap = {};
for (i = form.elements.length - 1; i >= 0; i = i - 1) {
if (form.elements[i].name === "") {
continue
}
dd if=/dev/zero of=1GB.dat bs=1M count=1024
dd if=/dev/zero of=1GB.dat bs=1M count=1024
[nginx-not-found]
# Prevent malicious injection
enabled = true
port = http,https
filter = nginx-not-found
logpath = /var/log/nginx/*.access.log
maxretry = 20
findtime = 60
bantime = 3600
action = iptables[name=HTTP, port=http, protocol=tcp]
@iamspark1e
iamspark1e / vzdump.conf
Created December 29, 2021 03:42
Proxmox better backup settings
# vzdump default settings
tmpdir: /tmp
#dumpdir: DIR
#storage: STORAGE_ID
#mode: snapshot|suspend|stop
#bwlimit: KBPS
#ionice: PRI
#lockwait: MINUTES
#stopwait: MINUTES
@iamspark1e
iamspark1e / scaleway_s3_cors.md
Created December 28, 2021 17:52
Config CORS of Scaleway S3
  1. Install AWS CLI and config

Link

  1. Put CORS rules in JSON

Link

@iamspark1e
iamspark1e / another-apt-command.sh
Created November 26, 2021 17:47
InRelease' changed its 'Suite' value from 'testing' to 'stable'
apt-get --allow-releaseinfo-change update
*.netflix.com,
*.netflix.net,
*.nflxext.com,
*.nflximg.com,
*.nflximg.net,
*.nflxso.net,
*.nflxvideo.net