Skip to content

Instantly share code, notes, and snippets.

View keepzero's full-sized avatar

KeepZero keepzero

View GitHub Profile
#!/bin/bash
#
# cachestat - show Linux page cache hit/miss statistics.
# Uses Linux ftrace.
#
# This is a proof of concept using Linux ftrace capabilities on older kernels,
# and works by using function profiling for in-kernel counters. Specifically,
# four kernel functions are traced:
#
# mark_page_accessed() for measuring cache accesses
@keepzero
keepzero / lvmcache_on_centos6.md
Created November 22, 2017 07:48 — forked from archsh/lvmcache_on_centos6.md
Using lvmcache on CentOS6

目标

  1. 使用SSD加速系统IO;
  2. 通过LVMCACHE来将SSD作为HDD的CACHE使用;

确认安装版本是否支持lvmcache:

lvm 命令

[root@localhost mnt]# lvm segtypes

(看输出里面有cache,cache-pool即表示支持了)

@keepzero
keepzero / bcache-status
Last active December 1, 2017 07:52 — forked from kairen/bcache-status
#!/usr/bin/env python
#
# Dumb script to dump (some) of bcache status
# Copyright 2013 Darrick J. Wong. All rights reserved.
#
# This file is part of Bcache. Bcache is free software: you can
# redistribute it and/or modify it under the terms of the GNU General Public
# License as published by the Free Software Foundation, version 2.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
@keepzero
keepzero / .npmrc
Created May 26, 2017 04:30
dotNpmrc
registry = https://registry.npm.taobao.org
[global]
index-url = https://pypi.douban.com/simple/
[install]
trusted-host = pypi.douban.com
[list]
format = columns
@keepzero
keepzero / etc-paths
Last active May 25, 2017 11:34
dotConfig
/usr/local/bin
/opt/bin
/usr/bin
/bin
/usr/sbin
/sbin
@keepzero
keepzero / .vimrc
Last active June 30, 2017 11:41
vimrc minimal
set nocompatible
" set encodings
set encoding=utf-8
set fileencodings=ucs-bom,utf-8,cp936,gb18030,big5,euc-jp,euc-kr,latin1
" few options just make things better
set scrolloff=3
set showmode
set showcmd
@keepzero
keepzero / term_no_256color.sh
Created July 18, 2013 06:36
When terminal not support 256color
if [[ $(echo $TERM | grep "rxvt-unicode") != "" ]]; then
export TERM=rxvt
fi
if [ "$TERM"x = "xterm-256color"x ]; then
export TERM=xterm
fi
if [ "$TERM"x = "screen-256color"x ]; then
export TERM=screen
@keepzero
keepzero / firewall.sh
Last active December 16, 2015 13:48
iptables cheatsheet
#!/bin/bash
# 1. 清除规则
iptables -F
iptables -X
iptables -Z
# 2. 设定政策
iptables -P INPUT ACCEPT #REJECT
iptables -P OUTPUT ACCEPT
@keepzero
keepzero / speedfox.sh
Created February 18, 2013 02:44
Run .mozilla in memory
#!/bin/bash
# Alex Alexander (wired) <alex.alexander@gmail.com>
# http://www.linuxized.com
#
# this script makes sure your .mozilla folder is in tmpfs and constantly syncs it
# with a folder on your hdd so you won't lose anything :)
# for more details on how it works visit my blog in the link above.
#
# for this to have any meaning, the MOZTMPFS folder must be on tmpfs
# i.e. to make /var/tmp a tmpfs folder, add the following in /etc/fstab