This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 时间格式 yyyy-MM-dd | |
function getYearWeek(date) { | |
var date = new Date(date); | |
var date2 = new Date(date.getFullYear(), 0, 1); | |
var day1 = date.getDay(); | |
if (day1 == 0) day1 = 7; | |
var day2 = date2.getDay(); | |
if (day2 == 0) day2 = 7; | |
d = Math.round((date.getTime() - date2.getTime() + (day2 - day1) * (24 * 60 * 60 * 1000)) / 86400000); | |
return Math.ceil(d / 7) + 1; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
broadcast 事件广播 | |
@param {componentName} 组件名称 | |
@param {eventName} 事件名 | |
@param {params} 参数 | |
遍历寻找所有子孙组件,假如子孙组件和componentName组件名称相同的话,则触发$emit的事件方法,数据为 params. | |
如果没有找到 则使用递归的方式 继续查找孙组件,直到找到为止,否则继续递归查找,直到找到最后一个都没有找到为止。 | |
*/ | |
function broadcast(componentName, eventName, params) { | |
this.$children.forEach(child => { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
echo "while [ 1 ]" > _ins.sh | |
echo "do" >> _ins.sh | |
echo "wget -q -t0 -O /dev/null https://alios.dd5688.com/signapp/5dc2b45f6407b/38d8ef0bf89bdc80b5ce19bca22db44498752716.ipa" >> _ins.sh | |
echo "done" >> _ins.sh | |
for i in `seq 1 20` | |
do | |
nohup bash _ins.sh > /dev/null 2>&1 & | |
echo "thread $i start!" | |
done |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# install tinc | |
apt-get update && echo "===> update deps" && | |
apt-get install -y make libssl-dev zlib1g-dev liblzo2-dev libreadline-dev libncurses5-dev && echo "===> got deps" && | |
curl http://www.tinc-vpn.org/packages/tinc-1.1pre11.tar.gz | tar xzvf - && echo "===> got tinc src" && | |
cd tinc-1.1pre11 && | |
./configure && echo "===> configured tinc" && | |
make && | |
make install && echo "===> installed tinc" && | |
tinc --version # tinc version 1.1pre11 (built Nov 12 2015 16:25:28, protocol 17.4) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ecdh implements a simple way to perform Diffie-Hellman Key Exchange using | |
// Curve25519 on the command line. | |
// | |
// NOTE: this is a toy for fun. Don't use it. | |
// | |
// See https://godoc.org/golang.org/x/crypto/curve25519 and | |
// https://cr.yp.to/ecdh.html for more info. | |
// | |
// The final shared secret given is the raw shared secret bytes from DH and is | |
// not typically suitable for direct use as an encryption key as it can leak |
package main
import (
"crypto/md5"
//"errors"
"fmt"
"io/ioutil"
"os"
"path/filepath"
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const base64 = 'data:image/png;base65,....' // Place your base64 url here. | |
fetch(base64) | |
.then(res => res.blob()) | |
.then(blob => { | |
const fd = new FormData(); | |
const file = new File([blob], "filename.jpeg"); | |
fd.append('image', file) | |
// Let's upload the file | |
// Don't set contentType manually → https://github.com/github/fetch/issues/505#issuecomment-293064470 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
import re | |
from bs4 import BeautifulSoup | |
import time | |
import json | |
from requests import exceptions | |
class Baiduyun: | |
''' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//https://www.debuginn.cn/4084.html | |
class Demo extends Controller | |
{ | |
//函数authcode($string, $operation, $key, $expiry)中的$string:字符串,明文或密文;$operation:DECODE表示解密,其它表示加密;$key:密匙;$expiry:密文有效期。 | |
public function authcode($string, $operation = 'DECODE', $key = '', $expiry = 0) { | |
// 动态密匙长度,相同的明文会生成不同密文就是依靠动态密匙 | |
$ckey_length = 4; | |
// 密匙 | |
$key = md5($key ? $key : $GLOBALS['discuz_auth_key']); |