Skip to content

Instantly share code, notes, and snippets.

@wjx0912
wjx0912 / q1.js
Created July 26, 2022 14:41
js_question
var name = 'window'
var person1 = {
name: 'person1',
foo1: function () {
console.log(this.name)
},
foo2: () => console.log(this.name),
foo3: function () {
return function () {
@wjx0912
wjx0912 / node-fetch_test.js
Created January 26, 2022 06:29
node-fetch test
const HttpProxyAgent = require('https-proxy-agent')
const fetch = require('node-fetch')
const options = {
// agent: function (_parsedURL) {
// if (_parsedURL.protocol === 'http:') {
// return httpAgent
// } else {
// return httpsAgent
// }
@wjx0912
wjx0912 / js_generator_question.js
Last active December 28, 2021 12:48
js_generator_question
function ajax(url, callback) {
console.log('ajax enter: ', url)
// 1、创建XMLHttpRequest对象
var xmlhttp
if (window.XMLHttpRequest) {
xmlhttp = new XMLHttpRequest()
} else { // 兼容早期浏览器
xmlhttp = new ActiveXObject('Microsoft.XMLHTTP')
}
// 2、发送请求
@wjx0912
wjx0912 / test1.gist
Created November 22, 2021 07:28
test1
‎‎​
@wjx0912
wjx0912 / v2rayn_dnsobject.json
Created November 3, 2021 02:20
v2rayn dnsobject
{
"hosts": {
"dns.google": "8.8.8.8",
"geosite:category-ads-all": "127.0.0.1",
"activate.navicat.com": "127.0.0.1",
"licensing.ultraedit.com": "127.0.0.1",
"swupdate.ultraedit.com": "127.0.0.1"
},
"servers": [
{
@wjx0912
wjx0912 / netflix_get_video_size.js
Created November 3, 2021 02:19
netflix get video size
const api = window.netflix.appContext.state.playerApp.getAPI();
const sessionId = api.videoPlayer.getAllPlayerSessionIds()[0];
const player = api.videoPlayer.getVideoPlayerBySessionId(sessionId);
player.getVideoSize();
@wjx0912
wjx0912 / print_datetime.js
Created November 2, 2021 06:14
javascript print date&time (yyyy-mm-dd hh:mm:ss:SS)
function getNowTime() {
var d = new Date;
var dformat =
[
d.getFullYear(),
("00" + (d.getMonth()+1)).slice(-2),
("00" + d.getDate()).slice(-2)
].join('-')
+ ' '
+ [
@wjx0912
wjx0912 / isDifferentArch.cpp
Created October 19, 2021 07:29
isDifferentArch
/*
* XXX: Mixed architecture don't quite work. See also
* http://www.corsix.org/content/dll-injection-and-wow64
*/
static BOOL
isDifferentArch(HANDLE hProcess)
{
typedef BOOL (WINAPI *PFNISWOW64PROCESS)(HANDLE, PBOOL);
PFNISWOW64PROCESS pfnIsWow64Process;
pfnIsWow64Process = (PFNISWOW64PROCESS)
@wjx0912
wjx0912 / memcpy_perf_measure.cpp
Created September 2, 2021 06:12 — forked from daramkun/memcpy_perf_measure.cpp
Memory Copy Performance Measure (memcpy, ID3D11DeviceContext::CopyResource)
#include <Windows.h>
#include <d3d11.h>
#include <atlbase.h>
#pragma comment (lib, "d3d11.lib")
#include <iostream>
#include <thread>
#include <chrono>
#include <memory>
#include <vector>
@wjx0912
wjx0912 / jenkins_auto_approval.groovy
Created July 28, 2021 03:09
jenkins script auto approval
import java.lang.reflect.*;
import jenkins.model.Jenkins;
import jenkins.model.*;
import org.jenkinsci.plugins.scriptsecurity.scripts.*;
import org.jenkinsci.plugins.scriptsecurity.sandbox.whitelists.*;
scriptApproval = ScriptApproval.get()
alreadyApproved = new HashSet<>(Arrays.asList(scriptApproval.getApprovedSignatures()))