Skip to content

Instantly share code, notes, and snippets.

View lotabout's full-sized avatar

Jinzhou Zhang lotabout

View GitHub Profile
@lotabout
lotabout / wiznote.SlackBuild
Created November 26, 2014 08:51
SlackBuild script for wiznote
#!/bin/sh
# Slackware build script for <appname>
# Copyright <year> <you> <where you live>
# All rights reserved.
#
# Redistribution and use of this script, with or without modification, is
# permitted provided that the following conditions are met:
#
@lotabout
lotabout / qsort.cpp
Created December 1, 2014 02:12
quicksort following the algorithm of "Introduction to Algorithms"
#include <iostream>
using namespace std;
int partition(int array[], int lo, int hi)
{
// pivot=A[hi]; A[i] < pivot; A[j] >= pivot
int i = lo-1;
int j = lo;
for (j = 0; j < hi; ++j) {
@lotabout
lotabout / subset.py
Created January 3, 2015 09:42
subset.py
class Solution:
def subsets(self, S):
self.ht = {}
ret = [[]]
s_sorted = sorted(S)
for set_length in range(1, len(S)+1):
ret += self.subset(s_sorted, 0, set_length)
return ret
def subset(self, S, index, l):
@lotabout
lotabout / valid_train.c
Created January 12, 2015 09:41
validate if a sequence of push/pop is valid.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <malloc.h>
#include <stdbool.h>
bool check(int max, char *p)
{
/* simulate the push/pop of stacks */
bool *stack = (bool *)malloc((max+1) * sizeof(*stack));
@lotabout
lotabout / score.html
Created March 18, 2015 13:21
score management in JS
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<style>
#table_score {
border-collapse: collapse;
padding: 12px;
}
@lotabout
lotabout / print_seq.c
Created April 2, 2015 12:22
print sequence in order.
#include <stdio.h>
#include <malloc.h>
#include <string.h>
void print_seq(int seq[], int len)
{
int *indices = (int *)malloc(sizeof(int) * (len+1));
memset(indices, 0, sizeof(int)*(len+1));
int i;
@lotabout
lotabout / hibernate3-maven-plugin.pom.xml
Created April 19, 2015 08:00
example pom.xml for hibernate3-maven-plugin
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.mkyong.common</groupId>
<artifactId>Hibernate</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>Hibernate</name>
@lotabout
lotabout / maven-glassfish-plugin.pom.xml
Created April 21, 2015 07:14
Pom configuration for maven glassfish plugin
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>jp.co.worksap</groupId>
<artifactId>STBook</artifactId>
<packaging>war</packaging>
<version>1.0-SNAPSHOT</version>
<name>STBook Maven Webapp</name>
<url>http://maven.apache.org</url>
@lotabout
lotabout / settings.xml
Created April 21, 2015 07:14
.m2/settings.xml for maven glassfish plugin.
<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
<profiles>
<profile>
<id>glassfish-context</id>
<properties>
<local.glassfish.home>C:\\glassfish3\\glassfish</local.glassfish.home>
<local.glassfish.user>admin</local.glassfish.user>
--exclude=.git
--exclude=.hg
--exclude=log
--exclude=tmp
--languages=-javascript,sql
--langdef=clojure
--langmap=clojure:.clj
--regex-clojure=/\([ \t]*create-ns[ \t]+([-[:alnum:]*+!_:\/.?]+)/\1/n,namespace/