Skip to content

Instantly share code, notes, and snippets.

View sss's full-sized avatar

SASAKI Suguru sss

  • Kyoto, Japan
View GitHub Profile
###
# This is a demonstration of using SQLite3's Virtual File System API in Ruby.
#
# == Synopsis
#
# This program will store its SQLite database after the __END__ line.
#
# === In Detail
#
# SQLite3 uses the DATABase class as a proxy for our IO object. Upon
def tip(msg); puts; puts msg; puts "-"*100; end
#
# 30 Ruby 1.9 Tips, Tricks & Features:
# http://www.igvita.com/2011/02/03/new-ruby-19-features-tips-tricks/
#
tip "Upgrading to Ruby 1.9 is simple: rvm install 1.9.2 && rvm --default 1.9.2"
tip "Ruby 1.9 supports named captures in regular expressions!"
@takekazuomi
takekazuomi / build -Wall -WX-
Created July 23, 2011 13:36
libgit2 compile with x64 VC++
Microsoft(R) Visual Studio Version 10.0.40219.1.
Copyright (C) Microsoft Corp. All rights reserved.
1>------ ビルド開始: プロジェクト: ZERO_CHECK, 構成: Debug x64 ------
1> Checking Build System
1> CMake does not need to re-run because C:/home/takekazu/src/libgit2/buildx64/CMakeFiles/generate.stamp is up-to-date.
2>------ ビルド開始: プロジェクト: git2, 構成: Debug x64 ------
3>------ ビルド開始: プロジェクト: libgit2_test, 構成: Debug x64 ------
3> Building Custom Rule C:/home/takekazu/src/libgit2/CMakeLists.txt
2> Building Custom Rule C:/home/takekazu/src/libgit2/CMakeLists.txt
@waltarix
waltarix / tmux-do-not-combine-utf8.patch
Last active May 29, 2022 09:58
tmux: Fix a problems with displaying Ambiguous-width, Japanese Dakuten and Handakuten signs.
diff --git a/screen-write.c b/screen-write.c
index 15f8d07..8a175a6 100644
--- a/screen-write.c
+++ b/screen-write.c
@@ -1334,6 +1334,7 @@ screen_write_cell(struct screen_write_ctx *ctx, const struct grid_cell *gc)
ctx->cells++;
/* If the width is zero, combine onto the previous character. */
+ /*
if (width == 0) {
@emanuelez
emanuelez / git_speed.md
Last active July 1, 2024 05:18
Git Speed

How Fast is Git?

The web is full of benchmarks showing the supernatural speed of Git even with very big repositories, but unfortunately they use the wrong variable. Size is not important, but the number of files in the repository really is!

Why is that? Well, that's because Git works in a very different way compared to Synergy. You don't have to checkout a file in order to edit it; Git will do that for you automatically. But at what price?

The price is that for every Git operation that requires to know which files changed (git status, git commmit, etc etc) an lstat() call will be executed for every single file

Wow! So how does that perform on a fairly large repository? Let's find out! For this example I will use an example project, which has 19384 files in 1326 folders.

@sss
sss / executable-with-subcommands-using-thor.log
Created February 24, 2012 20:16
Revised: Namespacing thor commands in a standalone Ruby executable
$ ./executable-with-subcommands-using-thor.rb
Tasks:
executable-with-subcommands-using-thor.rb help [TASK] # Describe available tasks or one specific task
executable-with-subcommands-using-thor.rb subA [TASK] # Execute a task in namespace subA
executable-with-subcommands-using-thor.rb subB [TASK] # Execute a task in namespace subB
executable-with-subcommands-using-thor.rb test # test in CLI
$ ./executable-with-subcommands-using-thor.rb help
Tasks:
executable-with-subcommands-using-thor.rb help [TASK] # Describe available tasks or one specific task