Skip to content

Instantly share code, notes, and snippets.

View noname007's full-sized avatar
📖
Focusing

soul11201 noname007

📖
Focusing
View GitHub Profile
@noname007
noname007 / README.md
Created November 20, 2025 12:47 — forked from corlaez/README.md
Hexagonal Architecture and Modular Implementation

Hexagonal Architecture

Conceptualized by Alistair Cockburn. Also known as "Ports and Adapters".

In a nutshell:

Application Driver -> Primary Adapter -> Primary Port -> Use Case -> Secondary Port -> Secondary Adapter -> External System/Side Effect
  1. Plain Strings (207): foo
  2. Anchors (208): k$
  3. Ranges (202): ^[a-f]*$
  4. Backrefs (201): (...).*\1
  5. Abba (169): ^(.(?!(ll|ss|mm|rr|tt|ff|cc|bb)))*$|^n|ef
  6. A man, a plan (177): ^(.)[^p].*\1$
  7. Prime (286): ^(?!(..+)\1+$)
  8. Four (199): (.)(.\1){3}
  9. Order (198): ^[^o].....?$
  10. Triples (507): (^39|^44)|(^([0369]|([147][0369]*[258])|(([258]|[147][0369]*[147])([0369]*|[258][0369]*[147])([147]|[258][0369]*[258])))*$)
Golang 面试题 (4) N个协程交替打印1-100
启动N个协程,共用一个外部变量计数器,计数器范围是1到100
开启N个有缓冲chan,chans[i]塞入数据代表协程i可以进行打印了,打印的数字就是计数器的数
协程i一直阻塞,直到chan[i]通道有数据可以拉,才打印
@noname007
noname007 / sig_fork.c
Created June 21, 2024 09:01
fork when exec signal handler
#include <unistd.h>
#include <stdio.h>
#include <string.h>
#include <errno.h>
#include <sys/wait.h>
#include <stdlib.h>
void alrm_handler(int signo)
{
printf("%d pid:%d\n", signo, getpid());
@noname007
noname007 / ssl_smtp_example.go
Created October 17, 2023 06:15 — forked from chrisgillis/ssl_smtp_example.go
Golang SSL SMTP Example
package main
import (
"fmt"
"log"
"net"
"net/mail"
"net/smtp"
"crypto/tls"
)
@noname007
noname007 / mail.go
Created October 8, 2023 12:17 — forked from xeoncross/mail.go
Simple SMTP mail sender in golang that can send email directly to anyone. Super basic, but great for sending notice emails. Upgrades to STARTTLS if it can.
package main
import (
"encoding/base64"
"fmt"
"log"
"net"
"net/mail"
"net/smtp"
"strings"
@noname007
noname007 / rsync_backup.py
Created December 7, 2020 06:28 — forked from seebk/rsync_backup.py
Python rsync backup script
#!/usr/bin/python3
#######################################################
# Python rsync Backup script
# Sebastian Kraft, 24.06.2013
#
#######################################################
#-----------------------------------------------------
# Config
@noname007
noname007 / vimium-emacs.md
Created July 27, 2020 08:38 — forked from dmgerman/vimium-emacs.md
Emacs-Style Key Bindings for Vimium

My Vimium Key Bindings (Emacs-Style)

This is a full set of key bindings (as of Vimium v1.45); covering all Vimium functionality. I have tried to map all Vimium functionality to comparable Emacs functionality (whenever possible). In cases where there is no equivalent, those commands are prefixed by <c-g> (indicating <c-g>oogle Chrome; and because <c-g> does not conflict with other Emacs shortcuts at all).

Commented Shortcuts: There are a few Emacs-style shortcuts that are simply not possible in Vimium. All of my shortcuts (including those which were not possible; i.e. where I used a decent alternative) have been commented below. This should help to clarify my rationale.

_Compatibility: All of these shortcuts were tested on Mac OS X (Mavericks). Please note that all of my shortcuts operate under the assumption that your Emacs Meta key is the Alt/Option key. This really was my only choice, because the key is already used in Chrome for shortcuts that c

@noname007
noname007 / up.sh
Last active August 21, 2019 08:43
#!/bin/bash
#https://blog.csdn.net/mydriverc2/article/details/79011438
set -x
cmd="$@"
r=$(ps aux|grep "${cmd}" | grep -v "$0"|grep -v 'grep')
@noname007
noname007 / Zend_bench.php.log
Created February 14, 2019 13:34 — forked from rybakit/Zend_bench.php.log
php8 jit msgpack.php benchmarks
$ sapi/cli/php Zend/bench.php
------------------------
Total 0.497
$ sapi/cli/php -dextension_dir=`pwd`/modules -dzend_extension=opcache.so Zend/bench.php
------------------------
Total 0.488
$ sapi/cli/php -dextension_dir=`pwd`/modules -dzend_extension=opcache.so -dopcache.enable_cli=1 -dopcache.file_update_protection=0 -dopcache.jit_buffer_size=1M Zend/bench.php
------------------------