Skip to content

Instantly share code, notes, and snippets.

View xfguo's full-sized avatar
🎯
Focusing

Xiongfei(Alex) GUO xfguo

🎯
Focusing
View GitHub Profile
@xfguo
xfguo / sparc-solaris-on-qemu.md
Created November 8, 2019 06:33
Run Solaris/SPARC on QEMU
@xfguo
xfguo / waligood-25x80.txt
Last active December 19, 2018 11:33
0-error-0-warning
....:iLEWWWWKKWKWEL;,....
...:LKG;... ........ .;GKj...
..:DD,... ............. ..jEt.... :
...,Kt....:... . .:...............:EL .. ..:..
..GL..:jEDGj.. ..iDKKKWEEG,.........;K,.. -by Alex-
.:W,...,:;tjt,..,fLti::..:::.... . . LG . ..:..
...K:.........:,..:i;,iijj;..:.... . . .jG. :
..K:.....:D##,i... . .,LEL;;i:.... . fG..
.Gj.... ...,i:... ...,;:.. ..D;.
...K..... . ..... ..:E
@xfguo
xfguo / uip-simple.c
Created September 24, 2014 16:07
uip simple
#define DEBUG_PRINTF(...) /*printf(__VA_ARGS__)*/
/**
* \defgroup uip The uIP TCP/IP stack
* @{
*
* uIP is an implementation of the TCP/IP protocol stack intended for
* small 8-bit and 16-bit microcontrollers.
*
* uIP provides the necessary protocols for Internet communication,
@xfguo
xfguo / trello_card_ref_replace.py
Created May 21, 2014 07:23
Replace #N to Card URL for Trello
from trello import *
import re
from pprint import pprint
from difflib import *
client = TrelloClient(
'YOUR_KEY',
'YOUR_TOKEN',
)
@xfguo
xfguo / print_r.lua
Last active August 29, 2015 14:01 — forked from nrk/gist:31175
A function in Lua similar to PHP's print_r
-- A function in Lua similar to PHP's print_r, from http://luanet.net/lua/function/print_r
function print_r ( t )
local print_r_cache={}
local function sub_print_r(t,indent)
if (print_r_cache[tostring(t)]) then
print(indent.."*"..tostring(t))
else
print_r_cache[tostring(t)]=true
if (type(t)=="table") then
@xfguo
xfguo / udp_client.lua
Created April 12, 2014 16:06
Added UDP server example powered by luaevent.
-- udp-client test
-- based on code from http://blog.chinaunix.net/uid-27194309-id-3499261.htmlEF
local socket = require "socket"
local address = "127.0.0.1"
local port = 8080
local udp = socket.udp()
udp:settimeout(0)
udp:setpeername(address, port)
2013-07-20T04:33:56Z 14228 TID-otjsqcv8s PostReceive JID- INFO: start
2013-07-20T04:33:56Z 14228 TID-otjsqcv8s PostReceive JID- INFO: done: 0.17 sec
2013-07-20T04:33:56Z 14228 TID-k2bd4 ProjectWebHookWorker JID-decf635f996eb9157bcf1068 INFO: start
2013-07-20T04:34:07Z 14228 TID-k2bd4 ProjectWebHookWorker JID-decf635f996eb9157bcf1068 INFO: fail: 10.771 sec
2013-07-20T04:34:07Z 14228 TID-k2bd4 WARN: {"retry"=>true, "queue"=>"project_web_hook", "class"=>"ProjectWebHookWorker", "args"=>[1, {"before"=>"d1e2bfd5b87f9b956f154c14d97db2767da967bf", "after"=>"719a959e40c98aa3931f935e1c8c27a21c370c14", "ref"=>"refs/heads/master", "user_id"=>1, "user_name"=>"Alex Guo", "repository"=>{"name"=>"REPO_NAME", "url"=>"git@GITLAB_URL:REPO_NAME.git", "description"=>nil, "homepage"=>"https://GITLAB_URL/gitlab/REPO_NAME"}, "commits"=>[{"id"=>"719a959e40c98aa3931f935e1c8c27a21c370c14", "message"=>"Cont Test.", "timestamp"=>"2013-07-20T04:33:47+00:00", "url"=>"https://GITLAB_URL/gitlab/REPO_NAME/commit/719a959e40c98aa3931f935e1c8c27
from __future__ import absolute_import
import time
import bisect
import select
from threading import Thread
from pyasn1.codec.ber import encoder, decoder
from pysnmp.proto import api
from pysnmp.carrier.asynsock.dispatch import AsynsockDispatcher
@xfguo
xfguo / geventfd.py
Created November 4, 2012 03:32 — forked from wolever/geventfd.py
Simple wrapper around a file descriptor which will perform non-blocking reads/writes using gevent
import os
import fcntl
from gevent.socket import wait_read, wait_write
class GeventFD(object):
""" Wrap a file descriptor so it can be used for non-blocking reads and writes with gevent.
>>> stdin = GeventFD(sys.stdin.fileno())
>>> stdin.read(5)
'hello'