Skip to content

Instantly share code, notes, and snippets.

View creamidea's full-sized avatar

NekoTrek creamidea

View GitHub Profile
@creamidea
creamidea / convert.sh
Created September 26, 2013 03:21 — forked from wilmoore/convert.sh
#!/bin/bash
FILES=`find -iname *.txt -print`
for FILE in $FILES
do
# replace the + to # chars
sed -i -r 's/^([+]{4})\s/#### /' $FILE
sed -i -r 's/^([+]{3})\s/### /' $FILE
sed -i -r 's/^([+]{2})\s/## /' $FILE
sed -i -r 's/^([+]{1})\s/# /' $FILE
sed -i -r 's/(\[php\])/<?php/' $FILE
@creamidea
creamidea / long-polling-demo.coffee
Created July 30, 2013 16:26
这个是实现长轮询的代码。客户端使用的是coffeescript,服务器是Python的Flask。
Post =
getId: ->
$.ajax {
type: 'POST'
url: '/getId'
context: $('body')
success: (data) ->
successHandle(data)
return
error: (xhr, type) ->
@creamidea
creamidea / index.jade
Last active December 20, 2015 10:19
用于socket io实验。服务器端使用的是nodejs,框架是express,使用的语法糖衣是:coffeescript
extends layout
block content
h1= title
p Welcome to #{title}
van9ogh@VAN9OGH $ wpa_passphrase test "mypasswd"
network={
ssid="test"
#psk="mypasswd"
psk=0e804f52de7e7565be873500fa038cef6a9e571f56d6757f419191f3b4fe65c6
}
@creamidea
creamidea / gist:5410972
Created April 18, 2013 07:50
led makefile arm入门练习 交叉编译
obj-m=led.o
KERDIR=/opt/EmbedSky/linux-2.6.30.4
CURDIR=$(shell pwd)
# 交叉编译
CROSS_ARCH=ARCH=arm CROSS_COMPILE=arm-linux-
default:
# -C 转移目录
@creamidea
creamidea / gist:5410963
Created April 18, 2013 07:49
led.c arm入门练习 交叉编译
#include "led.h"
#include <linux/init.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/moduleparam.h> /* Param header */
#include <linux/cdev.h>
#include <linux/slab.h>
#include <linux/fs.h>
@creamidea
creamidea / gist:5410956
Created April 18, 2013 07:48
led.h arm入门练习 交叉编译
/* 使用全局变量,让上层可用 */
#ifndef __LED_H__
#define __LED_H__
#define LED_ON 1
#define LED_OFF 0
static int mymajor = 0; /* 主编号 */
static char* name = "myled"; /* 设备名字 */
@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(){}