Skip to content

Instantly share code, notes, and snippets.

@timepp
timepp / geo.ts
Last active March 13, 2024 13:26
get shortest path between 2 points on a cube surface
export type V3D = [number, number, number]
export type V2D = [number, number]
// degree should be multiply of 90
// axis: 0 = x, 1 = y, 2 = z
function rotatePoint(point:V3D, axis: number, degree: number) : V3D {
const [x, y, z] = point
const d = (degree % 360 + 360) % 360 // 0, 90, 180, 270
const s = d === 90? 1 : (d === 270? -1 : 0)
const c = d === 0? 1 : (d === 180? -1 : 0)
ae29937 Add gn flag to control mitigations for untrusted code
6b30393 [turbofan] Kill transition-kind source map in load elimination.
48d436b [test] Add "trusted" testing variant to a subset of bots
bbcdb1e Update V8 DEPS.
055aa9b Beautify help output of flag names
05fe364 [wasm] Fix memory size dcheck in WasmContext
c22737a [turbofan] Make dangerous bitcasts effectful.
a97298b Use --untrusted-code-mitigations flag also for JS
2b4cc83 [builtins] Port EnqueueMicrotask to CSA.
204441b [wasm] Make some fields const in WasmGraphBuilder
--keep @**.MainDex class * {
- *;
-}
-
-keepclasseswithmembers class * {
public static ** asInterface(android.os.IBinder);
}
-# Required when code coverage is enabled.
--keep class com.vladium.** {
@timepp
timepp / crc32.h
Created February 16, 2017 11:39
simplest crc32 c++ implementation
#pragma once
#include <stdint.h>
struct crc32
{
static void generate_table(uint32_t(&table)[256])
{
uint32_t polynomial = 0xEDB88320;
for (uint32_t i = 0; i < 256; i++)
@timepp
timepp / dump_doc_headings.js
Last active August 9, 2016 07:18
get word document headings
function GetWordOutline(docfilename) {
/** Get word document outlines
* @tag dev
*
* @param {filename} docfilename - .doc(x) file
*
*/
var word = new ActiveXObject("Word.Application");
var doc = word.Documents.Open(docfilename, false, true);
; 这个snippet实现在EMACS中左键点击用缺省浏览器打开,右键点击用FIREFOX打开。
; 先要把org mode的右键功能禁用。(注意org mode 的mouse-3跟mouse-1并不一样,看你能否接受)
(add-hook 'org-mode-hook
(lambda () (org-defkey org-mouse-map [mouse-3] nil)))
; 建一个function绑定到mouse-3
(add-to-list 'exec-path "c:/Program Files (x86)/Mozilla Firefox/")
(defun browse-url-at-mouse-with-firefox (event)
"browse the url with firefox"