Skip to content

Instantly share code, notes, and snippets.

😟
I may be slow to respond.

lucifer azl397985856

😟
I may be slow to respond.
Block or report user

Report or block azl397985856

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@azl397985856
azl397985856 / headless-check.md
Created Aug 9, 2019
检查是否是无头浏览器
View headless-check.md

It seems he's doing something with header detection. I used Puppeteer to play around with the site and various configurations I use when scraping. In headless Chrome, the "Accept-Language" header is not sent. In Puppeteer, one can force the header to be sent by doing:

page.setExtraHTTPHeaders({ 'Accept-Language': 'en-US,en;q=0.9' })

However, Puppeteer sends that header as lowercase: accept-language: en-US,en;q=0.9

So it seems the detection is as simply: if there is no 'Accept-Language' header (case-sensitive), then "Headless Chrome"; else, "Not Headless Chrome".

View Bypassing anti-incognito detection in Google Chrome.md
if ('storage' in navigator && 'estimate' in navigator.storage) {
	const {usage, quota} = await navigator.storage.estimate();
    console.log(`Using ${usage} out of ${quota} bytes.`);

	if(quota < 120000000){
        console.log('Incognito')
    } else {
        console.log('Not Incognito')
    }	
@azl397985856
azl397985856 / disable-react-redux-devtool.md
Created Aug 5, 2019
生产模式下禁止React Developer Tools、Redux DevTools的使用
View disable-react-redux-devtool.md

React Developer Tools

window.__REACT_DEVTOOLS_GLOBAL_HOOK__.inject = function () {}
import {
  disableReactDevTools
@azl397985856
azl397985856 / memory.js
Last active Jul 8, 2019
Automatically detect memory leaks with Puppeteer
View memory.js
// from : https://github.com/chrisguttandin/standardized-audio-context/blob/master/test/integration/memory.js
const MemoryFileSystem = require('memory-fs'); // eslint-disable-line no-undef
const puppeteer = require('puppeteer'); // eslint-disable-line no-undef
const webpack = require('webpack'); // eslint-disable-line no-undef
// eslint-disable-next-line padding-line-between-statements
const compileBundle = () => {
return new Promise((resolve, reject) => {
const memoryFileSystem = new MemoryFileSystem();
View setCookie.js
function setCookie(cookieName,value,expiresTime,path){
expiresTime = expiresTime || "Thu, 01-Jan-2030 00:00:01 GMT";
path = path || "/";
document.cookie=cookieName+ "=" +encodeURIComponent(value)+ "; expires="+ expiresTime+ "; path="+path;
}
View svg-frame-animation.less
<svg viewBox="0, 0, 91, 94" class="warm-face">
<image xlink:href="//yun.duiba.com.cn/h5/millionaire-custom/top-180118/assets/faces.png" width="3458" height="94" />
</svg>
.warm-face {
position: relative;
@azl397985856
azl397985856 / listen1_aha_playlist.md
Last active Sep 5, 2018
updated by Listen1(http://listen1.github.io/listen1/) at 2018/9/5 下午3:51:39
View listen1_aha_playlist.md

本歌单由Listen1创建, 歌曲数:1,歌单数:1,点击查看更多

@azl397985856
azl397985856 / bfs_and_dfs.md
Created Aug 28, 2018 — forked from chrisco/bfs_and_dfs.md
Breadth First Search And Depth First Search
View bfs_and_dfs.md

Breadth First Search

Algorithm for searching graph-like data structures, one level at a time.


Step by Step

  • Start a queue
  • Check current node - if false, mark as visited, continue
@azl397985856
azl397985856 / index.html
Created Jun 30, 2016 — forked from anonymous/index.html
monad-code-pen
View index.html
<div id="content">123</div>
You can’t perform that action at this time.