Skip to content

Instantly share code, notes, and snippets.

View jeffrey4l's full-sized avatar
🎯
Focusing

Jeffrey Zhang jeffrey4l

🎯
Focusing
View GitHub Profile
@jeffrey4l
jeffrey4l / grub.cfg
Created May 31, 2018 16:41 — forked from Pysis868/grub.cfg
My own configuration file for GRUB2 to boot various live distributions of Linux-based operating systems, along with some system tools. I tried to include a lot of sample configuration entries, even if I don't currently use them, so it may help others. Exceedingly long blog post: http://tehfishyblog.logdown.com/chips/306146-a-homemade-ultimate-bo…
# Config for GNU GRand Unified Bootloader (GRUB) (2)
# /boot/grub/grub.cfg
# or
# /boot/grub2/grub.cfg
# This grub.cfg file was created by Lance http://www.pendrivelinux.com
# Suggested Entries and the suggestor, if available, will also be noted.
# and then improved by Pysis.

ksm memcache pool have some issue when enabled memcache_use_advanced_pool

[keystone_authtoken]
memcache_use_advanced_pool = true

This patch is used for OpenStack Ocata branches

How to use:

docker ps -q | xargs -i ./aplly_patch.sh {} keystonemiddleware.patch

@jeffrey4l
jeffrey4l / globals.yml
Created February 23, 2017 05:54
kolla+ceph+keystone+ceph_rgw
---
# You can use this file to override _any_ variable throughout Kolla.
# Additional options can be found in the 'kolla/ansible/group_vars/all.yml' file.
# Default value of all the commented parameters are shown here, To override
# the default value uncomment the parameter and change its value.
###################
# Kolla options
###################
# Valid options are [ COPY_ONCE, COPY_ALWAYS ]
class OverrideConfigParser(configparser.RawConfigParser):
def _read(self, fp, fpname):
"""Parse a sectioned setup file.
The sections in setup file contains a title line at the top,
indicated by a name in square brackets (`[]'), plus key/value
options lines, indicated by `name: value' format lines.
Continuations are represented by an embedded newline then
leading whitespace. Blank lines, lines beginning with a '#',
#!/bin/bash
ME=$(basename $0)
function ask {
read -p "Are you sure? [Y/n]" -n 1 -r
if [[ -z $REPLY ]] || [[ $REPLY =~ ^[Yy]$ ]]; then
echo "You sure."
else
exit 2
@jeffrey4l
jeffrey4l / interrupt_pool.py
Created November 17, 2015 07:11
Interrupt the Python multiprocessing.Pool in graceful way
import multiprocessing
from multiprocessing import Pool
import time
import signal
def worker():
while True:
print time.time()
time.sleep(.5)
@jeffrey4l
jeffrey4l / version_method.py
Last active August 29, 2015 14:21
Python Magic MetaClass
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):
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.
@jeffrey4l
jeffrey4l / python_in_perf.py
Created December 25, 2014 02:49
python_in_perf.py
import random
import timeit
S1 = set(range(100))
S2 = range(100)
S3 = tuple(range(100))
print type(S1), type(S2), type(S3)
def test1():
@jeffrey4l
jeffrey4l / bdfilm.js
Created October 20, 2014 13:25
Better BDFilm
// ==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==