Skip to content

Instantly share code, notes, and snippets.

@hnuzhoulin
hnuzhoulin / AllResolutions.ps1
Created May 25, 2017 08:01 — forked from mintsoft/AllResolutions.ps1
Powershell for getting all resolutions from all monitors
$pinvokeCode = @"
using System;
using System.Runtime.InteropServices;
using System.Collections.Generic;
namespace Resolution
{
[StructLayout(LayoutKind.Sequential)]
public struct DEVMODE1
{
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 32)]
@hnuzhoulin
hnuzhoulin / crush_data_movement_calculator.py
Created February 15, 2017 00:45 — forked from alram/crush_data_movement_calculator.py
Calculate how much data will move before applying a CRUSHmap change
#!/usr/bin/env python
import ast
import json
import os
import subprocess
import argparse
import sys
FNULL = open(os.devnull, 'w')
@hnuzhoulin
hnuzhoulin / NtfsPermission.cs
Last active December 1, 2016 10:49
setting NTFS folder permission
using System;
using System.Collections;
using System.IO;
using System.Security.AccessControl;
static class Tester
{
public static void Main()
{
try
{
@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
@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 / 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 / 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 / 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 / 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
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