Skip to content

Instantly share code, notes, and snippets.

View chenhg5's full-sized avatar
🏢
自闭

cg33 chenhg5

🏢
自闭
View GitHub Profile
+--------------------+
| Finding a new job. |
+--------------------+
@chenhg5
chenhg5 / 深圳程序员开发群test
Created August 16, 2018 00:13
深圳程序员开发群test
深圳程序员开发群test
@chenhg5
chenhg5 / supervisord.service
Created August 14, 2018 06:08
supervisord.service
[Unit]
Description=Supervisor daemon
[Service]
Type=forking
ExecStart=/usr/bin/supervisord -c /etc/supervisor/supervisord.conf
ExecStop=/usr/bin/supervisorctl shutdown
ExecReload=/usr/bin/supervisorctl reload
KillMode=process
Restart=on-failure
@chenhg5
chenhg5 / fetchTimeout.js
Created August 4, 2018 03:34
为 fetch 函数设置 timeout
// Rough implementation. Untested.
function timeout(ms, promise) {
return new Promise(function(resolve, reject) {
setTimeout(function() {
reject(new Error("timeout"))
}, ms)
promise.then(resolve, reject)
})
}
@chenhg5
chenhg5 / waitGroup.go
Created June 6, 2018 05:31
waitGroup example
package main
import (
"fmt"
"sync"
"time"
)
package main
@chenhg5
chenhg5 / nsq_shutdown.sh
Created May 30, 2018 04:18
nsq停止脚本
#nsq_shutdown.sh
#服务停止
ps -ef | grep nsq| grep -v grep | awk '{print $2}' | xargs kill -2
@chenhg5
chenhg5 / nsq_start.sh
Last active January 20, 2021 08:24
nsq启动脚本
#服务启动
#注意更改一下 --data-path 所指定的数据存放路径,否则会无法运行。
echo '删除日志文件'
rm -f nsqlookupd.log
rm -f nsqd1.log
rm -f nsqd2.log
rm -f nsqadmin.log
echo '启动nsqlookupd服务'
nohup nsqlookupd >nsqlookupd.log 2>&1&
@chenhg5
chenhg5 / googleTranslate.java
Created May 29, 2018 07:08
谷歌翻译java版本
//-----------------------------------------------------------------------------
//translate strToTranslate from fromLanguage to toLanguage
//return the translated string
//return empty string if error
//some frequently used language abbrv:
//Chinese Simplified: zh-CN
//Chinese Traditional: zh-TW
//English: en
//German: de
//Japanese: ja
@chenhg5
chenhg5 / wxapp-srcoll-x.html
Last active May 25, 2018 03:34
小程序横向滚动示例
<view class="scroll_box">
<scroll-view class="scroll-view_x" scroll-x style="width: auto;overflow:hidden;">
<view class="item_list" wx:for="{{list}}">
<image src="../../images/head.jpg" class="item_book_img" mode="aspectFill"></image>
<view class="item_book_text">测试数据</view>
</view>
</scroll-view>
</view>
@chenhg5
chenhg5 / thinkphp.conf
Created May 22, 2018 03:10
thinkphp nginx
server {
listen 80;
server_name xxxx.com;
access_log /var/log/nginx/xxxx.php-access.log backend;
error_log /var/log/nginx/xxxx.php-error.log error;
set $root /var/www/xxxx;
location ~ .*\.(gif|jpg|jpeg|bmp|png|ico|txt|js|css)$
{
root $root;
}