Skip to content

Instantly share code, notes, and snippets.

View gsw945's full-sized avatar
๐Ÿ™
buddha-like coding

็Ž–ไบ–ไผ gsw945

๐Ÿ™
buddha-like coding
View GitHub Profile
@arkadiuszwojcik
arkadiuszwojcik / ActorContainerNext.cs
Created December 11, 2019 20:38
Scoped dependency injection in Proto Actor
public class ActorContainerNext : WindsorContainer
{
private readonly ConcurrentDictionary<Type, PID> singletons = new ConcurrentDictionary<Type, PID>();
public ActorContainerNext(IWindsorContainer parent = null)
{
Parent = parent;
Register(ContainerComponents().ToArray());
}
@SkinyMonkey
SkinyMonkey / gist:d15514ec05be86c9e03dca678eec8e78
Last active August 9, 2021 05:54
protoactor linked list benchmark
package main
import (
"fmt"
"runtime"
"sync"
"time"
"github.com/AsynkronIT/protoactor-go/actor"
)
public class LiteDbContext : ILiteDbContext
{
public LiteDatabase Database { get; }
public LiteDbContext(IOptions<LiteDbOptions> options)
{
Database = new LiteDatabase(options.Value.DatabaseLocation);
}
}
@Horusiath
Horusiath / Program.cs
Last active November 24, 2020 05:45
An interfaced generic-aware Akka.NET actor implementation
using System;
using System.Threading.Tasks;
using Akka.Actor;
using Akka.Configuration;
namespace AkkaDemos
{
public interface IGreeter
{
Task<string> Greet(IGreeter who);
@lvxianchao
lvxianchao / npm.taobao.sh
Last active October 26, 2025 09:55
่ฎพ็ฝฎ npm ๅ’Œ yarn ็š„้•œๅƒๆบไธบๆท˜ๅฎ้•œๅƒๆบ
# ==========================================================
# NPM
# ==========================================================
npm set registry https://registry.npmmirror.com # ๆณจๅ†Œๆจกๅ—้•œๅƒ
npm set disturl https://npmmirror.com/mirrors/node # node-gyp ็ผ–่ฏ‘ไพ่ต–็š„ node ๆบ็ ้•œๅƒ
## ไปฅไธ‹้€‰ๆ‹ฉๆทปๅŠ 
npm set sass_binary_site https://registry.npmmirror.com/mirrors/node-sass # node-sass ไบŒ่ฟ›ๅˆถๅŒ…้•œๅƒ
npm set electron_mirror https://registry.npmmirror.com/mirrors/electron/ # electron ไบŒ่ฟ›ๅˆถๅŒ…้•œๅƒ
@xcaptain
xcaptain / AuthzMiddleware.cs
Last active September 6, 2021 09:57
casbinnet asp dotnet core setup
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
using TodoApi.Services;
namespace TodoApi.Middlewares
{
public class AuthzMiddleware
{
private readonly RequestDelegate _next;
@Horusiath
Horusiath / Demo.cs
Last active November 24, 2020 06:04
Custom Akka.NET Streams graph stage for prefetching elements, when the buffer comes close to the empty
using Akka.Streams;
using Akka.Streams.Stage;
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
namespace Demo
{
sealed class PreFetch<T> : GraphStage<SourceShape<T>>
@y0ngb1n
y0ngb1n / docker-registry-mirrors.md
Last active December 19, 2025 03:51
ๅ›ฝๅ†…็š„ Docker Hub ้•œๅƒๅŠ ้€Ÿๅ™จ๏ผŒ็”ฑๅ›ฝๅ†…ๆ•™่‚ฒๆœบๆž„ไธŽๅ„ๅคงไบ‘ๆœๅŠกๅ•†ๆไพ›็š„้•œๅƒๅŠ ้€ŸๆœๅŠก | Dockerized ๅฎž่ทต https://github.com/y0ngb1n/dockerized

Docker Hub ้•œๅƒๅŠ ้€Ÿๅ™จ

ๅ›ฝๅ†…ไปŽ Docker Hub ๆ‹‰ๅ–้•œๅƒๆœ‰ๆ—ถไผš้‡ๅˆฐๅ›ฐ้šพ๏ผŒๆญคๆ—ถๅฏไปฅ้…็ฝฎ้•œๅƒๅŠ ้€Ÿๅ™จใ€‚

Dockerized ๅฎž่ทต https://github.com/y0ngb1n/dockerized

1๏ธโƒฃ Docker daemon ้…็ฝฎไปฃ็†๏ผˆๆŽจ่๏ผ‰

ๅ‚่€ƒ Docker daemon ้…็ฝฎไปฃ็†

@setu1421
setu1421 / UploadUtilityHelper.cs
Created April 6, 2019 06:41
Utility helper for uploading large files to AWS S3 bucket
public class UploadUtilityHelper
{
private readonly string bucketName = ConfigurationManager.AppSettings["BucketName"];
private static readonly RegionEndpoint bucketRegion = RegionEndpoint.USEast1;
public string UploadChunk(string fileName, string uploadId, int chunkIndex, int chunkMax, Stream stream, string prevETags)
{
var response = "";
try
@Egor-Skriptunoff
Egor-Skriptunoff / utf8_filenames.lua
Last active May 31, 2025 15:56
UTF-8 filenames on Windows in pure Lua
------------------------------------------------------------------------------------------------------------------------------
-- Module: utf8_filenames
------------------------------------------------------------------------------------------------------------------------------
-- Filename: utf8_filenames.lua
-- Version: 2019-07-13
-- License: MIT (see at the end of this file)
-- This module modifies standard Lua functions so that they work with UTF-8 filenames on Windows:
-- io.open
-- io.popen