Skip to content

Instantly share code, notes, and snippets.

View fanyang89's full-sized avatar
🥥

fanyang fanyang89

🥥
  • SmartX
  • 16:50 (UTC +08:00)
View GitHub Profile
import nltk
import ssl
try:
_create_unverified_https_context = ssl._create_unverified_context
except AttributeError:
pass
else:
ssl._create_default_https_context = _create_unverified_https_context
@fanyang89
fanyang89 / rocky-mirror.py
Created February 28, 2022 08:51
rocky-mirror.py
#!/usr/bin/env python3
import glob
import os
try:
import in_place
except ImportError:
print("Trying to Install required module: in-place")
os.system('python3 -m pip install in-place')
@fanyang89
fanyang89 / zookeeper-log-filter.py
Last active March 18, 2024 02:12
ZooKeeper log filter
import glob
import in_place
def main():
log_paths = glob.glob("**/zookeeper*log*", recursive=True)
for path in log_paths:
print(f"processing log file {path}")
with in_place.InPlace(path) as fp:
for line in fp:
@fanyang89
fanyang89 / node-disk-manager-lvm.yaml
Created December 10, 2020 09:23
Node Disk Manager Config that uses LVM only
apiVersion: v1
kind: ConfigMap
metadata:
namespace: iomesh-system
name: node-disk-manager-config
data:
node-disk-manager.config: |
probeconfigs:
- key: udev-probe
name: udev probe
@fanyang89
fanyang89 / gentoolf.zsh-theme
Created November 27, 2020 06:58
ohmyzsh theme gentoo with LF prompt
function prompt_char {
if [ $UID -eq 0 ]; then echo "\n#"; else echo "\n$"; fi
}
PROMPT='%(!.%{$fg_bold[red]%}.%{$fg_bold[green]%}%n@)%m %{$fg_bold[blue]%}%(!.%1~.%~) $(git_prompt_info)$(prompt_char)%{$reset_color%} '
ZSH_THEME_GIT_PROMPT_PREFIX="("
ZSH_THEME_GIT_PROMPT_SUFFIX=") "
@fanyang89
fanyang89 / profiles.json
Created March 23, 2020 06:09
Windows Terminal Setting
// To view the default settings, hold "alt" while clicking on the "Settings" button.
// For documentation on these settings, see: https://aka.ms/terminal-documentation
{
"$schema": "https://aka.ms/terminal-profiles-schema",
"defaultProfile": "{574e775e-4f2a-5b96-ac1e-a2962a402336}",
"profiles": {
"defaults": {
@fanyang89
fanyang89 / Microsoft.PowerShell_profile.ps1
Created November 19, 2019 05:59
PowerShell Core Profile
using namespace System.Management.Automation
using namespace System.Management.Automation.Language
Import-Module PSColor
Import-Module posh-ssh
if ($host.Name -eq 'ConsoleHost') {
Import-Module PSReadLine
}
@fanyang89
fanyang89 / npm-taobao-setup.sh
Last active February 22, 2022 03:38
设置淘宝npm
npm config set registry https://registry.npmmirror.com # 注册模块镜像
npm config set disturl https://npmmirror.com/dist # node-gyp 编译依赖的 node 源码镜像
npm config set sass_binary_site https://npmmirror.com/mirrors/node-sass # node-sass 二进制包镜像
npm config set electron_mirror https://npmmirror.com/mirrors/electron/ # electron 二进制包镜像
npm config set puppeteer_download_host https://npmmirror.com/mirrors # puppeteer 二进制包镜像
npm config set chromedriver_cdnurl https://npmmirror.com/mirrors/chromedriver # chromedriver 二进制包镜像
npm config set operadriver_cdnurl https://npmmirror.com/mirrors/operadriver # operadriver 二进制包镜像
npm config set phantomjs_cdnurl https://npmmirror.com/mirrors/phantomjs # phantomjs 二进制包镜像
npm config set selenium_cdnurl https://npmmirror.com/mirrors/selenium # selenium 二进制包镜像
npm config set node_inspector_cdnurl https://npmmirror.com/mirrors/node-inspector # node-inspector 二进制包镜像
@fanyang89
fanyang89 / fuse.ts
Created April 29, 2018 09:04
Example fuse-box config with code splitting
import * as autoprefixer from "autoprefixer";
import * as express from "express";
import {
Bundle,
CSSPlugin,
FuseBox,
FuseBoxOptions,
ImageBase64Plugin,
JSONPlugin,
PlainJSPlugin,
@fanyang89
fanyang89 / themed.ts
Created February 26, 2018 08:36
Provide props to styled elements in Typescript
import * as React from "react";
import { ThemedStyledFunction } from "styled-components";
const themed = <IComponentProps, U extends HTMLElement = HTMLElement>(
styled: ThemedStyledFunction<any, any>,
): ThemedStyledFunction<IComponentProps & React.HTMLProps<U>, any> => styled;
export default themed;
// eg.