Skip to content

Instantly share code, notes, and snippets.

View 599316527's full-sized avatar

Kyle He 599316527

View GitHub Profile
@599316527
599316527 / zimuzu-sign.sh
Last active November 19, 2016 07:53
zimuzu.tv 签到脚本
#!/bin/sh
ACCOUNT="xijinpin@gov.cn"
PASSWORD="fuckccp!"
#########################################
function urlEncode() {
python -c "
import urllib, commands, os;
@599316527
599316527 / my-win10-keybinding-config.ahk
Last active August 29, 2015 14:26
My Win10 AutoHotKey Config
; Press Middle Mouse Button to active Mission Control
MButton::Send, #{Tab}
; OSX-Like Reversed Scroll
WheelUp::Send, {WheelDown 1}
WheelDown::Send, {WheelUp 1}
; Vim-Like Cursor Move
; Physical CapsLock Key has been remapped as Esc by KeyTweak
@599316527
599316527 / remove-google-search-results-redirect.js
Last active August 29, 2015 14:26
Injected JS for removing redirect
(function (a) {
if (!a) return ;
var r = a.getAttribute('onmousedown').match(/^return (\w+)\(/i);
if (r && r[1]) {
window[r[1]] = function () {};
}
})(document.querySelector('#rso h3.r a'));
@599316527
599316527 / smart-file-size-filter.js
Created October 30, 2015 15:08
Smart File Size Filter for VueJS
var Vue = require('vue');
var UNITS = ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];
var STEP = 1024;
function format(value, power) {
return (value / Math.pow(STEP, power)).toFixed(2) + UNITS[power];
}
Vue.filter('smart-file-size', {
@599316527
599316527 / jasmine.js
Last active November 17, 2015 08:39
Customizing Jasmine Global Json Diff Matchers
/**
* @file customizing jasmine global json diff matchers
* @author Kyle He (4hekai@gmail.com)
*/
var path = require('path');
var jsonDiffPatch = require('jsondiffpatch');
var Jasmine = require('jasmine');
var jasmine = new Jasmine({
@599316527
599316527 / directive-delay-execute.js
Last active August 29, 2020 19:42
Vue.js directive: delay execute
var Vue = require('vue');
Vue.directive('delay-execute', {
acceptStatement: true,
bind: function () {
this._delayRunTimeout = parseInt(this.arg, 10) || 1000;
},
update: function (handle) {
this.reset();
this._delayRunTimer = setTimeout(handle, this._delayRunTimeout);
@599316527
599316527 / animation.js
Created January 27, 2016 04:35
jd snow animation
function randomRange(t, i) {
return Math.random() * (i - t) + t
}
Particle3D = function(t) {
THREE.Particle.call(this, t), this.velocity = new THREE.Vector3(0, -2, 0), this.velocity.rotateX(randomRange(-45, 45)), this.velocity.rotateY(randomRange(0, 360)), this.gravity = new THREE.Vector3(0, 0, 0), this.drag = 1
}, Particle3D.prototype = new THREE.Particle, Particle3D.prototype.constructor = Particle3D, Particle3D.prototype.updatePhysics = function() {
this.velocity.multiplyScalar(this.drag), this.velocity.addSelf(this.gravity), this.position.addSelf(this.velocity)
};
var TO_RADIANS = Math.PI / 180;
@599316527
599316527 / ddns-start
Last active October 18, 2019 08:32
asuswrt-merlin custom ddns script for dnspod
#!/bin/sh
# This file should be placed in /jffs/scripts/ folder.
# 后台申请token
# https://support.dnspod.cn/Kb/showarticle/tsid/227/
login_token='xxxxxxx,yyyyyyyyyyyyyyyyyyyyyyyyyyyyy'
# 先调 Domain.List 和 Record.List 接口取得 id
# https://www.dnspod.cn/docs/domains.html#domain-list
# https://www.dnspod.cn/docs/records.html#record-list
@599316527
599316527 / Pagination.vue
Last active May 11, 2016 13:12
Vue.js Pagination Component
<template>
<nav>
<ul class="pagination" @click="handleClick($event)">
<li v-if="no > 1">
<a :href="hrefPrefix + (no - 1)" :data-page="no - 1">&lt;</a>
</li>
<li v-for="i in pageIndicatorSeries" :class="{active: i === no}">
<a :href="hrefPrefix + i" :data-page="i">{{ i }}</a>
</li>
<li v-if="no < pageCount">
@599316527
599316527 / dnspod-ddns.js
Created July 26, 2016 13:12
DnsPod 动态DNS 脚本
/**
* @file ddns script for dnspod
* @author Kyle He
*/
const exec = require('child_process').exec;
const FormData = require('form-data');
const fetch = require('node-fetch');
(new Promise(function (resolve, reject) {