Skip to content

Instantly share code, notes, and snippets.

@qiuwei
qiuwei / unity-builder.sh
Created November 6, 2012 13:00 — forked from freethinker/unity-builder.sh
unity-builder.sh
#!/bin/bash
# Dirty script to build Unity under ArchLinux
# Thanks for PKGBUILDs, chenxiaolong!
# Valdos Sine <fat0troll at riseup dot net> 2012
# Pratik Sinha <pratik at humbug dot in> 2012
echo "Run it in directory which will be build root ;)"
echo "Make sure you're have sudo without password or you will stuck in every package installation"
echo "GO!"
@qiuwei
qiuwei / PKGBUILD
Created November 26, 2012 21:51 — forked from sseemayer/PKGBUILD
mendeleydesktop 1.7-1 PKGBUILD
##maintainer Meow < meow at linux dot cn >
pkgname=mendeleydesktop
pkgver=1.7
pkgrel=1
pkgdesc="Academic software for managing and sharing research papers (desktop client)"
url=http://www.mendeley.com/release-notes/
arch=(i686 x86_64)
depends=(python2 qtwebkit)
license=(custom:mendeley_eula)
@qiuwei
qiuwei / PKGBUILD
Last active December 11, 2015 02:29
yong with ibus support.
pkgname=yong
pkgver=20130111
pkgrel=1
_realver="$pkgver"
pkgdesc="A Chinese input method"
arch=(i686 x86_64)
url="http://yong.uueasy.com/"
license=("freeware")
source=("http://ly50247.googlecode.com/files/yong-lin-${pkgver}.7z")
makedepends=("p7zip")
@qiuwei
qiuwei / .tmux.conf
Last active December 12, 2015 01:19
local bundles for spf13 vim distribution
# status bar
set-option -g status-utf8 on
set -g status-interval 1
set -g status-justify centre # center align window list
set -g status-left-length 20
set -g status-right-length 140
set -g status-left '#[fg=green]#H #[fg=black]• #[fg=green,bright]#(uname -r | cut -c 1-6)#[default]'
set -g status-right '#[fg=green,bg=black,bright]#(tmux-mem-cpu-load 1) #[fg=red,dim]#(uptime | cut -f 4-5 -d " " | cut -f 1 -d ",") #[fg=white]%a%l:%M:%S %p#[default] #[fg=blue]%Y-%m-%d'

Tutorials

@qiuwei
qiuwei / sqrt.clj
Created August 9, 2013 16:32
sqrt in clojure which follows scheme style
(defn sqrt [x]
(defn fixed-point [f first-guess]
(defn close-enough? [v1 v2]
(let [tolerance 0.000000001]
(< (Math/abs (- v1 v2))
tolerance)))
(defn tryo [guess]
(loop [oldo guess
newo (f oldo)]
(if (close-enough? oldo newo)
@qiuwei
qiuwei / fifo.c
Last active December 24, 2015 09:49
fifo
#include <stdio.h>
#define MAX_SIZE 128
struct fifo{
int size;
int head;
int count;
char element[MAX_SIZE];
};
@qiuwei
qiuwei / hw4
Last active February 22, 2023 19:25
Hex implementation CPP-for C
//Homework 4, implement game of hex
#include <iostream>
#include <vector>
#include <set>
using namespace std;
enum Color{
RED,
//search the element which has the minimal abs value in an ascending array
#include <iostream>
#include <cmath>
#include <vector>
using namespace std;
int minabs(vector<int> &a, int start, int end){
if(start+1 == end){
return a[start];
//double linked list insertion and deletion
//lrj whitebook p95
#include <iostream>
using namespace std;
struct Node{
int value;
Node* left;
Node* right;