Skip to content

Instantly share code, notes, and snippets.

View chansuke's full-sized avatar
🎯
Focusing

chansuke chansuke

🎯
Focusing
View GitHub Profile
@chansuke
chansuke / Dockerfile
Created January 22, 2017 06:11
for Go binary
FROM alpine
RUN apk add --no-cache ca-certificates
RUN mkdir /lib64 && ln -s /lib/libc.musl-x86_64.so.1 /lib64/ld-linux-x86-64.so.2
@chansuke
chansuke / .vimrc
Last active January 18, 2017 03:33
`set paste` 使わず Vimのインデントの挙動を制御
autocmd InsertLeave *
\ if &paste | set nopaste mouse=a | echo 'nopaste' | endif |
\ if &l:diff | diffupdate | endif
let &t_SI .= "\<Esc>[?2004h"
let &t_EI .= "\<Esc>[?2004l"
inoremap <special> <expr> <Esc>[200~ XTermPasteBegin()
function! XTermPasteBegin()
@chansuke
chansuke / xlsx_to_qr.py
Created January 11, 2017 13:01
エクセルの特定の列からQRコード生成
#! /usr/bin/env python
# -*- coding: utf-8 -*-
import hashlib
import json
import os
import xlrd
from codecs import open
from logging import getLogger, StreamHandler, DEBUG
@chansuke
chansuke / .gitlab-ci.yml
Created December 18, 2016 04:15
for Cordova + React + Redux on GitlabCI
image: node:latest
before_script:
- npm install -g cordova
- apt-get update
- apt-get install -y software-properties-common
- add-apt-repository ppa:openjdk-r/ppa
- echo deb http://http.debian.net/debian jessie-backports main >> /etc/apt/sources.list
- apt-get update && apt-get install -y openjdk-8-jdk
- wget http://dl.google.com/android/android-sdk_r24.2-linux.tgz
- tar -xvf android-sdk_r24.2-linux.tgz
@chansuke
chansuke / Capfile
Last active May 15, 2022 16:53
Capistrano deploy setting(via bastion)
# AWS SDK
require 'aws-sdk'
Aws::EC2::Resource
# Load DSL and set up stages
require "capistrano/setup"
# Include default deployment tasks
require "capistrano/deploy"
require 'capistrano/safe_deploy_to'
@chansuke
chansuke / appbase
Last active November 17, 2016 05:47
Railsアプリケーションの土台となるDockerfileサンプル
FROM ruby:2.3.1-slim
MAINTAINER Yusuke Abe <abe@mamorio.jp>
ENV ENTRYKIT_VERSION 0.4.0
RUN sed -i "s/httpredir.debian.org/`curl -s -D - http://httpredir.debian.org/demo/debian/ | awk '/^Link:/ { print $2 }' | sed -e 's@<http://\(.*\)/debian/>;@\1@g'`/" /etc/apt/sources.list
RUN apt-get clean && apt-get update \
&& apt-get install -y --no-install-recommends apt-utils \
file \
git \
nodejs \
@chansuke
chansuke / create_vpc_stack.json
Last active November 29, 2016 07:56
Create VPC for Rails in Production real quick.
{
"AWSTemplateFormatVersion" : "2010-09-09",
"Description" : "Create AWS CloudFormation Customize Virtual Private Cloud",
"Parameters" : {
"VpcName": {
"Description" : "Please input VPC name.",
"Type": "String",
"Default" : "mamorio-vpc",
"AllowedPattern" : "[-a-zA-Z0-9]*",
"ConstraintDescription" : ""
@chansuke
chansuke / s3-cf-invalidation.js
Last active October 20, 2016 03:27
Update S3 and automatically run invalidation in Cloudfront
if (event.Records[0].EventSource == "aws:sns")
{
if(event.Records[0].Sns.Subject == "Amazon S3 Notification")
{ // overwrite S3 event object from payload
event=JSON.parse(event.Records[0].Sns.Message);
}
}
console.log('Loading event');
@chansuke
chansuke / tcpclient.py
Created April 25, 2016 15:19
tcpで値を送るメソッド
#coding:utf-8
#!/usr/bin/env python
import socket
import time
def tcp_send(ip, port, msg):
BUFFER_SIZE = 4096
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((ip, int(port)))
while True: