Skip to content

Instantly share code, notes, and snippets.

View ento's full-sized avatar

ento

View GitHub Profile
@ento
ento / print_addressbook_members.py
Last active September 30, 2017 17:38
Print some properties of members of your Mac AddressBook.
# -*- coding: utf-8 -*-
'''
Print some properties of members of your Mac AddressBook.
https://developer.apple.com/library/mac/documentation/userexperience/Reference/AddressBook/Miscellaneous/AddressBook_Constants/Reference/reference.html#//apple_ref/doc/uid/TP40003952-CH3g-SW6
$ pip install -U pyobjc-core
$ pip install -U pyobjc
'''
from collections import OrderedDict
from Foundation import NSDate, NSDateFormatter
#!/bin/bash -e
# These need to be set.
#export EC2_HOME="/path/to/ec2-api-tools"
#export AWS_ACCESS_KEY='XXXXXXXXXXXXXXXXXXXX'
#export AWS_SECRET_KEY='XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
#export PATH="$PATH:${EC2_HOME}/bin"
ami_id='ami-123abc12'
availability_zone='eu-west-1a'
keypair="[email protected]"
@ento
ento / gist:6375397
Created August 29, 2013 08:04
Iterate through logs captured by nosetest's logcapture plugin
import logging
from nose.plugins import logcapture
def iter_captured_logs(pluck=None):
handler = get_nose_log_handler()
# need to call `format` in order to let it compose the `message` attr for us
format = handler.format
for r in handler.buffer:
format(r)
@ento
ento / index.html
Last active July 25, 2016 00:40
Userstyle bookmarklet maker
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="./style.css"/>
<link href="//netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css" rel="stylesheet">
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/underscore.js/1.5.1/underscore-min.js"></script>
</head>
<body>
<div class="form-group">
# -*- coding: utf-8 -*-
import threading
from nose.tools import eq_
import celery
from celery._state import _get_current_app
eq_('3.0.22', celery.__version__)
eq_('default', _get_current_app().main)
@ento
ento / test
Created June 27, 2013 12:15
clone & push test
initial version
@ento
ento / macosx_voices_demo.py
Created May 21, 2013 14:07
Mac OS X: Ask every voice found by `say -v "?"` to say the demo text. Note that `say` only returns voices for your system language.
# -*- coding: utf-8 -*-
"""
Ask every voice found by `say -v "?"` to say the demo text.
Note that `say` only returns voices for your system language.
"""
import time
from subprocess import Popen, PIPE
def say(voice, text):
@ento
ento / gist:5234873
Last active December 15, 2015 08:59 — forked from drawks/gist:1556276
Enable _source compression in elasticsearch
curl -XPUT 'http://localhost:9200/_template/template_logstash/' -d '
{
"template": "logstash-*",
"mappings": {
"_default_": {
"_source": { "compress": "true" }
}
}
}'
#!/usr/bin/env python
"""pre-commit-pep8.py
requirements
- pep8==1.3.3
in .git/hooks/pre-commit
#!/bin/sh
./path/to/this/script/in/your/repo/pre-commit-pep8.py
@ento
ento / 0 chakoshi settings.md
Created November 16, 2012 12:28
「見覚える」を茶漉で検索

茶漉

コーパス指定

  • 青空文庫(小説集)
  • 名大会話コーパス

検索パターン設定

スパン: