Skip to content

Instantly share code, notes, and snippets.

View methane's full-sized avatar

Inada Naoki methane

  • KLab Inc,
  • Japan
  • 06:49 (UTC +09:00)
  • X @methane
View GitHub Profile
@koron
koron / sources.list
Created August 3, 2016 13:16
Bash on Ubuntu on Windows の apt の設定 /etc/apt/sources.list はこうすべし。
deb mirror://mirrors.ubuntu.com/mirrors.txt trusty main restricted universe multiverse
deb mirror://mirrors.ubuntu.com/mirrors.txt trusty-updates main restricted universe multiverse
deb mirror://mirrors.ubuntu.com/mirrors.txt trusty-security main restricted universe multiverse
@nobonobo
nobonobo / makecert.sh
Last active September 29, 2016 07:30
1行でオレオレ証明書を作る
go run $(go env GOROOT)/src/crypto/tls/generate_cert.go --host localhost
##
## Syntax
##
# Define a type:
#
# <MessageName>:
# <fieldIndex>: [<fieldName>, <type>, <options...>]
# ...
#
# Typedef (type alias):
# 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
@voluntas
voluntas / webrtc.rst
Last active January 23, 2024 06:57
WebRTC の未来
#!/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
@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
@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;
@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
package main
import (
"labix.org/v1/pipe"
"log"
)
func main() {
output, err := pipe.CombinedOutput(
pipe.Line(