Skip to content

Instantly share code, notes, and snippets.

View feisuzhu's full-sized avatar

Proton feisuzhu

View GitHub Profile
@feisuzhu
feisuzhu / k8s.py
Created November 21, 2019 11:02
k8s py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# -- stdlib --
import json
import os
# -- third party --
import requests
@feisuzhu
feisuzhu / check.py
Created September 29, 2019 07:39
JSON check
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function, unicode_literals
# -- stdlib --
import types
import re
import arrow
# -- third party --
# -- own --
@feisuzhu
feisuzhu / revive-rook.md
Last active July 31, 2019 15:26
Revive a rook cluster

What this manual trying to resolve

  1. You had a running rook/ceph cluster, suddenly your Kubernetes environment exploded, you have to start a new Kubernetes environment and put your existing rook/ceph cluster back.
  2. You are migrating your existing rook/ceph cluster to a new Kubernetes environment, downtime can be tolerated.

In author's situation, etcd data of running Kubernetes cluster is nuked and have no backup, all OSDs are using bluestore backend.

Prerequisites

  1. A working Kubernetes cluster without rook
@feisuzhu
feisuzhu / BatchList.py
Last active February 28, 2019 16:10
batch list
T = TypeVar('T')
class BatchList(List[T]):
__slots__ = ()
def __getattribute__(self, name):
try:
list_attr = list.__getattribute__(self, name)
return list_attr
@feisuzhu
feisuzhu / list-soundcard.py
Last active September 4, 2017 13:11
netmeter
# coding: utf-8
import pyaudio
pa = pyaudio.PyAudio()
for i in range(pa.get_device_count()):
dev = pa.get_device_info_by_index(i)
print '%s: %s' % (dev['index'], dev['name'])
@feisuzhu
feisuzhu / thb-phys-rules.md
Last active November 4, 2016 16:55
说明书

目录

[TOC]

背景

幻想乡又发生了一场新的异变。 说是异变也不完全准确,倒不如说,似乎又是“某人”因为闲着无聊而发起的无伤大雅的玩笑呢。 希望快点解决异变然后回家喝茶的,莫名其妙被卷入或是兴致勃勃站在“某人”一方的,乃至别有用心想要大闹一番的——当这些少女汇集在一起的时候,一场华丽的弹幕战,即将开幕!

Parse -> LeanCloud 文件迁移工具

注意:这个工具是用来导入到中国区节点的

依赖: gevent、requests

Ubuntu 可以 # apt-get install python-gevent python-requests

@feisuzhu
feisuzhu / cv.md
Created September 21, 2015 14:24
cv
百鬼夜行:
    “这是什么鬼?!”
射命丸文:
    疾走:出牌阶段,你可弃置一张牌;若你如此做,你亮出牌堆顶的一张牌,并选择:1.立刻使用之,然后重复此流程。2.获得此牌,并结束此回合。
        “太慢了!”(发动技能时)
 “今天就姑且点到为止”(结束回合时)
@feisuzhu
feisuzhu / marathon-upstreams
Last active August 29, 2015 14:23
marathon-upstreams
#!/usr/bin/python
# -- stdlib --
import argparse
import json
import urllib2
# -- third party --
# -- own --
# -- code --
@feisuzhu
feisuzhu / cast-mac.sh
Last active August 29, 2015 14:16
screencast
#!/bin/bash
if [ "$1" == "" ]; then
ffmpeg -f avfoundation -list_devices true -i ""
echo Choose input device!
exit 1
fi
FILENAME=$(date '+%Y-%m-%d-%H-%M')
ffmpeg -f avfoundation -i 1 -r 1 -vcodec libx264 $FILENAME-slow.mkv