Skip to content

Instantly share code, notes, and snippets.

@huangzworks
huangzworks / cluster_command.md
Last active August 13, 2019 15:19
Redis 目前所有集群命令。

集群

CLUSTER INFO 打印集群的信息

CLUSTER NODES 列出集群当前已知的所有节点(node),以及这些节点的相关信息。

节点

@diyism
diyism / software alternative for linux.md
Last active August 8, 2024 23:45
software alternative for linux,migrating from windows to linux
  1. DOS usb boot -> ubuntu live iso usb boot(too big), minimal_linux_live_20-Jan-2017_64-bit.iso(only 6.8MB)
  2. diskgenius for dos -> testdisk("No Log\Proceed\Intel\Analyse\Quick Search", better than fdisk), gnome-disks
  3. norton ghost for dos -> "fsarchiver savefs" "fsarchiver restfs", remastersys
  4. windows xp -> debian+de(lxde, xfce), kali, ubuntu
  5. ntldr boot.ini -> grub menu.lst, boot-repair
  6. RemapKey/KeyTweak -> xmodmap -pke > ~/.Xmodmap then modify it, it will be loaded automatically
  7. myboard.exe -> myboard.py + modified xorg-server + modified libgtk2.0-0 + fcitx-googlepinyin
  8. MagicMover(D:\Program Files) -> remastersys restored sda1 + UnionFS-FUSE(pivot_root) sda2
  9. WinHex -> wxHexEditor, bless, (sublime hexviewer only can edit one line)
  10. emEditor(PHP/C braces outline, csv editor) -> sublime(ctrl+r to list functions, addon packages: AlignTab,SublimeCodeIntel,Codecs,ConvertToUTF8), SciTE(to view log files)
@Jerry-Fix
Jerry-Fix / lld - ss
Created September 26, 2013 14:51
Replace netstat with ss to implement the low level discovery for zabbix
#!/bin/bash
lines=$(sudo ss -lp | grep $1 | awk '{print $3}' | cut -d: -f2 | sort | wc -l)
if [ "$1" == "mongod" ]
then
portarray=(`sudo ss -lp | grep $1 | awk '{print $3}' | cut -d: -f2 | sort | head -n $(($lines/2)) 2>/dev/null`)
else
portarray=(`sudo ss -lp | grep $1 | awk '{print $3}' | cut -d: -f2 | sort 2>/dev/null`)
fi
@Jerry-Fix
Jerry-Fix / lsi megaraid health check
Created July 25, 2013 06:29
1. LSI Logic / Symbios Logic MegaRAID SAS 2208 2. LSI Logic / Symbios Logic MegaRAID SAS 9240 3. LSI Logic / Symbios Logic SAS2008 PCI-Express Fusion-MPT SAS-2
#!/bin/bash
# Checkresults are returned as text or integer.
# The script expects one parameter: The check you want to perform .
# The second paramter, the value you want to grep, is optional.
# The third parameter, the adapter number, is optional. If adapter number is missing, ALL is set.
# Thanks to https://twiki.cern.ch/twiki/bin/view/FIOgroup/DiskRefPerc
# for the nice overview
# LSI Logic / Symbios Logic MegaRAID SAS 2208
@fxn
fxn / gist:5344725
Last active December 15, 2015 23:59
ActiveRecord::ConnectionAdapters::PostgreSQLColumn.class_eval do
prepend Module.new {
def mpq?
type == :mpq
end
def simplified_type(field_type)
field_type == 'mpq' ? :mpq : super
end
openssl s_client -connect github.com:443 -showcerts 2>&1 < /dev/null | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' | sed -ne '1,/-END CERTIFICATE-/p' > /tmp/github.com.pem
openssl x509 -in /tmp/github.com.pem -sha1 -noout -fingerprint
#!/usr/bin/tclsh8.5
#
# Usage: git-unmerged branch1 branch2
#
# Shows all the non-common commits in the two branches, where non-common
# commits means simply commits with a unique commit *message*.
proc getlog branch {
lrange [split [exec git log $branch --oneline] "\n"] 0 400
}
@othercat
othercat / private.xml
Created October 31, 2012 03:45
Using KeyRemap4Macbook to remap J,K,G,Shift+G in Preview.app
<?xml version="1.0"?>
<root>
<item>
<name>Enable at only Preview</name>
<item>
<name>Use J and K to Up and Down</name>
<identifier>remap.app_preview_jk2UpDown</identifier>
<only>PREVIEW</only>
<autogen>--KeyToKey-- KeyCode::J, KeyCode::CURSOR_DOWN</autogen>
<autogen>--KeyToKey-- KeyCode::K, KeyCode::CURSOR_UP</autogen>

#对non-lock queue的简单分析#

今天看到 @梁斌penny 在打擂:http://coderpk.com

内容如下:

游戏规则: 比赛由pennyliang,就是本人梁斌同志坐庄,我提交baseline代码(可执行程序),和部分代码,方便统一游戏规则。 10亿数据(每个数据看作一个同志),1个队列,10个线程push,10个线程pop,走完一遍,考察总耗时,耗时最短的获胜。我的代码在我自己机器10亿数据排队进出,耗时1分28秒,内存峰值256MB(CPU16核,真8核那种,Intel(R) Xeon(R) CPU E5540 @ 2.53GHz)

@rainly
rainly / setup.sql
Created August 30, 2012 09:17 — forked from imperialwicket/setup.sql
PostgreSQL monthly table partitions
--
-- Setup - Add plpgsql, create a parent table, create an initial child table,
-- create the trigger and the initial trigger function.
--
-- We'll need plpgsql, so create it in your db if it's not already available.
CREATE LANGUAGE plpgsql;
-- Create a table to act as parent with the appropriate columns for your data.
CREATE TABLE my_schema.my_data (name varchar(24), create_date timestamp);