Skip to content

Instantly share code, notes, and snippets.

@miyagawa
miyagawa / gist:965935
Created May 11, 2011 04:59
hijack any LWP stack with your PSGI app - it's on CPAN now http://search.cpan.org/~miyagawa/LWP-Protocol-PSGI-0.01/
use strict;
use LWP::UserAgent;
my $app = do {
use Mojolicious::Lite;
get '/' => sub { shift->render(text => "Hello World") };
get '/search' => sub {
my $self = shift;
my $foo = $self->param('q');
$self->render(text => "You searched $foo");
@methane
methane / myprofiler.py
Created December 5, 2011 08:54
Casual MySQL profiler using "SHOW FULL PROCESSLIST"
#!/usr/bin/env python
# coding: utf-8
"""myprofiler - Casual MySQL Profiler
https://github.com/methane/myprofiler
"""
import os
import sys
anonymous
anonymous / go-template-mode.el
Created January 21, 2012 21:33
Go template mode
;;; go-template-mode.el --- Major mode for Go template language
;;; Commentary:
;; 1) Copy this file somewhere in your Emacs `load-path'. To see what
;; your `load-path' is, run inside emacs: C-h v load-path<RET>
;;
;; 2) Add the following to your .emacs file:
;;
;; (require 'go-template-mode)
@earino
earino / gist:2996703
Created June 26, 2012 16:04
Snippet of code using Inline::C and leptonica for super duper fast image resizing
# stuff setting up moose and the environment omitted
sub BUILD {
my $self = shift;
my $application_environment = $ENV{'APPLICATION_ENVIRONMENT'};
my $conf = new Config::General($self->config_file);
my %config = $conf->getall;
#include "apr.h"
#include "apr_strings.h"
#include "apr_lib.h"
#define APR_WANT_STRFUNC
#include "apr_want.h"
#include "ap_config.h"
#include "httpd.h"
#include "http_config.h"
@xaicron
xaicron / gist:3490145
Created August 27, 2012 16:32
install-capnm
#!/bin/sh
set -e
HTTP_GET_COMMAND=""
if [ `which curl` ]; then
HTTP_GET_COMMAND="curl -L"
elif [ `which wget` ]; then
HTTP_GET_COMMAND="wget -O -"
elif [ `perl -v | grep "5.1[3-9]"` ]; then
HTTP_GET_COMMAND="perl -MHTTP::Tiny -e 'print +HTTP::Tiny->new->get(shift)->{content}'"
@hayajo
hayajo / changelog_en.md
Last active May 3, 2024 08:29
ChangeLog を支える英語

ChangeLog を支える英語

ChangeLog を書く際によく使われる英語をまとめました。

ほとんど引用です。

基本形

@JFK
JFK / gist:4591707
Last active September 16, 2019 21:10
Ngnix + Nginx-GridFS-Replicaset(mongodb) + nginx-image-filter +nginx-proxy-cache Sample Configuration
user www-data;
#worker_processes 4;
#worker_priority 0;
#worker_cpu_affinity 0001 0010 0100 1000;
#worker_rlimit_nofile 163840;
#worker_processes 8;
#worker_priority 0;
#worker_cpu_affinity 00000001 00000010 00000100 00001000 00010000 00100000 01000000 10000000;
@hayajo
hayajo / gist:6291004
Last active December 21, 2015 10:19
FormValidator::Liteで配列の制約
package MyApp::Validator::Constraint;
use strict;
use warnings;
use FormValidator::Lite::Constraint;
=head1 SYNOPSYS
my $fv = FormValidator::Lite->new($q);
$fv->check(
@YungSang
YungSang / 00-README.md
Last active August 29, 2023 21:03
CoreOS とその関連技術に関するここ半年間の私の活動まとめ

CoreOS とその関連技術に関するここ半年間の私の活動まとめ

はじめに

最近、社内で私が「何者で何をしているのか見えないので可視化して欲しい」という案件が出ているらしいので、ヘコヘコと徒然なるままに書いていきたいと思うのであります。

社内向けというだけでなく社外の人にも発信出来る内容に、との仕様も要求され、社外向けには出来るだけ旬なネタで、かつ、社内向けにはそれを理解する上で必要な関連する技術を個々に触れながら基礎知識が無くても理解出来るように、との追加仕様も提示されております。

で、何をネタにしてどのように書けばいいのか迷った訳ですが、自分が実際にやって来た内容である CoreOS であればそこそこ旬であるし、それをおさらいしつつ、関連技術も Docker、Omaha、systemd、BtrFS、Golang、etcd、Kubernetes 等々多岐にわたるので、それらに関して私見も含めてわかりやすく書ければいいかなぁと、とりあえず書き始めようとしている次第であります。