Skip to content

Instantly share code, notes, and snippets.

From f374a87d833e734520e46b19d0d5c53e10c10c96 Mon Sep 17 00:00:00 2001
From: Wei Hu <[email protected]>
Date: Sat, 26 Dec 2009 03:59:33 -0500
Subject: [PATCH] Use [] to flip pages.
---
po/ibus-pinyin.pot | 4 ++--
po/zh_CN.po | 8 ++++----
setup/ibus-pinyin-preferences.ui | 4 ++--
src/PinyinEngine.cc | 4 ++--
/* A simple inotify example from https://www.ibm.com/developerworks/linux/library/l-ubuntu-inotify/ */
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/inotify.h>
#define EVENT_SIZE ( sizeof (struct inotify_event) )
#define BUF_LEN ( 1024 * ( EVENT_SIZE + 16 ) )
/*
gcc a.c -g -o a
objdump -S a > a.s
*/
typedef int (*func_t)();
static int f(int arg) {
int a = 0, b = 1, c = 2;
import Data.Array.ST; import Control.Monad.ST; import Data.Array
import Control.Monad
import Data.List
numbers = [3, 4, 9, 14, 15, 19, 28, 37, 47, 50, 54, 56, 59, 61, 70, 73, 78, 81, 92, 95, 97, 99]
sources = reverse $ init numbers
{- Dynamic programming: build a table for
@wh5a
wh5a / kernel.txt
Created June 17, 2011 23:36
Kernel notes
Git tricks
http://blog.nelhage.com/2010/08/navigating-the-linux-kernel/
Linux Kernel Linked List Explained
http://isis.poly.edu/kulesh/stuff/src/klist/
ipv6
http://hiroshi1.hongo.wide.ad.jp/hiroshi/papers/yoshifuji_Mar2003.pdf
Why SYSCALL_DEFINE macros
@wh5a
wh5a / autoX.service
Created December 15, 2011 09:06
systemd service for auto login X
# Based on slim.service
[Unit]
Description=Auto Login X
Requires=dev-tty7.device
After=dev-tty7.device systemd-user-sessions.service
[Service]
ExecStart=/bin/su wh5a -l -c "/bin/bash --login -c startx >/dev/null 2>&1"
Restart=always
@wh5a
wh5a / cs373.py
Created May 31, 2012 18:15
Robotic Car Final exam
# -------------------
# Background Information
#
# In this problem, you will build a planner that helps a robot
# find the shortest way in a warehouse filled with boxes
# that he has to pick up and deliver to a drop zone.
#For example:
#
#warehouse = [[ 1, 2, 3],
# [ 0, 0, 0],
@wh5a
wh5a / car_complete.py
Created June 1, 2012 18:13
Complete code for Robotic Car from Unit 7
# -----------
# User Instructions
#
# The point of this exercise is to find the optimal
# parameters! You can write a twiddle function or you
# can use any other method
# that you like. Since we don't know what the optimal
# parameters are, we will be very loose with the
# grading. If you find parameters that work well, post
# them in the forums!
@wh5a
wh5a / mp3.c
Created December 16, 2012 22:30
CUDA Matrix Multiplication with Shared Memory
// MP 2: Due Sunday, Dec 16, 2012 at 11:59 p.m. PST
#include <wb.h>
#define wbCheck(stmt) do { \
cudaError_t err = stmt; \
if (err != cudaSuccess) { \
wbLog(ERROR, "Failed to run stmt ", #stmt); \
return -1; \
} \
} while(0)
@wh5a
wh5a / mp4.c
Created January 1, 2013 03:05
CUDA Array Sum with Reduction
// MP 4 Reduction
// Given a list (lst) of length n
// Output its sum = lst[0] + lst[1] + ... + lst[n-1];
// Due Tuesday, January 15, 2013 at 11:59 p.m. PST
#include <wb.h>
#define BLOCK_SIZE 512 //@@ You can change this
#define wbCheck(stmt) do { \