Skip to content

Instantly share code, notes, and snippets.

View methane's full-sized avatar

Inada Naoki methane

View GitHub Profile
@frsyuki
frsyuki / m5.md
Last active December 14, 2015 18:09

msgpackの変更案について-5

提案の目的

  • 互換性の影響を最小限にしつつ、文字列を透過的に扱えるようにする方法を提供する
  • MessagePackから分離された上位レイヤーが、MessagePackの仕様に変更を加えずに、独自の型を定義できるようにする
  • 将来的にMessagePackに新たな機能が追加されても、既存のコードに影響を与えないようにする

概要

@untitaker
untitaker / gist:5321447
Last active January 15, 2017 18:13
Werkzeug Python 3 notes
package main
import (
"labix.org/v1/pipe"
"log"
)
func main() {
output, err := pipe.CombinedOutput(
pipe.Line(
@cjerdonek
cjerdonek / .bashrc
Created November 21, 2013 15:30
A snippet to automatically call virtualenvwrapper's "workon" command when entering a directory in the shell. This can be added to your .profile, .bash_profile, .bashrc, etc.
# Call virtualenvwrapper's "workon" if .venv exists. This is modified from--
# http://justinlilly.com/python/virtualenv_wrapper_helper.html
# which is linked from--
# http://virtualenvwrapper.readthedocs.org/en/latest/tips.html#automatically-run-workon-when-entering-a-directory
check_virtualenv() {
if [ -e .venv ]; then
env=`cat .venv`
echo "Found .venv in directory. Calling: workon ${env}"
workon $env
fi
@gfx
gfx / foo.pl
Last active September 17, 2017 21:57
正規表現リテラルがあると便利な例。これを文字列操作メソッドで解決するとなるとかなり難しいと思われますがどうでしょう。 また、正規表現リテラルがなくてもじっさいにはあまり変わりないのですが、 \S ではなく \\S と書かなければならなかったりして注意しなければならない点が増えます。
#!perl
use 5.10.0;
use strict;
use warnings;
my $localhost = join '|', map { quotemeta } 'localhost', '127.0.0.1';
my $s = "http://localhost/foo http://127.0.0.1/bar http://127_0_0_1/foo/bar/baz";
my @matched = $s =~ m{ http:// (?:$localhost) / \S+ }xg;
@frsyuki
frsyuki / presto-client.py
Last active October 11, 2020 09:56
Presto client for Ruby and Python
import os
import json
import httplib
import time
VERSION = "0.1.0"
class ClientSession:
def __init__(self, server, user, source=None, catalog=None, schema=None, debug=False):
self.server = server
#!/usr/bin/env python
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
from twisted.internet.protocol import ClientFactory
from twisted.protocols.basic import LineReceiver
from twisted.internet import reactor
import sys
@voluntas
voluntas / webrtc.rst
Last active January 13, 2025 22:40
WebRTC の未来
# GCEでUbuntu 15.04
sudo su -
apt-get update && apt-get -y install ansible jq
git clone https://github.com/isucon/isucon5-qualify.git
cd isucon5-qualify/
cd gcp/bench/ansible/
sed -i 's/- copy/#- copy/' 00_devel.yml
sed -i 's@key_file=.*@@' 06_deploy_bench_tool.yml
sed -i 's@repo=.*@repo=https://github.com/isucon/isucon5-qualify.git@' 06_deploy_bench_tool.yml
##
## Syntax
##
# Define a type:
#
# <MessageName>:
# <fieldIndex>: [<fieldName>, <type>, <options...>]
# ...
#
# Typedef (type alias):