Skip to content

Instantly share code, notes, and snippets.

View dulao5's full-sized avatar

Du Zhigang (ト シゴウ) dulao5

View GitHub Profile
require 'date'
require 'benchmark'
puts "patchlevel: #{RUBY_PATCHLEVEL}, release_date: #{RUBY_RELEASE_DATE}, ruby_version: #{RUBY_VERSION}, ruby_platform: #{RUBY_PLATFORM}"
puts '*'*80
Benchmark.bm(10) do |bm|
bm.report("Date.today") do
500_000.times { Date.today }
@zyxar
zyxar / exercise.tour.go
Last active April 28, 2024 17:06
tour.golang exercise solutions
/* Exercise: Loops and Functions #43 */
package main
import (
"fmt"
"math"
)
func Sqrt(x float64) float64 {
z := float64(2.)
package main
import "fmt"
// fibonacci is a function that returns
// a function that returns an int.
func fibonacci() func() int {
x, y := 0, 1
return func() int {
x, y = y, x + y
@rinh
rinh / require.jison
Created February 5, 2013 04:49
使用jison进行语义分析,生成AST并修改源代码
%lex
%s l_comment req
%%
"/*" { this.begin('l_comment'); return 'L_COMMENT_START'; }
<l_comment>"*/" { this.popState(); return 'L_COMMENT_END'; }
<l_comment>(.|\n) { return 'L_COMMENT_CHR'; }
@deltheil
deltheil / libcurl_dns.md
Last active March 15, 2019 00:54
libcurl options to control DNS lookup (cache, timeout, resolving time, etc). The short URL for this page is: http://git.io/libcurl-dns.

Easy handle interface

Options

Info

@ngyuki
ngyuki / uopz-di-classes.php
Last active March 6, 2018 12:29
Example of uopz di experimental
<?php
interface SayInterface
{
public function say();
}
class Ore implements SayInterface
{
public function say()
{
@voluntas
voluntas / webrtc_stack.rst
Last active June 4, 2023 13:23
WebRTC スタックコトハジメ

WebRTC スタックコトハジメ

WebRTC スタックについて

作:@voluntas
バージョン:0.0.3
url:https://voluntas.github.io/
@dulao5
dulao5 / Readme.md
Last active November 2, 2017 14:02
make-contents.md

Markdownドキュメントの目次を自動的に作るツールです。

  • main.jsのJavaScriptをコピーして、ここにペストしてください。
  • Bookmarklet nameMD Contentsを入力してください。
  • Compressボッタンを押してください。
  • 画面下の辺のMD Contentsの__リンク__を __ドロップ__して、ブラウザのBookmark Tools Barに移動してください。
  • 使いたい際に、ブラウザでMarkdownのページを開いて、Bookmark Tools BarMD Contentsをクリックしてください。
    • ポップアップの内容は目次です。すべてを選んで、Wikiにコピペしてください。
@hashrock
hashrock / diag.md
Last active February 26, 2024 05:51
作図系ツール・ライブラリまとめ

シーケンス図とかフローチャートをしごとで描画することになった場合、 テキストから生成できたら楽なので、それ系のツールまとめ

GraphViz

http://www.graphviz.org/

  • C製
  • Doxygen, Moinmoinなどと連携可能
  • ブロック図、クラス図、ネットワーク図など
@toolness
toolness / sshify.py
Created March 14, 2017 20:31
A script to run a command within an ssh-agent session.
#! /usr/bin/env python3
"""
This utility will execute the given command (by default, your shell)
in a subshell, with an ssh-agent process running and your
private key added to it. When the subshell exits, the ssh-agent
process is killed.
"""
# This code was written by Atul Varma in February 2017. It requires