Skip to content

Instantly share code, notes, and snippets.

Avatar
🦀
Rustacean

Garden Yuen weaming

🦀
Rustacean
View GitHub Profile
@weaming
weaming / confirm.go
Created Feb 3, 2021 — forked from r0l1/confirm.go
Go (golang): How to ask for user confirmation via command line
View confirm.go
/* MIT License
*
* Copyright (c) 2017 Roland Singer [roland.singer@desertbit.com]
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
View alembic-graph
#!/usr/local/bin/python3
# Created : 2020-07-16 13:06:10
import sys
import os
from graphviz import Digraph
fmt = os.getenv('GRAPH_FMT', 'dot')
dot = Digraph(comment='alembic', format=fmt)
View MacOS X El Capitan with Vagrant - MacOS X VM on Windows or Linux.md
@weaming
weaming / haproxy.cfg
Created May 11, 2020 — forked from cmer/haproxy.cfg
Simple, no bullshit TCP port forwarding using HAProxy
View haproxy.cfg
listen l1
bind 0.0.0.0:443
mode tcp
timeout connect 4000
timeout client 180000
timeout server 180000
server srv1 host.example.com:9443
@weaming
weaming / webdavserv.go
Created Nov 28, 2019 — forked from staaldraad/webdavserv.go
A small webdav server in go
View webdavserv.go
package main
import (
"flag"
"fmt"
"log"
"net/http"
"os"
"golang.org/x/net/webdav"
@weaming
weaming / youdao.py
Created Aug 21, 2016 — forked from DeanThompson/youdao.py
命令行版本的有道词典
View youdao.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
命令行版本的有道词典,调用有道翻译的 API 实现
用法一:
% python youdao.py search
原文: search
发音: sɜːtʃ
@weaming
weaming / ua.js
Last active Jul 11, 2016 — forked from Takazudo/ua.js
View ua.js
var ua = (function(){
var ua = {};
var navigator = window.navigator;
var platforms = [
{ property: 'platform', regex: /iPhone/i, identity: 'iPhone' },
{ property: 'platform', regex: /iPod/i, identity: 'iPod' },
{ property: 'userAgent', regex: /iPad/i, identity: 'iPad' },
{ property: 'userAgent', regex: /Blackberry/i, identity: 'Blackberry' },
{ property: 'userAgent', regex: /Android/i, identity: 'Android' },
{ property: 'platform', regex: /Mac/i, identity: 'Mac' },
@weaming
weaming / baidu-as-a-network-utility.css
Last active May 17, 2016 — forked from tianyuf/baidu-as-a-network-utility.css
BaaN: Baidu as a Network Utility - 百度的实用主义方法论.
View baidu-as-a-network-utility.css
@-moz-document domain("baidu.com") {
#u1,
#ftCon,
#form input,
#form span
{display: none;}
#form::after {
font-family: "BlinkMacSystemFont", "Segoe UI", sans-serif;
@weaming
weaming / sed.md
Last active Jan 6, 2016 — forked from zxhfighter/sed.md
sed简明教程
View sed.md

sed简明教程

FROM: 酷壳-陈皓

awk于1977年出生,今年36岁本命年,sed比awk大2-3岁,awk就像林妹妹,sed就是宝玉哥哥了。所以林妹妹跳了个Topless,他的哥哥sed坐不住了,也一定要出来抖一抖。

sed全名叫stream editor,流编辑器,用程序的方式来编辑文本,相当的hacker啊。sed基本上就是玩正则模式匹配,所以,玩sed的人,正则表达式一般都比较强。

同样,本篇文章不会说sed的全部东西,你可以参看sed的手册,我这里主要还是想和大家竞争一下那些从手机指缝间或马桶里流走的时间,用这些时间来学习一些东西。当然,接下来的还是要靠大家自己双手。