Skip to content

Instantly share code, notes, and snippets.

View utensil's full-sized avatar

Utensil utensil

  • 18:29 (UTC +08:00)
View GitHub Profile
@yugui
yugui / gist:1724
Created July 23, 2008 13:39
Decorator for Ruby, inspired by Python
class Module
def declare(decorator, *args)
orig_method_added = method(:method_added)
metaclass = (class << self; self end)
defined_methods = []
metaclass.send(:define_method, :method_added) do |name|
orig_method_added.call(name)
defined_methods << name
end
begin
@isaacs
isaacs / node-and-npm-in-30-seconds.sh
Last active April 14, 2025 11:07
Use one of these techniques to install node and npm without having to sudo. Discussed in more detail at http://joyeur.com/2010/12/10/installing-node-and-npm/ Note: npm >=0.3 is *safer* when using sudo.
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc
. ~/.bashrc
mkdir ~/local
mkdir ~/node-latest-install
cd ~/node-latest-install
curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1
./configure --prefix=~/local
make install # ok, fine, this step probably takes more than 30 seconds...
curl https://www.npmjs.org/install.sh | sh
@jessykate
jessykate / Jekyll nd Octopress Liquid tag for MathJax.rb
Created February 18, 2011 23:37
A simple liquid tag for Jekyll/Octopress that converts {% m %} and {% em %} into inline math, and {% math %} and {% endmath %} into block equations, by replacing with the appropriate MathJax script tags.
module Jekyll
class MathJaxBlockTag < Liquid::Tag
def render(context)
'<script type="math/tex; mode=display">'
end
end
class MathJaxInlineTag < Liquid::Tag
def render(context)
'<script type="math/tex">'
end
@tdreyno
tdreyno / config.rb
Created August 3, 2011 23:22
Latex 2 PDF Middleman
# Find all markdown files
path = File.join(File.dirname(__FILE__), "source", "**/*.html.markdown")
# Also generate .latex files along side
Dir[path].each do |markdown_file|
http_path = markdown_file.split("source").last.gsub(".html.markdown", "")
page "#{http_path}.latex", :proxy => "#{http_path}.html", :latex => true, :layout => false
end
require "fileutils"
@utensil
utensil / svn_graph.rb
Created August 25, 2011 05:14
ruby script to generate svn revision graph, focus on branching and tagging
#README
# In order to run this script, the following command line tools must be installed:
# 1) a subversion client, under Windows, Slik SVN is recommended: http://www.sliksvn.com/en/download
# 2) a Graphviz toolset, which can be downloaded from http://www.graphviz.org/
# Also the following ruby gems must be installed:
require 'rubygems'
#'xmlsimple'
# gem: http://rubyforge.org/frs/?group_id=638
# doc: http://xml-simple.rubyforge.org/
@madhur
madhur / 0001-albino-windows-refactor.patch
Created September 1, 2011 07:34 — forked from jonforums/0001-albino-windows-refactor.patch
Make Jekyll play nice with Windows again post Albino + posix-spawn refactor
diff --git a/lib/albino.rb b/lib/albino.rb
index 387c8e9..b77d55e 100644
--- a/lib/albino.rb
+++ b/lib/albino.rb
@@ -1,4 +1,5 @@
require 'posix-spawn'
+require 'rbconfig'
##
# Wrapper for the Pygments command line tool, pygmentize.
@huacnlee
huacnlee / nginx.conf
Created September 14, 2011 13:50
Nginx http proxy cache to mirror of Rubygems.org
# 在本地服务器建立 rubygems.org 的镜像缓存,以提高 gem 的安装速度
# 此配置设置缓存过期为1天,也就是说,新上的 gem 无法马上安装
# 做这个起什么作用?
# rubygems 的很多资源文件是存放到 Amazon S3 上面的,由于 GFW 对某些 S3 服务器又连接重置或丢包,导致 gem 安装异常缓慢或有时候根本无法连接安装。
# 而通过这种跳板的方式可以很好的解决这个问题,当然前提是 Nginx反向代理 服务器需要在国外
proxy_cache_path /var/cache/rubygems levels=1:2 keys_zone=RUBYGEMS:10m
inactive=24h max_size=1g;
server {
listen 80;
@jcsalomon
jcsalomon / Cyrillic.txt
Last active January 17, 2023 16:39
Useful Unicode characters & their code points 
(see http://www.unicode.org/Public/emoji/1.0/full-emoji-list.html for emoji)
0391 Α 03b1 α 0397 Η 03b7 η 039d Ν 03bd ν 03a4 Τ 03c4 τ 03dc Ϝ 03dd ϝ 03da Ϛ 03db ϛ
0392 Β 03b2 β 03d0 ϐ 0398 Θ 03b8 θ 03d1 ϑ 039e Ξ 03be ξ 03a5 Υ 03c5 υ 0370 Ͱ 0371 ͱ
0393 Γ 03b3 γ 0399 Ι 03b9 ι 039f Ο 03bf ο 03a6 Φ 03c6 φ 03d5 ϕ 03fa Ϻ 03fb ϻ
0394 Δ 03b4 δ 039a Κ 03ba κ 03f0 ϰ 03a0 Π 03c0 π 03d6 ϖ 03a7 Χ 03c7 χ 03de Ϟ 03df ϟ 03d8 Ϙ 03d9 ϙ
0395 Ε 03b5 ε 03f5 ϵ 039b Λ 03bb λ 03a1 Ρ 03c1 ρ 03a8 Ψ 03c8 ψ 0372 Ͳ 0373 ͳ 03e0 Ϡ 03e1 ϡ
0396 Ζ 03b6 ζ 039c Μ 03bc μ 03a3 Σ 03c3 σ 03c2 ς 03a9 Ω 03c9 ω
A 0410 А 0430 а Ye 0404 Є 0454 є Ka 041A К 043A к Te 0422 Т 0442 т Sha 0428 Ш 0448 ш
Be 0411 Б 0431 б Zhe 0416 Ж 0436 ж El 041B Л 043B л Tshe 040B Ћ 045B ћ Shta 0429 Щ 0449 щ
Ve 0412 В 0432 в Ze 0417 З 0437 з Lje 0409 Љ 0459 љ Kje 040C Ќ 045C ќ Yer 042A Ъ 044A ъ
@jbrisbin
jbrisbin / NioScalabilityTest.java
Created January 3, 2012 22:14
Pure Java NIO scalability test
import java.io.IOException;
import java.net.InetSocketAddress;
import java.net.ServerSocket;
import java.net.StandardSocketOptions;
import java.nio.ByteBuffer;
import java.nio.channels.CancelledKeyException;
import java.nio.channels.ReadableByteChannel;
import java.nio.channels.SelectionKey;
import java.nio.channels.Selector;
import java.nio.channels.ServerSocketChannel;
@paulmillr
paulmillr / active.md
Last active July 22, 2025 02:26
Most active GitHub users (by contributions). https://paulmillr.com

Most active GitHub users (git.io/top)

The list would not be updated for now. Don't write comments.

The count of contributions (summary of Pull Requests, opened issues and commits) to public repos at GitHub.com from Wed, 21 Sep 2022 till Thu, 21 Sep 2023.

Because of GitHub search limitations, only 1000 first users according to amount of followers are included. If you are not in the list you don't have enough followers. See raw data and source code. Algorithm in pseudocode:

githubUsers