Skip to content

Instantly share code, notes, and snippets.

View wmh's full-sized avatar
🎯
Focusing

Hunter Wu wmh

🎯
Focusing
  • Not available for hire.
  • Taipei 104
View GitHub Profile
@wmh
wmh / cobinhood-list-assets.js
Created July 31, 2018 09:28
Convert cobinhood assets to SQL
// https://cobinhood.com/funds
var sql = 'INSERT INTO token_mappings (src, name, coin_name, image_url) VALUES \n';
document.querySelectorAll('div.sc-AUpyg > div.sc-cSYcjD').forEach((row) => {
const name = row.querySelector('span.sc-gjAXCV').textContent.trim();
const svg = window.btoa(new XMLSerializer().serializeToString(row.getElementsByTagName('svg')[0]));
const fullname = row.querySelector('span.sc-iybRtq').textContent.trim();
sql += `('cobinhood', '${name}', '${fullname}', '${svg}'),\n`;
});
console.log(sql);
@wmh
wmh / cnt.sql
Created June 25, 2019 15:11
解 leetcode db 問題需要用到的一招
SELECT id,
@dep := dep dep,
@cnt := IF(@dep = dep, @cnt + 1, 1) cnt
FROM `emp`,
(SELECT @cnt := 0, @dep := 0) init
aws polly synthesize-speech \
--output-format mp3 \
--voice-id Zhiyu \
--language-code cmn-CN \
--text file://p50.txt \
p50.mp3