Skip to content

Instantly share code, notes, and snippets.

View cute-angelia's full-sized avatar
🎯
最近在开发游戏服务端,网络基础框架还是比一般的服务复杂

Angelia cute-angelia

🎯
最近在开发游戏服务端,网络基础框架还是比一般的服务复杂
View GitHub Profile
@mayneyao
mayneyao / notion2blog.js
Last active June 29, 2024 00:46
Notion.so > Personal Blog | custom domain + disqus comment
const MY_DOMAIN = "agodrich.com"
const START_PAGE = "https://www.notion.so/gatsby-starter-notion-2c5e3d685aa341088d4cd8daca52fcc2"
const DISQUS_SHORTNAME = "agodrich"
addEventListener('fetch', event => {
event.respondWith(fetchAndApply(event.request))
})
const corsHeaders = {
"Access-Control-Allow-Origin": "*",
@drsox
drsox / Block-FailedRDPAttempts.ps1
Created August 5, 2019 23:04
Server 2019 Block-FailedRDPAttempts.ps1
# Only compatible with Server 2019
# Intended to be run as a recurring scheduled task
# Parses 240 minutes of logs then based on a tolerance for failed login attempts, creates TCP 3389 (RDP) and ICMP block rules.
# This will remove the old rules each time it is run which has the effect of creating a temporary block if this is run as a scheduled task.
#Quantity of failed login attempts required to trigger blocking
$tolerance = 15
$logName = "Security"
package otgorm_test
import (
"context"
"testing"
"github.com/jinzhu/gorm"
_ "github.com/jinzhu/gorm/dialects/sqlite"
opentracing "github.com/opentracing/opentracing-go"
"github.com/opentracing/opentracing-go/mocktracer"
@tmpbook
tmpbook / build.sh
Created July 25, 2018 03:42
Jenkins build setup for Go Projects.
# You need install jenkins go plugin first -> https://wiki.jenkins.io/display/JENKINS/Go+Plugin
#!/usr/bin/bash
export GOPATH=$WORKSPACE
mkdir -p $GOPATH/src
project_name=$(echo $GIT_URL | awk -F/ '{print $NF}' | sed 's/.git//g')
echo ${project_name}
ln -f -s $WORKSPACE $GOPATH/src/$project_name
go get $project_name
@miguelmota
miguelmota / userhomedir.go
Last active April 11, 2022 00:33
Golang get user home directory path
package main
import (
"fmt"
"os"
"runtime"
)
func userHomeDir() string {
if runtime.GOOS == "windows" {
@panta
panta / logging.go
Last active May 27, 2024 16:37
zerolog with file log rotation (lumberjack) and console output
package logging
import (
"github.com/rs/zerolog"
"github.com/rs/zerolog/log"
"gopkg.in/natefinch/lumberjack.v2"
"os"
"path"
"io"
)
@moolex
moolex / .editorconfig
Created March 23, 2018 03:47
editor config of carno-php
root = true
[*]
end_of_line = lf
insert_final_newline = true
[*.php]
charset = utf-8
indent_style = space
indent_size = 4
@alexedwards
alexedwards / main_test.go
Last active June 15, 2024 00:55
MaxOpenConns benchmark
package main
import (
"database/sql"
"testing"
"time"
_ "github.com/lib/pq"
)
@brettscott
brettscott / aes-256-cbc-test.js
Last active March 25, 2024 03:44
AES 256 CBC encryption between Golang and Node JS
// Node v6.9.0
//
// TEST FILE (cut down for simplicity)
// To ensure Golang encrypted string can be decrypted in NodeJS.
//
let crypto;
try {
crypto = require('crypto');
@alswl
alswl / hosts
Last active November 12, 2023 11:17
(deprecated, I bought xiaomi VIP)hosts for OpenWRT, for disable AD in xiaomi TV
127.0.0.1 api.ad.xiaomi.com
127.0.0.1 sdkconfig.ad.xiaomi.com
127.0.0.1 ad.mi.com
127.0.0.1 ad.xiaomi.com
127.0.0.1 ad1.xiaomi.com
127.0.0.1 adv.sec.miui.com
127.0.0.1 test.ad.xiaomi.com
127.0.0.1 new.api.ad.xiaomi.com