Skip to content

Instantly share code, notes, and snippets.

@flaneur2020
flaneur2020 / mysqlfs.rb
Created January 3, 2013 15:10
mysqlfs.rb
#!/usr/bin/ruby
#
# Quick proof of concept hack to get a MySQL Filesystem working via FUSE.
#
# Once mounted you can view all database tables and their contents.
#
# NB: Assumes mysqldump will run with: --user='root' --pass=''
#
# Documentation:
#

字体

  • 系统字体: /usr/share/fonts

  • 用户字体: ~/.fonts

  • 添加字体:

    将字体添加到上面的目录里,然后fc-cache清理字体缓存。如果成功,应在fc-list的结果中看到这一字体。

@flaneur2020
flaneur2020 / gist:4385443
Last active December 10, 2015 05:08
平均值、方差与统计显著性
require 'mathn'
def variance(arr)
m = avg(arr)
s = arr.map{|i| (i-m) ** 2 }.inject(:+).to_f
s / arr.size
end
def avg(arr)
arr.inject(:+).to_f / arr.size
@flaneur2020
flaneur2020 / Makefile
Created December 9, 2012 03:22
a Makefile sample for kernel module
MOD = sample
KPATH :=/lib/modules/$(shell uname -r)/build
PWD :=$(shell pwd)
obj-m = $(MOD).o
all:
$(MAKE) -C $(KPATH) M=$(PWD) modules
clean:
$(MAKE) -C $(KPATH) M=$(PWD) clean
@flaneur2020
flaneur2020 / inline.c
Created December 8, 2012 03:53
inline.c
#include <stdio.h>
inline void i_hello() {
printf("hello\n");
}
static inline void si_hello() {
printf("static inline hello\n");
}
@flaneur2020
flaneur2020 / qksort.c
Created December 1, 2012 04:05
quick sort
/*
* quick_sort.c
* 2012 Dec 1
* by fleuria <me.ssword@gmail.com>
*
* */
#include <stdio.h>
@flaneur2020
flaneur2020 / sucksversion.md
Last active October 13, 2015 05:37
SucksVersioN

SucksVersioN

svn提供了比git更为精细的权限控制,按照目录为单位。

  • checkout: svn co http://svn.miaomiao.com/svn/trunk -r HEAD
  • 创建自己的分支目录:svn mkdir http://svn.foo.com/svn/branches/fleuria
  • 创建特性分支:svn cp http://svn.foo.com/svn/trunk http://svn.foo.com/svn/branches/fleuria/issue1
  • 切换分支:svn switch http://svn.foo.com/svn/branches/fleuria/issue1
  • 不像git有暂存区,svn在提交时只能将需要提交的文件列在命令里: svn commit -m 'commit message' file1.c file2.c
  • 撤销当前的所有更改: svn revert -R .
@flaneur2020
flaneur2020 / ubuntu.md
Created November 4, 2012 04:25
ubuntu notes
# Thinkpad Trackpoint Scrolling
http://psung.blogspot.jp/2010/04/thinkpad-trackpoint-scrolling-in-ubuntu.html
保存到`/usr/share/X11/xorg.conf.d/20-thinkpad.conf `
```
Section "InputClass"
Identifier "Trackpoint Wheel Emulation"
MatchProduct "TrackPoint"
#!/bin/bash
#
# Copyright: TualatriX <tualatrix@gmail.com> GPL v3
#
# Website: http://imtx.cn/archives/1516.html
#
# Please add the following line to ~/.bashrc to enable the bash completion support
#
# complete -o filenames -F _root_command notify
#!/bin/bash
#
# Copyright: TualatriX <tualatrix@gmail.com> GPL v3
#
# Website: http://imtx.cn/archives/1516.html
#
# Please add the following line to ~/.bashrc to enable the bash completion support
#
# complete -o filenames -F _root_command notify