This file contains 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 OFF | |
SET status=1 | |
(TASKLIST|FIND /I "vcxsrv.exe"||SET status=0) 2>nul 1>nul | |
ECHO %status% | |
IF %status% EQU 1 (ECHO vcxsrv is running.) ELSE (start config.xlaunch) | |
bash -c "export DISPLAY=localhost:0.0; xset r rate 160 38;export LC_CTYPE=zh_CN.UTF-8; export LANG=zh_CN.UTF-8; export LC_ALL=zh_CN.UTF-8; export GTK_IM_MODULE=fcitx; export QT_IM_MODULE=fcitx; export XMODIFIERS=fcitx; emacs;" |
This file contains 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 winston = require('winston') | |
const { combine, timestamp, label, printf } = winston.format; | |
const moment = require('moment') | |
const path = require('path') | |
const PROJECT_ROOT = path.join(__dirname, '..') | |
const myFormat = printf(info => { | |
const ds = moment(info.timestamp).format('YYYY-MM-DD HH:mm:ss') | |
return `[${ds}] [${info.level}] ${info.message}` |
This file contains 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
su | |
yum localinstall https://dev.mysql.com/get/mysql80-community-release-el7-1.noarch.rpm | |
yum install mysql-community-server | |
systemctl enable mysqld | |
systemctl start mysqld | |
grep 'temporary password' /var/log/mysqld.log |
This file contains 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 puppeteer = require('puppeteer'); | |
(async () => { | |
const browser = await puppeteer.launch(); | |
const page = await browser.newPage(); | |
// Adjustments particular to this page to ensure we hit desktop breakpoint. | |
page.setViewport({width: 1000, height: 600, deviceScaleFactor: 1}); | |
await page.goto('https://www.chromestatus.com/samples', {waitUntil: 'networkidle'}); |
This file contains 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 org.bouncycastle.util.encoders.Hex; | |
import org.web3j.crypto.*; | |
import java.math.BigInteger; | |
public class ECCExample { | |
public static String compressPubKey(BigInteger pubKey) { | |
String pubKeyYPrefix = pubKey.testBit(0) ? "03" : "02"; | |
String pubKeyHex = pubKey.toString(16); | |
String pubKeyX = pubKeyHex.substring(0, 64); |
This file contains 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 ( | |
"crypto/md5" | |
"encoding/hex" | |
) | |
func GetMD5Hash(text string) string { | |
hasher := md5.New() | |
hasher.Write([]byte(text)) | |
return hex.EncodeToString(hasher.Sum(nil)) | |
} |
This file contains 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
<?php | |
// ... | |
public static function getCategory($pid = 0){ | |
$tmp = Category::where('pid', $pid)->get()->toArray(); | |
$category = []; | |
if (count($tmp) != 0){ | |
foreach ($tmp as $key => $value){ | |
// 通过递归处理获得子类 |
This file contains 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
from pyquery import PyQuery | |
doc = PyQuery('<div><span>toto</span><span>tata</span></div>') | |
print doc.text() # => toto tata |
This file contains 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
#!/usr/bin/env node --harmony-async-await | |
const program = require('commander') | |
const chalk = require('chalk') | |
const fs = require('fs') | |
const path = require('path') | |
const ll = console.log.bind(console) | |
const llr = (...arg) => console.log(chalk.red(...arg)) |