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
const { execSync } = require('child_process'); | |
const fs = require('fs'); | |
const backupDir = __dirname + '/joplin-backups' | |
const backupCount = 20 | |
fs.mkdirSync(backupDir, { recursive: true }) | |
const joplinSyncDir = 'C:/Users/admin/我的坚果云/webdav/Joplin' | |
let lastUpdatedAt = 0 |
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
import axios, { AxiosRequestConfig } from 'axios' | |
export interface Props<P, Data, D> { | |
url: string | |
baseParams?: object | |
aggregateParams: (p1: P, p2: P) => P | |
selectData: (d: Data, p: P) => D | |
waitMs?: number | |
config?: AxiosRequestConfig | |
} |
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
//知乎答案爬取 | |
var $ = document.querySelector.bind(document) | |
var $$ = document.querySelectorAll.bind(document) | |
var zh={ | |
Download:function (content, filename) { | |
// 创建隐藏的可下载链接 | |
var eleLink = document.createElement('a'); | |
eleLink.download = filename; | |
eleLink.style.display = 'none'; | |
// 字符内容转变成blob地址 |
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
import 'core-js/fn/set' | |
import 'core-js/fn/map' | |
import React from 'react' | |
import svgTextSize from 'svg-text-size'; | |
const rightSymbols = new Set( | |
'“‘[「【﹝〔<‹«{『((<《'.split('') | |
) |
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
open System | |
open System.Collections.Generic | |
open System.Runtime.InteropServices | |
[<DllImport("libc", SetLastError=true)>] | |
extern int readlink(string path, byte[] buffer, int buflen); | |
let readlink2 path = | |
let buf: byte [] = Array.zeroCreate(512) |
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
import { Struct } from 'immuter' | |
const struct = Struct({ | |
title: { | |
zh: '哈利·波特与魔法石', | |
en: 'Harry Potter and the Philosopher\'s Stone', | |
}, | |
author: 'J. k. rowling', | |
tags: ['novel', 'magic'], | |
}) |
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 doHash(str, seed) { | |
var m = 0x5bd1e995; | |
var r = 24; | |
var h = seed ^ str.length; | |
var length = str.length; | |
var currentIndex = 0; | |
while (length >= 4) { | |
var k = UInt32(str, currentIndex); | |
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
{"0.3984699617225185":"-----BEGIN PGP PUBLIC KEY BLOCK-----\r\nCharset: UTF-8\r\n\r\nxv8AAABSBAAAAAATCCqGSM49AwEHAgME4JCeuCGhYIjKLhTDOXe1o8KbD0OgTBUy\r\nN2tFDZHROjL+ZRIPeqCym03m+iiTysgp71Qszl764+nlI5u4sSyqZ83/AAAACDxn\r\naXRodWI+wv8AAACOBBATCABA/wAAAAWCWQFVXv8AAAACiwn/AAAACZCUFR1PQAQi\r\ntv8AAAAFlQgJCgv/AAAABJYDAQL/AAAAApsD/wAAAAKeAQAAXXYBANoYKPXoiTbd\r\nY56ithXekpS18vVi0zR6J/VtiT5+of+GAP9VgVUTKk/19vBityNvHxh198iqShSu\r\nlC66kj3niDwPgs7/AAAAVgQAAAAAEggqhkjOPQMBBwIDBJkY2u9+S26cM0/cvRP+\r\nEpMzoxOdK3N8jeqhC2y1dRzLl2ZiB5OtrG3m1mB8GhmxeQwM2/qk+/YTohPAh6oH\r\nF04DAQgHwv8AAABtBBgTCAAf/wAAAAWCWQFVXv8AAAAJkJQVHU9ABCK2/wAAAAKb\r\nDAAA7ygA+gLSZjpYh6iTUdf8hI59KBYxyIaKoDlK1l3xiYzyO/8CAQCpoC5jrAs2\r\nu8tKlJEmChqWKPeKGJp+J6MUFn6TCnHO0g==\r\n=tu8N\r\n-----END PGP PUBLIC KEY BLOCK-----\r\n"} |
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
// @flow | |
import shave from 'shave' | |
import { h, Component } from 'preact' | |
import shallowCompare from 'shallow-compare' | |
type Props = { | |
line?: number, | |
text: string, | |
ellipsis?: string, | |
onEllipsisClick?: ?MouseEventListener, |
NewerOlder