Skip to content

Instantly share code, notes, and snippets.

@hnuzhoulin
hnuzhoulin / 0_reuse_code.js
Last active August 29, 2015 14:20
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@hnuzhoulin
hnuzhoulin / python_resources.md
Created May 10, 2015 05:40 — forked from jookyboi/python_resources.md
Python-related modules and guides.

Packages

  • lxml - Pythonic binding for the C libraries libxml2 and libxslt.
  • boto - Python interface to Amazon Web Services
  • Django - Django is a high-level Python Web framework that encourages rapid development and clean, pragmatic design.
  • Fabric - Library and command-line tool for streamlining the use of SSH for application deployment or systems administration task.
  • PyMongo - Tools for working with MongoDB, and is the recommended way to work with MongoDB from Python.
  • Celery - Task queue to distribute work across threads or machines.
  • pytz - pytz brings the Olson tz database into Python. This library allows accurate and cross platform timezone calculations using Python 2.4 or higher.

Guides

@hnuzhoulin
hnuzhoulin / sqlalchemy_engine.md
Last active August 29, 2015 14:21
使用sqlalchemy连接各类数据库时engine格式

通用格式

dialect+driver://username:password@host:port/database

Postgresql

The Postgresql dialect uses psycopg2 as the default DBAPI. pg8000 is also available as a pure-Python substitute;详情见

# default
    engine = create_engine('postgresql://scott:tiger@localhost/mydatabase')
# psycopg2
cluster:
head: "cbt"
clients: ["client1","client2","client3"]
osds: ["osd1","osd2","osd3"]
mons: ["mon1","mon2","mon3"]
osds_per_node: 1
fs: xfs
mkfs_opts: -f -i size=2048 -n size=64k
mount_opts: -o inode64,noatime,logbsize=256k
conf_file: /etc/ceph/ceph.conf
@hnuzhoulin
hnuzhoulin / cbt-failure.yaml
Created December 19, 2015 11:23
ceph,cbt test
cluster:
head: "cbt"
clients: ["client1","client2","client3"]
osds: ["osd1","osd2","osd3"]
mons: ["mon1","mon2","mon3"]
osds_per_node: 1
fs: xfs
mkfs_opts: -f -i size=2048 -n size=64k
mount_opts: -o inode64,noatime,logbsize=256k
conf_file: /etc/ceph/ceph.conf
@hnuzhoulin
hnuzhoulin / repair_pg_mismatch.sh
Created January 14, 2016 15:23
修复ceph pg repair都无法修复的pg不连续
#!/bin/bash
log=/root/ceph_yunwei/repair_pg_mismatch.log
pg=$1
filename=$2
disk_size=$3
meta_size=$4
size_hex_revert()
{
size_hex=`printf '%x\n' $1`
@hnuzhoulin
hnuzhoulin / osd.6.log
Created March 27, 2016 04:54
log when re-add osd using ceph-osd
2016-03-21 10:33:17.961553 7f0d0956c7c0 0 ceph version 0.80.7 (6c0127fcb58008793d3c8b62d925bc91963672a3), process ceph-osd, pid 4334
2016-03-21 10:33:17.963542 7f0d0956c7c0 1 filestore(/var/lib/ceph/osd/ceph-6) mkfs in /var/lib/ceph/osd/ceph-6
2016-03-21 10:33:17.963592 7f0d0956c7c0 -1 filestore(/var/lib/ceph/osd/ceph-6) mkfs on-disk fsid 509c0d73-9dc2-4983-92f5-097f940d19f3 != provided fd403120-f998-4c24-935a-6b475e4c24f4
2016-03-21 10:33:17.963728 7f0d0956c7c0 -1 OSD::mkfs: ObjectStore::mkfs failed with error -22
2016-03-21 10:33:17.963768 7f0d0956c7c0 -1 ESC[0;31m ** ERROR: error creating empty object store in /var/lib/ceph/osd/ceph-6: (22) Invalid argumentESC[0m
2016-03-21 10:33:44.093836 7fed3424a7c0 0 ceph version 0.80.7 (6c0127fcb58008793d3c8b62d925bc91963672a3), process ceph-osd, pid 4736
2016-03-21 10:33:44.095605 7fed3424a7c0 1 filestore(/var/lib/ceph/osd/ceph-6) mkfs in /var/lib/ceph/osd/ceph-6
2016-03-21 10:33:44.095632 7fed3424a7c0 1 filestore(/var/lib/ceph/osd/ceph-6) mkfs fsid is already s
@hnuzhoulin
hnuzhoulin / calc_pg_in_osd.py
Created April 12, 2016 05:13
calculate the the distribution of pg in OSD
#!/usr/bin/env python
import sys
import os
import json
cmd = '''
ceph pg dump | awk ' /^pg_stat/ { col=1; while($col!="up") {col++}; col++ } /^[0-9a-f]+\.[0-9a-f]+/ {print $1,$col}'
'''
body = os.popen(cmd).read()
SUM = {}
for line in body.split('\n'):
@hnuzhoulin
hnuzhoulin / multi_thread_parallel
Created November 7, 2016 02:42 — forked from anonymous/multi_thread_parallel
using python archive thread parallel
#!/usr/bin/env python
#coding: utf-8
import os
import sys
import logging
from threading import Thread
import Queue
@hnuzhoulin
hnuzhoulin / howto-remote-access-to-phpMyAdmin-on-bitnami.md
Created November 17, 2016 07:48 — forked from minazou67/howto-remote-access-to-phpMyAdmin-on-bitnami.md
How to remote access to phpMyAdmin on Bitnami Redmine Stack

How to remote access to phpMyAdmin on Bitnami Redmine Stack

Bitnami Redmine Stack の phpMyAdmin にリモート端末からアクセスする方法です。

Environment

  • Debian jessie
  • bitnami-redmine-3.1.0-0-linux-x64