Skip to content

Instantly share code, notes, and snippets.

View sunny352's full-sized avatar

MingSailor sunny352

View GitHub Profile
@sunny352
sunny352 / redis-cluster-docker-compose.yml
Created August 9, 2023 06:18
HOST_IP=replace_with_your_ip REDIS_PASS=redis_password docker-compose up -d
version: '3'
services:
redis-0:
image: redis:6.2-bullseye
command: redis-server --cluster-enabled yes --port 7000 --requirepass "${REDIS_PASS}" --masterauth "${REDIS_PASS}"
ports:
- "7000:7000"
- "17000:17000"
expose:
- "7000"
@sunny352
sunny352 / install_docker_debian.sh
Last active June 29, 2024 12:19
在debian上安装docker及docker-compose
#!/usr/bin/env bash
# export http_proxy=http://##替换成自己的代理地址##
# export https_proxy=http://##替换成自己的代理地址##
# 使用官方源安装docker
apt update
apt install -y \
ca-certificates \
curl \
@sunny352
sunny352 / datetime.lua
Last active August 20, 2021 09:35 — forked from zwh8800/datetime.lua
lua ISO 8601 datetime parser - https://repl.it/IQuI/5
function get_timezone()
local now = os.time()
return os.difftime(now, os.time(os.date("!*t", now)))
end
local epoch = get_timezone()
function parse_json_date(json_date)
local year, month, day, hour, minute, seconds, offsetsign, offsethour, offsetmin = json_date:match("(%d+)%-(%d+)%-(%d+)%a(%d+)%:(%d+)%:([%d%.]+)([Z%+%- ])(%d?%d?)%:?(%d?%d?)")
local timestamp = os.time{year = year, month = month, day = day, hour = hour, min = minute, sec = math.floor(seconds)} + epoch
local offset = 0
@sunny352
sunny352 / ImageProcessor.cs
Created October 30, 2020 03:38
将Unity工程中图片都转换成crunchedCompression
using UnityEditor;
public class ImageProcessor : AssetPostprocessor
{
private void OnPreprocessTexture()
{
var importer = assetImporter as TextureImporter;
if (null == importer)
{
return;
@sunny352
sunny352 / CSharpBinaryString.go
Last active June 10, 2020 10:29
golang处理C#中使用BinaryWriter/BinaryReader序列化的字符串
package Utils
import (
"errors"
"io"
"math"
)
func WriteCSharpString(writer io.Writer, value string) error {
buffer := []byte(value)
@sunny352
sunny352 / install_docker.sh
Last active April 1, 2024 06:51
CentOS 7 安装 docker-ce 和 docker-compose 并设置腾讯云容器镜像源的脚本
#!/usr/bin/env bash
# 安装docker(使用阿里云源)
yum install -y yum-utils device-mapper-persistent-data lvm2
yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
yum -y install docker-ce
systemctl start docker
# 迁移docker目录(可选)
systemctl stop docker docker.socket
@sunny352
sunny352 / MonoSingleton.cs
Last active October 6, 2019 07:36
Unity中的单例模板
using UnityEngine;
namespace Utils
{
public class MonoSingleton<T> : MonoBehaviour where T : MonoSingleton<T>
{
public static T Inst
{
get
{
@sunny352
sunny352 / Http_egret.ts
Created February 26, 2019 12:41
Egret的http请求封装
class Http {
public static Inst(): Http {
if (null == Http._inst) {
Http._inst = new Http();
}
return Http._inst;
}
private static _inst: Http;
public constructor() {
@sunny352
sunny352 / WSNet_layaair.ts
Created February 10, 2019 13:50
LayaAir的websocket连接示例
export default class WSNet {
//单例,方便使用
public static Inst(): WSNet {
if (null == WSNet._inst) {
WSNet._inst = new WSNet();
}
return WSNet._inst;
}
private static _inst: WSNet;
@sunny352
sunny352 / WSNet_egret.ts
Created February 10, 2019 13:28
Egret的websocket连接示例
class WSNet {
//单例,方便使用
public static Inst(): WSNet {
if (null == WSNet._inst) {
WSNet._inst = new WSNet();
}
return WSNet._inst;
}
private static _inst: WSNet;