Skip to content

Instantly share code, notes, and snippets.

View wozozo's full-sized avatar
😇
Hello

Yoichi Fujimoto wozozo

😇
Hello
  • Tokyo, Japan
  • 13:41 (UTC +09:00)
  • X @wozozo
View GitHub Profile
@juno
juno / gist:1497194
Created December 19, 2011 13:18
EC2 RunInstances API returns InsufficientInstanceCapacity
$ ec2-run-instances --region us-east-1 \
  --availability-zone us-east-1a \
  --group default \
  --key foo \
  --instance-type t1.micro \
  ami-XXXXXXXX

Server.InsufficientInstanceCapacity: We currently do not have sufficient t1.micro capacity in the Availability Zone you requested (us-east-1a). Our system will be working on provisioning additional capacity. You can currently get t1.micro capacity by not specifying an Availability Zone in your request or choosing us-east-1d, us-east-1b.

@podhmo
podhmo / gist:1504506
Created December 21, 2011 04:00
flatten
def flatten(xs):
for x in xs:
if hasattr(x, "__iter__"):
yield from flatten(x)
else:
yield x
function declitimg(img) {
var cv = document.createElement('canvas');
cv.width = img.width;
cv.height = img.height;
var ctx = cv.getContext('2d');
ctx.drawImage(img, 0, 0);
var imd = ctx.getImageData(0, 0, img.width, img.height);
var s = '';
for (var i = 0; i < imd.data.length && imd.data[i] !== 0;) {
var c1 = imd.data[i++];
@riywo
riywo / os_type
Created January 7, 2012 04:52
OSのタイプをなんとなく出力
#!/bin/sh
if [ $OSTYPE = "linux-gnu" ]; then
LSB_ID=`lsb_release -i | cut -f2 -d:`
LSB_VERSION=`lsb_release -r | cut -f2 -d:`
OS_VERSION=`echo $LSB_ID-$LSB_VERSION | sed -e "s/ //g"`
MACHINE_TYPE=`uname -m`
echo $OS_VERSION-$MACHINE_TYPE
else
echo `uname -rsm | sed -e "s/ /-/g"`
fi
import urlparse
import lxml.html as html
import sys
import json
BLOG_URL = 'http://torufurukawa.blogspot.jp/'
def fetch(url):
print >>sys.stderr, 'fetcing %s...' % url
retry_count = 0
javascript:(function(d,r,i,n){n=d.createElement('div');n.setAttribute('style','position:fixed;width:100%;height:100%;left:0;top:0;opacity:.5;background:#000;z-index:9999');d.body.appendChild(n);n=d.createElement('div');n.setAttribute('style','position:fixed;left:50%;top:50%;width:10ex;height:1.2em;margin:-.5em 0 .5em -5ex;background:#fff;z-index:10000');d.body.appendChild(n);setInterval(function(){n.innerHTML=r[i=(i+1)%r.length];},100);})(document,["(´・ω・`)", "(・ω・` )", "(ω・` )", "(・` )", "(` )", "( )", "( ´)", "( ´・)", "( ´・ω)", "( ´・ω・)"],0);
@hail2u
hail2u / test.scss
Last active October 6, 2015 07:28
レスポンシブフォwww
@mixin optimize-font-size($sizes) {
@each $r in $sizes {
$w: $safe-for-full * $r * $r;
@media (min-width: $w) {
font-size: percentage($r);
}
}
}
@hail2u
hail2u / cf-email-croaking.html
Created June 20, 2012 09:11
CloudFlareのメールアドレスクローキング
<p>
<a href="http://cloudflare.com/email-protection.html#bcd7c5d3fcd4ddd5d08ec992d2d9c8">
<span id="__cf_email__" class="4c2735230c242d25207e3962222938">
[email&nbsp;protected]
</span>
<script type="text/javascript">
/* <![CDATA[ */
(function () {
try {
var s, a, i, j, r, c, l = document.getElementById("__cf_email__");
class Accessor(object):
def __init__(self, wrapper, d):
self.wrapper = wrapper
self.d = d
def __repr__(self):
return repr(self.d)
def _get_failback(self, k):
chained = self.wrapper.chained
@hitode909
hitode909 / access_log.webtailrc.js
Created October 31, 2012 10:13
webtailでアクセスログ聞くやつ
if (!context.setup) {
context.setup = true;
var app = {
counts: {
GET: 0,
POST: 0,
},
$log: $('<pre>').appendTo($(document.body)),
urls: [],