This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
######################################################################## | |
# A library for calling callables with runtime-defined parameters. | |
# | |
# Copyright 2005-2011 True Blade Systems, Inc. | |
# | |
# Licensed under the Apache License, Version 2.0 (the "License"); | |
# you may not use this file except in compliance with the License. | |
# You may obtain a copy of the License at | |
# | |
# http://www.apache.org/licenses/LICENSE-2.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#wait for internet connection up to 15 seconds | |
host=baidu.com | |
CONNECTED=$(ping -w5 -c1 $host > /dev/null 2>&1 && echo "up" || echo "down") | |
STOPWATCH=0 | |
while [ "$CONNECTED" = "down" ] && [ $STOPWATCH -lt 15 ]; do | |
sleep 1; | |
CONNECTED=$(ping -w5 -c1 $host > /dev/null 2>&1 && echo "up" || echo "down") | |
let STOPWATCH++ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
window.onload = function () { | |
if (window.FileReader) { | |
var input = document.getElementById("file"); | |
var result = document.getElementById("result"); | |
var canvas = document.getElementById("canvas"); | |
var context = canvas.getContext("2d"); | |
var img = document.getElementById("img"); | |
var width = 100; | |
canvas.width = width; | |
input.onchange = function () { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# encoding=utf-8 | |
import sys | |
from PIL import Image | |
# char_map = ['#', '@', 'v', '"', '_', '.', ' '] | |
char_map = ['#', '#', '#', '_', '.', '.', ' '] | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; Copyright ?Microsoft Corp. | |
[Theme] | |
; Windows 7 - IDS_THEME_DISPLAYNAME_AERO | |
DisplayName=Bing Dynamic | |
; Computer - SHIDI_SERVER | |
[CLSID\{20D04FE0-3AEA-1069-A2D8-08002B30309D}\DefaultIcon] | |
DefaultValue=%SystemRoot%\System32\imageres.dll,-109 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
document.addEventListener('touchmove', function (e) { | |
e.preventDefault() | |
}) | |
var c = document.getElementsByTagName('canvas')[0], | |
x = c.getContext('2d'), | |
pr = window.devicePixelRatio || 1, | |
w = window.innerWidth, | |
h = window.innerHeight, | |
f = 90, | |
q, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
from tornado.ioloop import IOLoop | |
from tornado.httpclient import AsyncHTTPClient | |
io_loop = IOLoop.instance() | |
def handle_resp(resp): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import sys | |
BASE_PATH = os.path.dirname(__file__) | |
from django.conf import settings | |
from django.conf.urls import patterns, url | |
from django.core.management import execute_from_command_line | |
from django.shortcuts import render | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
>>> def foo(): | |
... a = 1 | |
... def foo_a(): | |
... a = 2 | |
... print 'foo_a a:', a | |
... foo_a() | |
... print 'foo a:', a | |
... | |
>>> foo() | |
foo_a a: 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# | |
# redis - this script starts and stops the redis-server daemon | |
# | |
# chkconfig: - 85 15 | |
# description: Redis is a persistent key-value database | |
# processname: redis-server | |
# config: /etc/redis/redis.conf | |
# config: /etc/sysconfig/redis | |
# pidfile: /var/run/redis.pid |
OlderNewer