Skip to content

Instantly share code, notes, and snippets.

@denghongcai
denghongcai / gist:09b516b5d915e67aff23b5c95becfe53
Created January 5, 2025 06:19
lol-html stream latency test
use lol_html::html_content::Element;
use lol_html::{element, HtmlRewriter, Settings};
use std::io;
use std::io::prelude::*;

fn rewrite_url_in_attr(el: &mut Element<'_, '_>, attr_name: &str) {
    let attr = el
        .get_attribute(attr_name)
        .unwrap()
@denghongcai
denghongcai / overture.init
Created April 25, 2021 15:20
overture openwrt service
#!/bin/sh /etc/rc.common
USE_PROCD=1
START=99
overture_start() {
procd_open_instance overture-$1
procd_set_param command /etc/overture/overture-linux-amd64 -c /etc/overture/config.yml
procd_set_param pidfile /var/run/overture/overture-$1.pid
@denghongcai
denghongcai / 📊 Weekly development breakdown
Last active May 29, 2021 01:43
Weekly Development Breakdown
TypeScript 2 hrs 4 mins ███████████▏░░░░░░░░░ 53.3%
Java 1 hr 15 mins ██████▋░░░░░░░░░░░░░░ 32.1%
Markdown 14 mins █▎░░░░░░░░░░░░░░░░░░░ 6.4%
Other 9 mins ▊░░░░░░░░░░░░░░░░░░░░ 4.1%
XML 4 mins ▍░░░░░░░░░░░░░░░░░░░░ 1.9%
Node Version 8.9.4
/**
* Sample of serverside generation of Highcharts using an extension to jsdom in node.js.
*
* Usage:
* npm install jsdom
* npm install highcharts
* node highcharts-jsdom
*/
/* eslint-env node */
@denghongcai
denghongcai / ReactJS-Server-Side-Rendering.md
Created February 13, 2017 16:34 — forked from koistya/ReactJS-Server-Side-Rendering.md
Server-side Rendering (SSR) for ReactJS / Flux Applications. Setting document.title

Files

The basic structure of a React+Flux application (see other examples)

 - /src/actions/AppActions.js     - Action creators (Flux)
 - /src/components/Application.js - The top-level React component
 - /src/constants/ActionTypes.js  - Action types (Flux)
 - /src/core/Dispatcher.js        - Dispatcher (Flux)
 - /src/stores/AppStore.js        - The main store (Flux)
@denghongcai
denghongcai / diff.mdown
Created September 18, 2016 16:04 — forked from ndarville/diff.mdown
Paul Heckel's Diff Algorithm

[Isolating Differences Between Files][paper]

Advantage over Other Algorithms

The diff output is more specific:

[I]f a whole block of text is moved, then all of it, rather than just the beginning and end, is detected as changed.

>The algorithm described here avoids these difficulties. It detects differences that correspond very closely to our intuitive notion of difference.

@denghongcai
denghongcai / osx_dmg_package
Created June 21, 2016 04:26 — forked from 44510/osx_dmg_package
mac osx 程序自动打包为 dmg 文件的脚本
set -e
title='千尋影視' # dmg 文件 mount 了之后在文件系统中显示的名称
background_picture_name='mac-dmg-bg.png' # dmg 文件在 mount 了之后界面中显示的背景图片路径
application_name='千尋影視.app' # 应用程序的名称
# Developer ID 证书的名称(名字的一部分即可,但是需要能在 Keychain Access 中唯一定位到该证书)
developer_id='Developer ID Application: Shanghai Truecolor Multimedia'
# dmg 窗口相关的一些设置,需要根据实际情况做变更
window_left=200 # 窗口位置的 x 坐标

###预备条件

  1. BIOS 升级至 2.15,开启 ACHI,启用 F12 选择启动项
  2. GPT 分区,UEFI 引导的 win8.1 系统
  3. 预留最小约 40GB 磁盘空间,且未格式化
  4. 无线网卡是AR9287

###制作安装U盘

  1. 下载远景论坛U盘版.10.9.2.13C64.20140303.dmg并使用TransMac刻录到U盘
  2. 拔插U盘,删除EFI文件
  3. 拷贝此处提供的EFI文件至刚才位置
(function() {
var path = require('path'), fs = require('fs');
function walk(uri,filter,tree) {
var node = {
name : null,
children : [],
pNode : null,
};