Skip to content

Instantly share code, notes, and snippets.


Chao Guo jeffguorg

View GitHub Profile
jeffguorg / inplace
Last active Aug 6, 2021
inplace function in zsh
View inplace
#!/usr/bin/env zsh
inplace() {
set -x
OUTPUT="$(bash -c "${COMMAND} '${FILEPATH}'")"
if [ $RET -eq 0 ]; then
echo -n "$OUTPUT" >! "${FILEPATH}"
jeffguorg / CMakeLists.txt
Last active May 28, 2021
CMakeLists.txt for lazybones like me
View CMakeLists.txt
cmake_minimum_required(VERSION 3.3.0)
project(blablabla VERSION 0.1.0)
jeffguorg / baseX.go
Last active Oct 14, 2022
baseX encoding - 演示用任意字符集合编码数据
View baseX.go
package baseX
import (
type Encoder struct {
encodeMap []rune
decodeMap map[rune]int
jeffguorg / controller.go
Last active Nov 28, 2020
dbus counter demo
View controller.go
package main
import (
jeffguorg / fancy-index.xslt
Last active Jun 14, 2022
nginx fancy index
View fancy-index.xslt
<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="1.0" xmlns:xsl="">
<xsl:output method="html" encoding="UTF-8" />
<xsl:template match="/">
<xsl:text disable-output-escaping="yes">&lt;!DOCTYPE html&gt;</xsl:text>
jeffguorg /
Last active Sep 12, 2018
an asyncio daemon pattern
import asyncio
import queue
ioloop = asyncio.get_event_loop()
def timer(interval=5):
def wrapper(func):
async def runner(*args, **kwargs):
while True:
asyncio.ensure_future(func(*args, **kwargs))