Skip to content

Instantly share code, notes, and snippets.

View giwa's full-sized avatar

Ken Takagiwa giwa

  • Nombre Premier
  • Tokyo
View GitHub Profile
@giwa
giwa / file0.txt
Last active December 6, 2023 07:36
Install g++/gcc 4.8.2 in CentOS 6.6 ref: http://qiita.com/giwa/items/28c754d8fc2936c0f6d2
$ wget http://people.centos.org/tru/devtools-2/devtools-2.repo -O /etc/yum.repos.d/devtools-2.repo
$ yum install devtoolset-2-gcc devtoolset-2-binutils
$ yum install devtoolset-2-gcc-c++ devtoolset-2-gcc-gfortran
@giwa
giwa / CentOS6-L2TP-IPsec.md
Created October 21, 2020 04:14 — forked from CLCL/CentOS6-L2TP-IPsec.md
L2TP/IPsec(AndroidやiPhoneからのVPN接続)を経路を用意すべくVPSにL2TP/IPsecサーバを設置するとき、ネットにある情報だとなかなかつながらないから、標準環境としてAWSのCentOS 6.3 x86_64 Release Media(ami-3fe8603e)の起動直後から最短距離で設定する方法をまとめた。

CentOS 6でとにかくL2TP/IPsecサーバ

  • AWSでEC2のインスタンスを借りる
  • 今回は東京リージョンのCentOS 6.3 x86_64 Release MediaのAIM(ami-3fe8603e)でインスタンスを建てる
  • Security Group: L2TP/IPsec(Inbound 22/TCP: SSH, 500/UDP: ISAKMP, 1701/UDP: L2TP, 4500/UDP: IPSec NAT Traversal)を許可
  • ec2-54-249-173-214.ap-northeast-1.compute.amazonaws.com(グローバルIPアドレス:54.249.173.214)にrootでログイン

SELinuxを無効にする

[root@ip-10-132-164-105 ~]# setenforce 0
@giwa
giwa / file0.txt
Last active March 27, 2020 11:31
Install hive on Mac with Homebrew ref: http://qiita.com/giwa/items/dabf0bb21ae242532423
$ brew update
$ brew install hive
@giwa
giwa / file0.txt
Last active July 25, 2018 13:36
トラフィックモニタリング with Kibana, ElasticSearch and Python ref: http://qiita.com/giwa/items/a24c722d8bc1b9a428cb
$ brew install elasticsearch
$ elasticsearch -v
Version: 1.4.4, Build: c88f77f/2015-02-19T13:05:36Z, JVM: 1.7.0_72
import json
import time
from itertools import islice
import requests
door_endpoint = 'http://localhost/api/v1/word_rank'
lcd_endpoint = 'http://192.168.1.2:5000/api/lcd'
import falcon
class CORSMiddleware:
def process_request(self, req, resp):
resp.set_header('Access-Control-Allow-Origin', '*')
class Todo:
def on_get(self, req, resp):
resp.status = falcon.HTTP_200
@giwa
giwa / client.c
Last active May 21, 2016 11:38
simple unix domain socket
#include <stdio.h>
#include <sys/socket.h>
#include <sys/un.h>
int main() {
int fd;
struct sockaddr_un addr;
int ret;
char buff[8192];
struct sockaddr_un from;
Which means if x = 10101001010100
^
|
|
|
First set bit from the end
>>> def compare(a, b):
... """Comparison that ignores the first letter"""
... return cmp(a[1:], b[1:])
>>> names = ['Adam', 'Donald', 'John']
>>> names.sort(cmp=compare)
>>> names
['Adam', 'John', 'Donald']
[
"abcdefgh",
"aefghijk",
"abcefgh"
]