Skip to content

Instantly share code, notes, and snippets.

View dllen's full-sized avatar
🐌
Focusing

roc dllen

🐌
Focusing
View GitHub Profile
@dllen
dllen / git-branch-rules.md
Created September 6, 2024 08:33 — forked from greyspot09/git-branch-rules.md
git 分支规范

主分支 master

  • master 为主分支,要保护它的稳定性,随时可用来上线。
  • 我们不应该直接在 master 分支上直接提交代码,而是从其它分支的合并。

开发分支 develop

  • develop 为开发分支,一般包含正在开发的所有新特性,用于测试环境部署和测试。
  • 我们不应该直接在 develop 分支上直接提交代码,也不应该把未经测试的代码合并进来,应该尽量保持测试环境干净可用。
  • 当 develop 太“脏”以至于不能继续测试之后,可以考虑重新从 master 拉取一次。
@dllen
dllen / iptables-cheatsheet.md
Created August 13, 2024 08:48 — forked from mcastelino/iptables-cheatsheet.md
iptables-cheatsheet

The netfilter hooks in the kernel and where they hook in the packet flow

The figure below calls out

  • The netfilter hooks
  • The order of table traversal
@dllen
dllen / Netfilter-IPTables-Diagrams.md
Created May 9, 2024 03:52 — forked from nerdalert/Netfilter-IPTables-Diagrams.md
Linux NetFilter, IP Tables and Conntrack Diagrams

Linux NetFilter, IP Tables and Conntrack Diagrams

IPTABLES TABLES and CHAINS

IPTables has the following 4 built-in tables.

1) Filter Table

Filter is default table for iptables. So, if you don’t define you own table, you’ll be using filter table. Iptables’s filter table has the following built-in chains.

@dllen
dllen / CacheConfig
Created April 7, 2024 15:51 — forked from ugur93/CacheConfig
Example of Spring Redis Cache Configuration using Spring-Data-Redis Lettuce Driver
import com.lambdaworks.redis.resource.DefaultClientResources;
import com.lambdaworks.redis.resource.Delay;
import org.apache.commons.pool2.impl.GenericObjectPoolConfig;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cache.CacheManager;
import org.springframework.cache.annotation.CachingConfigurerSupport;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.cache.interceptor.CacheErrorHandler;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@dllen
dllen / lockfile_demo.sh
Created April 3, 2024 06:24 — forked from karlrwjohnson/lockfile_demo.sh
Lockfile Demo - Demonstrates how to use Linux's "flock" command to create mutexes inside of a shell script
#!/bin/bash
# Lockfiles are a feature in Linux which allows multiple processes to use a file as a mutex.
# This script contains example code based on this blog post, but with a bugfix: https://dmorgan.info/posts/linux-lock-files/
# Wrapper function for easy reuse.
# I've heavily annotated it, but without the comments or arguments it's only 13 lines long.
# Parameters (you can hard-code them instead if you want)
# - LOCK_FILE: Which file to use for the lock.
@dllen
dllen / content.md
Created February 21, 2024 01:17 — forked from baymaxium/content.md
小米开源分布式KV存储系统Pegasus

原文:InfoQ

作者|孙伟杰

编辑|小智

小米近日开源了分布式 KV 存储系统 Pegasus,这个小米自造的轮子背后,有着什么样的设计理念与技术细节?

@dllen
dllen / init.gradle.kts
Created February 1, 2024 12:13 — forked from AlexV525/init.gradle.kts
Mirroring Gradle repositories
// Thanks to: https://gist.github.com/bennyhuo/af7c43cc4831661193605e124f539942
val urlMappings = mapOf(
"https://dl.google.com/dl/android/maven2" to "https://mirrors.tencent.com/nexus/repository/maven-public/",
"https://repo.maven.apache.org/maven2" to "https://mirrors.tencent.com/nexus/repository/maven-public/",
"https://plugins.gradle.org/m2" to "https://mirrors.tencent.com/nexus/repository/gradle-plugins/"
)
fun RepositoryHandler.mirroring() {
all {
@dllen
dllen / find_docker_container_from_pid.sh
Created January 10, 2024 12:21 — forked from jsidhu/find_docker_container_from_pid.sh
shell script to find docker container from process id
#!/bin/bash
cpid=$1
while true; do
ppid=$(ps -o ppid= -p $cpid)
pname=$(ps -o comm= -p $ppid)
if [ "$pname" == "docker" ]; then
echo "$cpid parent $ppid ($pname)"
break
else
@dllen
dllen / goGetPrivate.md
Created January 8, 2024 02:45 — forked from StevenACoffman/goGetPrivate.md
How to `go get` private repos using SSH key auth instead of password auth.

Set GOPRIVATE to match your github organization

Cloning the repo using one of the below techniques should correctly but you may still getting an unrecognized import error.

As it stands for Go v1.13, I found in the doc that we should use the GOPRIVATE variable like so:

GOPRIVATE=github.com/ORGANISATION_OR_USER_NAME go get -u -f github.com/ORGANISATION_OR_USER_NAME/REPO_NAME

The 'go env -w' command (see 'go help env') can be used to set these variables for future go command invocations.

How to go get private repos using SSH key auth instead of password auth.

@dllen
dllen / README.md
Created December 21, 2023 10:10 — forked from eusonlito/README.md
Strong iptables and ipset protection

Protect your server with a strong iptables rules and ipset lists.

1. Install ipset to manage ipstables lists

apt install ipset

2. Install iptables-persistent to preserve iptables rules on reboot