Skip to content

Instantly share code, notes, and snippets.

View creamidea's full-sized avatar

NekoTrek creamidea

View GitHub Profile
@creamidea
creamidea / jquery.ba-tinypubsub.js
Created December 17, 2012 14:00 — forked from cowboy/HEY-YOU.md
这是一个用js实现的订阅/发布系统,写的很简洁,但是非常的完美。
/* jQuery Tiny Pub/Sub - v0.7 - 10/27/2011
* http://benalman.com/
* Copyright (c) 2011 "Cowboy" Ben Alman; Licensed MIT, GPL */
(function($) {
var o = $({});
$.subscribe = function() {
o.on.apply(o, arguments);
@creamidea
creamidea / gist:5319960
Last active December 15, 2015 20:40
The fundamentals of publishing html are described in the HTML publishing tutorial on worg. I am assuming that you have a basic working org publishing setup. By default org produces complete web pages. However, as I am using Jekyll I am only really interested in the section of the page between the <body> tags, as Jekyll produces the rest. Most th…
(setq org-publish-project-alist
'(
("org-ianbarton"
;; Path to your org files.
:base-directory "~/devel/ianbarton/org/"
:base-extension "org"
;; Path to your Jekyll project.
:publishing-directory "~/devel/ianbarton/jekyll/"
@creamidea
creamidea / gist:5320378
Last active December 15, 2015 20:41
org-mode官网的目录显示效果(css)
/*Here is content*/
@media screen
{
#table-of-contents {
float: right;
border: 1px solid #CCC;
max-width: 50%;
overflow: auto;
}
} /* END OF @media screen */
@creamidea
creamidea / gist:5320431
Created April 5, 2013 15:55
使用jquery完成平滑的滚动效果
//需要jquery, 当然你也可以全部纯手工打造
$('#text-table-of-contents').delegate('a', 'click', function() {
var target = $(this).attr("href");
var scrollNum = $(target)[0].offsetTop;
$('html, body').animate({ scrollTop: scrollNum-24 }, 'slow');
})
@creamidea
creamidea / helloLKMP.c
Last active December 16, 2015 05:08
The Linux Kernel Module Programming 的一个Hello程序。 The Linux Kernel Module Programming Guide:http://www.tldp.org/LDP/lkmpg/2.6/html/index.html
/* From: http://www.tldp.org/LDP/lkmpg/2.6/html/x279.html */
/*
* The following license idents are currently accepted as indicating free
* software modules
*
* "GPL" [GNU Public License v2 or later]
* "GPL v2" [GNU Public License v2]
* "GPL and additional rights" [GNU Public License v2 rights and more]
* "Dual BSD/GPL" [GNU Public License v2
@creamidea
creamidea / gist:5381898
Created April 14, 2013 08:20
The Linux Kernel Module Programming Hello world的makefile文件。不过稍微改一下可以编译其他到c Reference: http://www.tldp.org/LDP/lkmpg/2.6/html/index.html
obj-m:=hello.o
KERVER=$(shell uname -r)
KERDIR=/usr/src/linux-headers-$(KERVER)
CURDIR=$(shell pwd)
all:
make -C $(KERDIR) M=$(CURDIR) modules
clean:
make -C $(KERDIR) M=$(CURDIR) clean
@creamidea
creamidea / gist:5387156
Created April 15, 2013 10:21
这个是声明全局(外部可以使用,修改的)变量,数组和函数的实例程序代码。 linux内核模块编程。
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/moduleparam.h> /* Param header */
#define DRIVER_AUTHOR "icecream <creamidea@gmail.com>"
#define DRIVER_DESC "A sample driver"
/* 全局变量的声明 */
@creamidea
creamidea / export1.c
Created April 16, 2013 11:48
在外部调用函数实例: The linux Kernel Module Programming
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/moduleparam.h> /* Param header */
#define DRIVER_AUTHOR "icecream <creamidea@gmail.com>"
#define DRIVER_DESC "A sample driver"
extern void myfun(void); //这里声明外部函数
@creamidea
creamidea / basic.c
Last active December 16, 2015 06:59
这个代码是 Character Device Drivers的一个实例代码。参考地址:http://www.tldp.org/LDP/lkmpg/2.6/html/x569.html
#include <linux/init.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/moduleparam.h> /* Param header */
#include <linux/fs.h>
/*
* register_chrdev_region(){}
* alloc_chrdev_region(){}
* unsregister_chrdev_region(){}
@creamidea
creamidea / openclose.c
Last active December 16, 2015 08:59
这是一个实例代码,当打开自己创建到设备打开时,读写时,调用自己写的内核模块函数。
#include <linux/init.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/moduleparam.h> /* Param header */
#include <linux/fs.h>
/*
* register_chrdev_region(){}
* alloc_chrdev_region(){}
* unsregister_chrdev_region(){}