Skip to content

Instantly share code, notes, and snippets.

@curious-eyes
curious-eyes / urllib2_options.py
Created June 30, 2013 00:20
urllib2 sample sending OPTIONS method.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import urllib2
opener = urllib2.build_opener(urllib2.HTTPHandler)
request = urllib2.Request('http://example.com', data='your_put_data')
request.add_header('Content-Type', 'your/contenttype')
request.get_method = lambda: 'OPTIONS'
url = opener.open(request)
@curious-eyes
curious-eyes / file0.txt
Last active September 14, 2015 09:28
AnsibleでGCEインスタンスを管理する ref: http://qiita.com/curious-eyes/items/c7feb3edbeb7c7c640e6
$ pip install apache-libcloud
$ cd ~/gce_ansible
$ ./play.sh master.yml
PLAY [Create new GCE instances] ******************
...(略)...
TASK: [Create LoadBalancer] **********************
changed: [127.0.0.1] => {"changed": true, "external_ip": "107.167.187.229", ...
PLAY RECAP ***************************************
@curious-eyes
curious-eyes / file0.txt
Created September 21, 2015 03:41
Golang で iso-2022-jp メールのデコード ref: http://qiita.com/curious-eyes/items/3dae99e5e0feb6b9f642
$ go get github.com/curious-eyes/jmail
@curious-eyes
curious-eyes / packages.json
Last active May 10, 2016 09:24
zend-expressive-skeletonをGoogleAppEngine/PHP向けにカスタマイズ ref: http://qiita.com/curious-eyes/items/fbc11e709f2121cc215e
{
"packages": {
"zendframework/zend-expressive-skeleton": {
"dev-for-google-app-engine": {
"name": "zendframework/zend-expressive-skeleton",
"type": "project",
"version": "dev-for-google-app-engine",
"source": {
"url": "https://github.com/curious-eyes/zend-expressive-skeleton.git",
"type": "git",
@curious-eyes
curious-eyes / tkinter.py
Created January 13, 2019 01:33
Tkinter: 画像キャンバス更新にはGlobal変数が必要
"""
Tkinter サンプル
"""
import tkinter
from datetime import datetime
from PIL import ImageTk
def get_imagename():
""" ファイル名生成 """
""" tkinter.Frame 継承
"""
import tkinter as tk
from PIL import ImageTk
class Application(tk.Frame):
""" メイン
同ディレクトリに cat01.png , cat02.png を配置する必要があります
$ pip install Pillow
も必要です
def greeting(who):
print('Hello, ' + who)
def greetings(group):
for who in group:
print('Hello, ' + who)
if __name__ == '__main__':
me = 'Python'
greeting(me)
@curious-eyes
curious-eyes / InstallDockerCompose.sh
Created July 15, 2019 11:34
Debian / Ubuntu に Docker & Docker Compose をインストールする手順
# Install Docker ( "debian" 部分は Ubuntu の場合 "ubuntu" 置換する必要あり )
sudo apt-get update
sudo apt-get -yy install apt-transport-https ca-certificates curl software-properties-common wget pwgen
curl -fsSL https://download.docker.com/linux/debian/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/debian $(lsb_release -cs) stable"
sudo apt-get update && sudo apt-get -y install docker-ce
# Install Docker Compose
sudo curl -L https://github.com/docker/compose/releases/download/1.22.0/docker-compose-$(uname -s)-$(uname -m) -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
@curious-eyes
curious-eyes / readyToInstallPgzero.sh
Created July 15, 2019 14:00
Raspbian に pgzero(pygame) をインストールして実行する前に、必要なライブラリをインストールする
sudo apt-get install libsdl-dev libsdl-image1.2-dev libsdl-mixer1.2-dev libsdl-ttf2.0-dev
sudo apt-get install libsmpeg-dev libportmidi-dev libavformat-dev libswscale-dev
sudo apt-get install libatlas-base-dev