Skip to content

Instantly share code, notes, and snippets.

@wahtherewahhere
wahtherewahhere / linebot.py
Last active November 26, 2023 09:28
LineBot+Python+FastAPI
'''
requirements:
uvicorn==0.24.0.post1
fastapi==0.104.1
line-bot-sdk==3.5.1
'''
import logging
import configparser
@wahtherewahhere
wahtherewahhere / endianness.h
Created November 5, 2023 09:15 — forked from jtbr/endianness.h
cross-platform / cross-compiler standalone endianness conversion
/**
* @file endianness.h
* @brief Convert Endianness of shorts, longs, long longs, regardless of architecture/OS
*
* Defines (without pulling in platform-specific network include headers):
* bswap16, bswap32, bswap64, ntoh16, hton16, ntoh32 hton32, ntoh64, hton64
*
* Should support linux / macos / solaris / windows.
* Supports GCC (on any platform, including embedded), MSVC2015, and clang,
* and should support intel, solaris, and ibm compilers as well.
#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN
#endif
#include <windows.h>
#include <iostream>
void test1()
{
HANDLE m_hEvent[2];
m_hEvent[0] = CreateEvent(NULL, TRUE, FALSE, NULL);
@wahtherewahhere
wahtherewahhere / Robocopy-With-Gitignore.cs
Last active October 4, 2023 17:03
Translate .gitignore pattern to robocopy /XD parameters
/*
This script can help to translate all .gitignore pattern into robocopy /XD parameters.
The result will be in outputFile.
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
@wahtherewahhere
wahtherewahhere / sync-rest-rpc.md
Created January 15, 2018 06:51 — forked from benjchristensen/sync-rest-rpc.md
Regarding synchronous RESTful communication ...

Response to https://twitter.com/jeffreymaxwell/status/705760483391963136 requiring more than the 77 characters left on Twitter.

DISCLAIMER: The quality of writing and thinking here is aligned with a Twitter conversation, not a blog post, presentation, or book ;-)

Synchronous RESTful communication between Microservices is an anti-pattern ... you seem to being saying that the Netflix architecture (hystrix, eureka, ribbon, ..) is broken ... hmm what would @benjchristensen say?

@wahtherewahhere
wahtherewahhere / flask_context.py
Created January 12, 2018 02:13 — forked from guyskk/flask_context.py
理解Flask上下文环境
import flask
from flask import Flask
app = Flask(__name__)
@app.route("/")
def index():
return "hello"
@wahtherewahhere
wahtherewahhere / zeromq-vs-redis.md
Created January 5, 2018 06:33 — forked from hmartiro/zeromq-vs-redis.md
Comparison of ZeroMQ and Redis for a robot control platform

ZeroMQ vs Redis

This document is research for the selection of a communication platform for robot-net.

Goal

The purpose of this component is to enable rapid, reliable, and elegant communication between the various nodes of the network, including controllers, sensors, and actuators (robot drivers). It will act as the core of robot-net to create a standardized infrastructure for robot control.

Requirements:

@wahtherewahhere
wahtherewahhere / redis_asyncio.py
Created November 28, 2017 03:33 — forked from yihuang/redis_asyncio.py
benchmark gevent vs asyncio on python3.4
import asyncio
import hiredis
d = {}
def process(req):
cmd = req[0].lower()
if cmd==b'set':
d[req[1]] = req[2]
return b"+OK\r\n"
@wahtherewahhere
wahtherewahhere / tmux-cheatsheet.markdown
Created November 7, 2017 01:17 — forked from ryerh/tmux-cheatsheet.markdown
Tmux 快捷键 & 速查表

Tmux 快捷键 & 速查表

启动新会话:

tmux [new -s 会话名 -n 窗口名]

恢复会话:

tmux at [-t 会话名]
@wahtherewahhere
wahtherewahhere / kubeception.md
Created October 25, 2017 02:24 — forked from dghubble/kubeception.md
Running QEMU/KVM and Nested Kubernetes on Bare-Metal Kubernetes