Skip to content

Instantly share code, notes, and snippets.

View attakei's full-sized avatar

Kazuya Takei attakei

View GitHub Profile
@attakei
attakei / ipaddr.py
Created December 8, 2014 02:29
diff to pyramid_debugtoolbar/ipaddr.py (use localhost as 127.0.0.1)
73c73,74
<
---
> if address == 'localhost':
> address = '127.0.0.1'
@attakei
attakei / pserve.py
Last active August 29, 2015 14:22
Ansible module to run pserve command.

Andible simple module to pserve command controll

How to setup

Save pserve.py to library/pserve.py

The library folder needs to be on the same level as your playbook.

@attakei
attakei / valuedomain_ddns.py
Created December 13, 2012 16:03
value-domain.com向けのDDNSクライアント(やっつけ感満載) サインインし忘れて張ってしまった、https://gist.github.com/4277425 の貼り直し
#!/usr/bin/env python
import urllib
import urllib2
import re
DDNS_HTTP_URL = 'http://dyn.value-domain.com/cgi-bin/dyn.fcg'
TARGET_BASE_PARAM = {
'd':'example.com',
'p':'password',
@attakei
attakei / main.py
Last active October 30, 2015 14:12
Capture HTML5 slides by Ghost.py
from ghost import Ghost
ghost = Ghost()
session = ghost.start()
session.set_viewport_size(1135, 740)
session.open('http://io-2012-slides.googlecode.com/git/template.html')
session.evaluate('for (var idx = slidedeck.curSlide_; idx > 0; idx--) { slidedeck.prevSlide();}')
session.sleep(1)
@attakei
attakei / README.md
Last active December 25, 2015 05:31
Get gitignore from github/gitignore

Fetch and merge gitignore from Github

It is tool to fetch gitignore contents from https://github.com/github/gitignore, merge fetched contents and generate local .gitignore file.

Usage

example)

$ curl https://gist.githubusercontent.com/attakei/98eb484cf013afd0d1ba/raw/f98b7ef8d87732363d2ccdb76ec9ef35151163d2/get_gitignore.py &gt; get_gitignore
@attakei
attakei / tododemo.plug
Last active September 18, 2016 02:10
todo_demo
[Core]
Name = tododemo
Module = tododemo
[Python]
Version = 2+
[Documentation]
Description = Todo Demo
@attakei
attakei / once.py
Created October 25, 2016 14:10
Only once response HTTP server
#!/usr/bin/env python
from http.server import HTTPServer, SimpleHTTPRequestHandler
import signal
import sys
import os
class OnceHttpServer(HTTPServer):
def shutdown_by_signal(self, sig_num, frame):
self.server_close()
@attakei
attakei / kachidoki_elevator.cc
Created January 25, 2017 09:24 — forked from remore/kachidoki_elevator.cc
(1: 最適化問題) 下記パラメータのままでElevator::tick()のみを最適化して平均待ち人数を最小化する / (2: 並列化問題) 以下のプログラムをマルチスレッドで動作させると何倍早くなるか実装して検証する / (3: チューニング問題)並列化以外の方法で本プログラムの実行時間を短縮するためにどのような改修を加えるとよいか考察する
#include <iostream>
#include <iomanip>
#include <random>
#include <unistd.h>
using namespace std;
const int MAX_FLOOR = 14;
const int ELEVATOR_COUNT = 4;
const int RAISING_PROBABILITY = 10;
import fire
class Calcurator(object):
def add(self, first, second):
return int(first) + int(second)
if __name__ == '__main__':
fire.Fire(Calcurator)
@attakei
attakei / SDLUIKitDelegate+KivyAppDelegate.h
Last active May 27, 2017 23:30
To add CrashlyticsKit for Objective-C sources created by Kivy-ios(bulldozer).
//
// SDLUIKitDelegate+KivyAppDelegate.h
//
// Created by attakei on 2014/11/05.
//
//
// modify for your SDL header's path.
#import "../src/SDL/src/video/uikit/SDL_uikitappdelegate.h"