Skip to content

Instantly share code, notes, and snippets.

View limitusus's full-sized avatar
🏠
Working from home

Tomoya Kabe limitusus

🏠
Working from home
View GitHub Profile
@limitusus
limitusus / fdpass.pl
Created February 7, 2013 07:25
Pass a file descriptor from a process to another process through an UNIX socket, with Socket::MsgHdr.
#!/usr/bin/env perl
use strict;
use warnings;
use Socket;
use Socket::MsgHdr;
use IO::Handle;
my ($parent, $child);
@limitusus
limitusus / paraserv.pl
Created February 7, 2013 18:02
TCP server that listens on multiple processes: accept succeeds only on one process for a connection.
#!/usr/bin/env perl
use strict;
use warnings;
use Socket;
use IO::Socket;
use IO::Socket::INET;
use IO::Select;
use IO::Handle;
#include <stdio.h>
#include <stdlib.h>
#include <sys/socket.h>
#include <sys/un.h>
#include <errno.h>
#include <unistd.h>
#include <sys/types.h>
int main(int argc, char** argv) {
int sock;
adding 'td-agent' group...
adding 'td-agent' user...
Installing default conffile...
prelink detected. Installing /etc/prelink.conf.d/td-agent-ruby.conf ...
cp: cannot stat `/opt/td-agent/usr/sbin/td-agent-ui': No such file or directory
chmod: cannot access `/usr/sbin/td-agent-ui': No such file or directory
Configure td-agent to start, when booting up the OS...
requires 'Digest::SHA';
requires 'MIME::Base64';
[root@ip-172-31-10-148 irq]# ethtool -i eth0
driver: ixgbevf
version: 2.16.1
firmware-version: N/A
bus-info: 0000:00:03.0
supports-statistics: yes
supports-test: yes
supports-eeprom-access: no
supports-register-dump: yes
supports-priv-flags: no
from __future__ import print_function
import json
import gzip
import boto3
import time
import httplib
import urllib
from cStringIO import StringIO
@limitusus
limitusus / test-redirect.sh
Created March 29, 2017 08:52
各エンドポイントが200を返すかどうかをテストする
#!/bin/sh
# Usage: $0 < redirect_list.tsv
while read from to;do
res=$(curl -s -D - -o /dev/null "$from")
if $(echo $res | grep "HTTP/1.1 200" > /dev/null); then
continue
fi
echo "from: $from to: $to"
@limitusus
limitusus / acm.tf
Created July 12, 2017 01:59
うまくいくprovider alias
data "aws_acm_certificate" "cert_global" {
domain = "example.com"
provider = "aws.virginia"
}
output "certificate" {
value = "${data.aws_acm_certificate.cert_global.arn}"
}
@limitusus
limitusus / acm.tf
Created July 12, 2017 02:00
うまくいかないprovider alias
provider "aws" {
alias = "virginia"
region = "us-east-1"
}
data "aws_acm_certificate" "cert_global" {
domain = "example.com"
provider = "aws.virginia"
}