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 | |
TEMP=`cat /sys/class/thermal/thermal_zone0/temp` | |
TEMP="${TEMP:0:2}.${TEMP:2}" | |
UPLOAD1=`awk '{print $1}' /proc/loadavg` | |
UPLOAD5=`awk '{print $2}' /proc/loadavg` | |
UPLOAD15=`awk '{print $3}' /proc/loadavg` | |
UPTIME=`awk '{print $1/3600}' /proc/uptime | awk -F "." '{print $1"."substr($2,1,2)}'` | |
TMP_FILE="/tmp/cosm.json" |
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 -*- | |
#Author: Lei Zhang <[email protected]> | |
import sys | |
import os | |
import signal | |
import argparse | |
from math import floor | |
from shutil import copyfile, rmtree |
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
// ==UserScript== | |
// @name Yooli Enhance | |
// @namespace http://xcodest.me/ | |
// @version 0.2 | |
// @description Yooli Enhance | |
// @match http://www.yooli.com/* | |
// @match https://www.yooli.com/* | |
// @require http://www.yooli.com/v2/local/js/common/jquery-1.8.3.min.js | |
// @updateURL https://gist.github.com/jeffrey4l/6162185/raw/de803a96bca9988cb10e2e9bef3b395c5cf55bdb/Yooli_Enhance.js | |
// @copyright 2012+, You |
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
# Add following line to the local_settings.py file to order the flavor | |
def flavor_sort_key(flavor): | |
order_prefix = { | |
'micro': '1', | |
'standard': '2', | |
'compute': '3', | |
'memory': '4', | |
} | |
name = flavor.name |
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 | |
# | |
# This configuration is copy from ustack.com | |
DEFAULT_ROOT_GB=40 | |
nova-manage flavor create --name micro-1 --cpu 1 --memory 512 --root_gb $DEFAULT_ROOT_GB --is_public True | |
nova-manage flavor create --name micro-2 --cpu 1 --memory 1024 --root_gb $DEFAULT_ROOT_GB --is_public True | |
nova-manage flavor create --name standard-1 --cpu 1 --memory 2048 --root_gb $DEFAULT_ROOT_GB --is_public True |
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
// ==UserScript== | |
// @name BD File Remover | |
// @namespace http://your.homepage/ | |
// @version 0.1 | |
// @description enter something useful | |
// @author You | |
// @match http://bdfilm.lofter.com/ | |
// @grant none | |
// ==/UserScript== |
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 random | |
import timeit | |
S1 = set(range(100)) | |
S2 = range(100) | |
S3 = tuple(range(100)) | |
print type(S1), type(S2), type(S3) | |
def test1(): |
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
diff --git a/horizon/tables/base.py b/horizon/tables/base.py | |
index adc284c..1337989 100644 | |
--- a/horizon/tables/base.py | |
+++ b/horizon/tables/base.py | |
@@ -1031,6 +1031,16 @@ class DataTable(object): | |
""" | |
return self.request.get_full_path().partition('?')[0] | |
+ def get_full_url(self): | |
+ """Returns the full URL path for this table. |
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
VERION_METHODS='version_methods' | |
class VersionMethod(object): | |
def __init__(self, version, func): | |
self.version = version | |
self.func = func | |
class MetaClass(type): | |
def __new__(cls, name, bases, cls_dict): |
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 multiprocessing | |
from multiprocessing import Pool | |
import time | |
import signal | |
def worker(): | |
while True: | |
print time.time() | |
time.sleep(.5) |
OlderNewer