Skip to content

Instantly share code, notes, and snippets.

View grzhan's full-sized avatar
🧸
带娃宅

grzhan grzhan

🧸
带娃宅
View GitHub Profile
@kitallis
kitallis / static-file-server.go
Last active April 16, 2023 03:18
serve static files / directory with http basic auth in Go
/*
Simple static file server with http basic auth in go
Usage:
-p="8100": port to serve on
-d=".": the directory of static files to host
Navigating to http://localhost:8100 will display the index.html or directory
listing file.
*/
@grudko
grudko / gist:4c1dcd2a2eb29bc3d98cd19bfd916cbd
Created December 2, 2016 13:16
Asyncio aiohttp example with PonyORM
#!/usr/bin/env python3
import asyncio
from asyncio_extras import threadpool
from aiohttp import web
from pony.orm import *
db = Database()
@yukixz
yukixz / api_start2_diff.py
Created May 6, 2016 16:18
Diff api_start2
#!/usr/bin/env python3
'''
Diff api_start2.json
Usage: api_start2_diff.py api_start2.old.json api_start2.new.json
'''
import json
import sys
@yukixz
yukixz / Core-decode.py
Last active January 22, 2017 17:40
Decode kancolle's Core.swf.
#!/usr/bin/env python3
import sys
ORDER = [0, 7, 2, 5, 4, 3, 6, 1]
SRC = sys.argv[1]
DEST = sys.argv[2]
anonymous
anonymous / gist:f7e0675d360d5767c75d
Created May 29, 2014 03:02
Assembly code written by Xiaomi CEO Lei Jun, 20 years ago
;
; RI.ASM Revision 2.12 [ July 12, 1994 ]
Revision equ 'V2.12 '
;
; **************************************************************************
; * *
; * RAMinit Release 2.0 *
; * Copyright (c) 1989-1994 by Yellow Rose Software Co. *
; * Written by Mr. Leijun *
; * *
@soarez
soarez / ca.md
Last active July 19, 2024 04:05
How to setup your own CA with OpenSSL

How to setup your own CA with OpenSSL

For educational reasons I've decided to create my own CA. Here is what I learned.

First things first

Lets get some context first.

@theotherian
theotherian / Non-Blocking Guava Cache
Last active September 7, 2018 19:46
Blocking on cache reads beyond the first is just plain rude in my opinion, so refresh in the background.
Blocking on cache reads beyond the first is just plain rude in my opinion...
@jaypei
jaypei / use_c_sleep.go
Last active May 9, 2024 15:12
Golang的调度机制决定Sleep是用户态实现的。但实现存在一个问题,若go程序在Sleep的过程中系统时间发生变化,Sleep会不准确,因为runtime中的实现是通过时间列表判断每个goroutine的挂起时间,而这个时间就是用的系统时间。这段代码是用cgo调用C的sleep规避这个问题的实现。
package main
/*
#include <unistd.h>
*/
import "C"
import (
"fmt"
"time"
)
@MohamedAlaa
MohamedAlaa / tmux-cheatsheet.markdown
Last active July 23, 2024 05:34
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname

tmux cheatsheet

As configured in my dotfiles.

start new:

tmux

start new with session name: