Skip to content

Instantly share code, notes, and snippets.

View huan's full-sized avatar
Code Generation!

Huan Li huan

Code Generation!
View GitHub Profile
@developit
developit / async-examples.js
Last active February 19, 2020 00:43
Async Array utilities in async/await. Now available as an npm package: https://github.com/developit/asyncro
/** Async version of Array.prototype.reduce()
* await reduce(['/foo', '/bar', '/baz'], async (acc, v) => {
* acc[v] = await (await fetch(v)).json();
* return acc;
* }, {});
*/
export async function reduce(arr, fn, val, pure) {
for (let i=0; i<arr.length; i++) {
let v = await fn(val, arr[i], i, arr);
if (pure!==false) val = v;
@max-mapper
max-mapper / bibtex.png
Last active November 6, 2024 09:03
How to make a scientific looking PDF from markdown (with bibliography)
bibtex.png
@oleavr
oleavr / QuakeRESTAPIDemo.md
Last active July 6, 2021 19:04
Quake REST API demo

Build

npm install

Run

$ frida QuakeSpasm --enable-jit -l _agent.js
$ curl -s http://localhost:1337/stats | jq
$ curl -s -X POST http://localhost:1337/attack | jq
@oleavr
oleavr / jit-example.js
Created January 27, 2019 20:18
Frida JIT example
'use strict';
const slowCallback = new NativeCallback(value => {
console.log('slowCallback hit');
return 43;
}, 'int', ['int']);
const fastCallback = Memory.alloc(Process.pageSize);
Memory.patchCode(fastCallback, 128, code => {
const cw = new X86Writer(code, { pc: fastCallback });
const XState = require('xstate')
const { Machine, interpret } = XState
const { raise } = XState.actions
/*
run from cli using:
node xstate-onentry-timing-bug.js [sync|async|raise]
*/
@adielbm
adielbm / ipa-for-google-translate.js
Last active June 21, 2025 16:19
IPA for Google Translate (phonetic transcription)
// ==UserScript==
// @name IPA for translate.google
// @namespace https://gist.github.com/adielBm/21762fe5e964071cb820a0c46896da34
// @version 2024-06-27
// @description Convert phonetic transcription to IPA on Google Translate
// @author adielBm
// @match https://translate.google.com/*
// @grant none
// @updateURL https://gist.githubusercontent.com/adielBm/21762fe5e964071cb820a0c46896da34/raw
// @downloadURL https://gist.githubusercontent.com/adielBm/21762fe5e964071cb820a0c46896da34/raw