Skip to content

Instantly share code, notes, and snippets.

View maple3142's full-sized avatar

maple maple3142

View GitHub Profile
(await Promise.all([1,2,3].map(x=>fetch(`https://tieba.baidu.com/p/5626879744?pn=${x}`).then(r=>r.text())))).filter((x,i)=>parseInt($(x).find('.tP')[0].textContent)===i+1).map(x=>$(x).find('.d_post_content').toArray().reduce((d,x)=>{
const div=document.createElement('div')
div.innerHTML=x.innerHTML.replace(/<br>/g,'\n').replace(/&lt;/g,'<').replace(/&gt;/g,'>')
if(div.textContent.replace(/(\n| )/g,'').length>=50&&!div.textContent.includes('广告')&&!div.textContent.includes('免费'))return d+'\n'+div.textContent
else return d
},'').trim()).join('\n\n')
(function(global) {
'use strict'
const pjax={}
pjax._get=url=>{
return new Promise((res,rej)=>{
const xhr=new XMLHttpRequest()
xhr.open('GET', url)
xhr.onload=()=>res([xhr.responseText,xhr])
xhr.onerror=rej
xhr.send()
@maple3142
maple3142 / README.md
Last active April 26, 2018 14:06
從 FushionApp 的 apk 中匯出 .fas 檔

從 FushionApp 的 apk 中匯出 .fas

需求

  • 安裝 node.js
  • 會使用指令介面 (cmd,bash,...)

步驟

  1. 把這個 gist 下載成一個 zip 檔後解壓縮
  2. 在裡面執行 npm i
  3. 把目標 apk 放到同個資料夾
const rotate = ar => ar[0].map((col, i) => ar.map(row => row[i]))
const check = board => {
const board2 = rotate(board)
const row_ok = board.every(row => new Set(row).size === row.length)
const col_ok = board2.every(row => new Set(row).size === row.length)
const block_ok = (() => {
for (let i = 0; i < 3; i++) {
for (let j = 0; j < 3; j++) {
const s = new Set()
// outdated
// please heads for https://github.com/maple3142/ytdl
const axios = require('axios')
const parseQuery = s => {
const o = s
.split('&')
.map(x => x.split('='))
.reduce((p, c) => {
# https://blog.gtwang.org/statistics/tensorflow-google-machine-learning-software-library-tutorial/
# 移除警告
import os
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2'
# y=2x+1
x_data=[1,2,3,4,5]
y_data=[3,5,7,9,11]
@maple3142
maple3142 / custom.css
Created May 20, 2018 09:37
cent browser new tab chrome style search box
#ntp-search-container{
padding: 0px;
margin: 0px !important;
left: 0px;
bottom: 0px;
width: 100% !important;
height: 100% !important;
display: flex;
justify-content: center;
align-items: center;
#include <iostream>
#include <sstream>
#include <cstring>
#include <iomanip>
#include <algorithm>
using namespace std;
typedef unsigned long long int ll;
const int basecnt = 7;
// ==UserScript==
// @name Patchouli
// @name:en Patchouli
// @name:ja パチュリー
// @name:zh-CN 帕秋莉
// @name:zh-TW 帕秋莉
// @namespace https://github.com/FlandreDaisuki
// @description An image searching/browsing tool on pixiv
// @description:en An image searching/browsing tool on pixiv
// @description:ja pixiv 検索機能強化