Skip to content

Instantly share code, notes, and snippets.

View maicong's full-sized avatar
⚠️

ERR_INVALID_USER maicong

⚠️
View GitHub Profile
@maicong
maicong / wechatEmoticon.js
Created November 12, 2016 05:38
获取微信表情包
((url, delay) => {
let starTime = new Date().getTime();
let xhr = new XMLHttpRequest();
let times = [];
let style = document.createElement('style');
style.textContent = 'body { background: #fff; } div { display: inline-flex; padding: 0.5rem; } div img { box-shadow: 0 0 5px 0 #8e8e8e; }';
document.head.appendChild(style);
document.body.innerHTML = '';
xhr.open('GET', url, true);
xhr.onload = event => {
@maicong
maicong / qrcode.js
Created January 20, 2017 15:37
qrcode bookmarks
javascript:(function(){var a=document.createElement('qrcode');a.style='display:block;z-index:9999999;position:fixed;top:25%;left:0;right:0;width:300px;height:300px;margin:auto;border:1px solid #999;box-shadow:#000 0 0 15px -3px;background:#fff center no-repeat;',a.style.backgroundImage='url(https://chart.googleapis.com/chart?chl='+encodeURIComponent(document.location.href)+'&chs=300x300&cht=qr&chld=M|2&choe=UTF-8)',a.onclick=function(){this.remove()},Array.of(document.querySelectorAll('qrcode')).forEach(function(b){return b[0]&&b[0].remove()}),document.body.appendChild(a)})();
{
"area": {
"华北": {
"110000": "北京市",
"120000": "天津市",
"130000": "河北省",
"140000": "山西省",
"150000": "内蒙古自治区"
},
"华中": {
/**
* 使用百度语音合成自动文本转语音
*
* 进入 http://ai.baidu.com/tech/speech/tts ,打开 console,粘贴本代码
*/
// 生成文本列表:通过直接定义
const text = '当不幸降临在他人头上时,他们往往都能像智者一样劝慰别人;而当同样的不幸降临自己身上时,人往往很难同样地开导自己。人最大的不智不是不知道,而是知道了却迟迟不愿去做,所以平庸却又自怜的人很多。'
const textArr = text
/**
* 安装
* yarn add babel-cli babel-preset-env axios qs
*
* 配置 .babelrc
* {
* "presets": ["env"]
* }
*
* 运行
<!DOCTYPE html>
<html>
<body>
<div id="player" class="aplayer"></div>
<script src="https://cdn.bootcss.com/aplayer/1.6.0/APlayer.min.js"></script>
<script>
(() => {
const music = [
{
title: '以前你给过的快乐 现在都陪着我难过',
;(async (...without) => {
let list = []
for (const n of Array.from({ length: 10 }, (v, i) => 1 + i)) {
await window
.fetch(`http://haoma.qq.com/json/act${n}.json.js`)
.then(r => r.text())
.then(r => JSON.parse(r.slice(16, -1)))
.then(r => r[2].map(v => list.push(v.num)))
}
list = [...new Set(list.sort())]
@maicong
maicong / kcptun
Last active October 23, 2017 10:54
/etc/init.d/kcptun
#!/bin/bash
# Source function library.
. /etc/rc.d/init.d/functions
# Source networking configuration.
. /etc/sysconfig/network
# Check that networking is up.
[ "$NETWORKING" = "no" ] && exit 0
@maicong
maicong / kcptun-config.json
Created October 23, 2017 10:54
kcptun config
{
"listen": "0.0.0.0:<kcptun_server_port>",
"target": "127.0.0.1:<ssserver_port>",
"key": "<kcptun_password>",
"crypt": "salsa20",
"mode": "fast2",
"mtu": 1350,
"sndwnd": 2048,
"rcvwnd": 2048,
"datashard": 70,
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>时间如白驹过隙</title>
</head>