Skip to content

Instantly share code, notes, and snippets.

@funny-falcon
funny-falcon / changes.md
Last active March 23, 2024 05:53
Performace patch for ruby-1.9.3-p327

Changes:

  • this version includes backport of Greg Price's patch for speedup startup http://bugs.ruby-lang.org/issues/7158 .

    ruby-core prefers his way to do thing, so that I abandon cached-lp and sorted-lf patches of mine.

  • this version integrates 'array as queue' patch, which improves performance when push/shift pattern is heavily used on Array.

    This patch is accepted into trunk for Ruby 2.0 and last possible bug is found by Yui Naruse. It is used in production* for a couple of months without issues even with this bug.

@stewartadam
stewartadam / main.py
Last active March 5, 2024 16:02 — forked from gear11/main.py
Simple Python proxy server based on Flask and Requests with support for GET and POST requests.
"""
A simple proxy server, based on original by gear11:
https://gist.github.com/gear11/8006132
Modified from original to support both GET and POST, status code passthrough, header and form data passthrough.
Usage: http://hostname:port/p/(URL to be proxied, minus protocol)
For example: http://localhost:5000/p/www.google.com
"""
import re
@Gab-km
Gab-km / smugnessProblem.rst
Created April 19, 2012 08:01
コードウォッチ:関数型プログラミングの自惚れ問題

コードウォッチ:関数型プログラミングの自惚れ問題

原文

http://www.sdtimes.com/link/36534

著者

Larry O'Brien

僕は関数型プログラミングが好きだ。次の10年にかけてコードの革命を起こしていくだろうと考えている:言語はより関数型の機能を採用していくだろうし、開発者はより関数型の技術を導入していくだろうし、いくつかの点では、関数型プログラミングの原則はコードを組み立てていく上で「自然で」もっとも明確なやり方だとみんな考えるようになっていくだろう。

だけど、僕はもうこのシナリオを本気にしちゃいない。関数型プログラミングは、ワクワクするものを学ぶことに興味があると言っている主流のプログラマにとって明白な、大きな問題を抱えている:関数型プログラマーは自惚れ野郎どもだってことだ。

@datagrok
datagrok / gist:2199506
Last active April 8, 2023 17:36
Virtualenv's `bin/activate` is Doing It Wrong
@kazuho
kazuho / git-blame-pr.pl
Last active June 28, 2022 07:15
git-blame by PR #
#! /usr/bin/perl
#
# Written in 2017 by Kazuho Oku
#
# To the extent possible under law, the author(s) have dedicated all copyright and related and neighboring rights to this software to the public domain worldwide. This software is distributed without any warranty.
# You should have received a copy of the CC0 Public Domain Dedication along with this software. If not, see <http://creativecommons.org/publicdomain/zero/1.0/>.
#
use strict;
use warnings;
@norio-nomura
norio-nomura / swift-demangle-filter.py
Last active April 27, 2022 04:17
`swiftc -emit-assembly`してシンボルを`swift-demangle`で変換する
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# usage: swift-demangle-filter.py [-h] [-o <outfile>] [<file> <options>]
#
# Read swift assembly, demangle Swift Symbol and output it.
#
# positional arguments:
# <file> <options> If <file> has .swift, compile it with <options>; or read
# (<file> or <stdin>) as assembly.
@odashi
odashi / chainer_encoder_decoder.py
Last active January 22, 2021 14:03
Training and generation processes for neural encoder-decoder machine translation.
#!/usr/bin/python3
import datetime
import sys
import math
import numpy as np
from argparse import ArgumentParser
from collections import defaultdict
from chainer import FunctionSet, Variable, functions, optimizers
@ultraist
ultraist / zch_sentence.rb
Created February 2, 2012 15:49
句読点のない文字列を文単位に区切る
# -*- coding: utf-8 -*-
# 句読点のない文字列を文単位に区切る
#
# 基本的にはルールベースでルールが適用できない場合は機械学習器で判定する。
# これは青空文庫のデータ( http://www.udp.jp/misc/aozora-data/ )から学習した。
# * ruby 1.8の場合は $KCODE='u'としないと動かない
=begin
s = <<TEXT
昼飯のスパゲティナポリタンを眺めながら
import re
def fix_charref(s):
return re.sub(r'&#(\d+);', lambda m: unichr(int(m.group(1))), s)