Skip to content

Instantly share code, notes, and snippets.

From f374a87d833e734520e46b19d0d5c53e10c10c96 Mon Sep 17 00:00:00 2001
From: Wei Hu <weihu@cs.virginia.edu>
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 / 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 / gist:7440969
Last active December 28, 2015 04:18
Running Scala GUI program in a chroot
# Install required libraries and fonts
sudo pacman -S libcups fontconfig libxrender libxtst gtk2 ttf-dejavu
export DISPLAY=:1.0
cd simulations; sbt compile; scala -cp target/scala-2.10/classes simulations.gui.EpidemyDisplay
@wh5a
wh5a / resonance_policy.py
Created July 30, 2013 16:34
SDN Module 6 Pyresonance Load Balancer
'''
Coursera:
- Software Defined Networking (SDN) course
-- Module 7 Programming Assignment
Professor: Nick Feamster
Teaching Assistant: Muhammad Shahbaz
'''
################################################################################
@wh5a
wh5a / QuickCheck.scala
Created November 10, 2013 05:09
Coursera Reactive Scala Programming #1 - Quickcheck
package quickcheck
import common._
import org.scalacheck._
import Arbitrary._
import Gen._
import Prop._
import Math._