Skip to content

Instantly share code, notes, and snippets.

@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 / 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 / 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 / seamake.sh
Created June 6, 2017 06:50 — forked from theclanks/seamake.sh
seafile client build
#!/usr/bin/env bash
yum install vala vala-compat wget gcc libevent-devel openssl-devel gtk2-devel libuuid-devel sqlite-devel jansson-devel intltool cmake qt-devel fuse-devel
echo "Building and installing seafile client"
export version=4.2.8 # change this to your preferred version
alias wget='wget --content-disposition -nc'
wget https://github.com/haiwen/libsearpc/archive/v3.0.2.tar.gz
wget https://github.com/haiwen/ccnet/archive/v${version}.tar.gz
@hnuzhoulin
hnuzhoulin / seafile-backup.sh
Created June 6, 2017 07:39 — forked from 3c7/seafile-backup.sh
Seafile backup script
#!/bin/bash
###############################
# Seafile server backup script (cold sqlite backup)
# Author: Nils Kuhnert
# Last change: 2014-07-27
# Website: 3c7.me
###############################
# Variables
DATE=`date +%F`
@hnuzhoulin
hnuzhoulin / ChineseDate2Datetime.py
Created October 12, 2017 02:42
change chinese date string to datetime object
import re
import datetime
UTIL_CN_NUM = {
u'零': 0,
u'一': 1,
u'二': 2,
u'两': 2,
u'三': 3,
u'四': 4,
#!/usr/bin/env python3
# -*- coding:utf-8 -*-
__author__ = 'Nisests'
import requests
from bs4 import BeautifulSoup
login_url = 'https://www.packtpub.com/'
accout_url = 'https://www.packtpub.com/account'
@hnuzhoulin
hnuzhoulin / pg_subfolder_splitting.sh
Last active May 29, 2018 12:09 — forked from drakonstein/pg_subfolder_splitting.sh
Split Ceph Filestore OSDs offline
#!/bin/bash
merge_num=-2
split_num=16
while [[ "$(ceph health)" != "HEALTH_OK" ]]; do
sleep 10
done
# Some method to set your ceph.conf file to the subfolder splitting settings you want.

To install tcptraceroute on Debian/Ubuntu:

$ sudo apt-get install tcptraceroute

To install tcptraceroute on CentOS/REHL, first set up RepoForge on your system, and then:

$ sudo yum install tcptraceroute
@hnuzhoulin
hnuzhoulin / polipo_set_up.md
Created November 8, 2018 03:08 — forked from yangwe1/polipo_set_up.md
my polipo conf file

openwrt,用于缓存服务器 其web控制界面位于http://192.168.1.1:8123/polipo/

# polipo daemon configuration
config 'polipo' 'daemon'
	# daemonise polipo (fork in background)
	option 'daemonise' '1'
	# where polipo will store its process pid
	option 'pidFile' '/var/run/polipo.pid'