Skip to content

Instantly share code, notes, and snippets.

View chaoxu's full-sized avatar
😀

Chao Xu chaoxu

😀
  • University of Electronic Science and Technology of China
  • Chengdu, Sichuan, China
View GitHub Profile
@chaoxu
chaoxu / notifications.sh
Created April 25, 2010 02:37
clear + cat done every time a file changes
#!/bin/sh
T=0
while true; do
P=`stat -c %Y $1`
if [ "$T" -ne "$P" ];
then
T=$P
clear
cat $1
date
\documentclass[10pt]{article}
\usepackage{pgf,tikz}
\usetikzlibrary{arrows}
\pagestyle{empty}
\begin{document}
\definecolor{xdxdff}{rgb}{0.66,0.66,0.66}
\definecolor{qqqqff}{rgb}{0.33,0.33,0.33}
\begin{tikzpicture}[line cap=round,line join=round,>=triangle 45,x=0.5cm,y=0.5cm]
\clip(0,-20) rectangle (30,0);
\draw (8.55,-9.69)-- (17.64,-15.71);
\documentclass[10pt]{article}
\usepackage{pgf,tikz}
\usetikzlibrary{arrows}
\pagestyle{empty}
\begin{document}
\definecolor{qqqqff}{rgb}{0.33,0.33,0.33}
\begin{tikzpicture}[line cap=round,line join=round,>=triangle 45,x=0.5cm,y=0.5cm]
\clip(0,-20) rectangle (30,0);
\draw [dotted] (8.55,-9.69) circle (2.95cm);
\draw (4.1,-5.8)-- (6.7,-15.3);
import java.util.*;
public class schedule{
public static ArrayList<Integer> sol;
public static int max_weight=0;
public static int max_cost=0;
public static void main(String[] args){
//ALL these is just to read data from standard input.
Scanner in = new Scanner(System.in);
//first line contains 1 integer, indicate how many courses specified by the user
int n = in.nextInt();
#!/bin/sh
mkdir $1
i=0
t=-1
if [ $# -eq 3 ]
then
t=$3
fi
while [ $i -ne $t ]
do
import java.util.*;
import java.math.*;
public class MultiWordIntersection{
public static int MultiIntersection(ArrayList<String> a, String sword){
int sum = 0;
SurfaceWord sw = new SurfaceWord(sword);
for(int i=0;i<a.size();i++){
WordVector p = new WordVector(sw.toNumber(a.get(i)));
for(int j=i+1;j<a.size();j++){
WordVector p1 = new WordVector(sw.toNumber(a.get(j)));
import java.util.*;
public class bio{
public static void main(String[] args){
char[] c = "aabc".toCharArray();
//String s = "eabahgcabah";
String s = "aaaaaaabc";
int[] r = list(c,s);
for(int i=0;i<r.length;i++){
System.out.println(r[i]);
}
import java.util.*;
public class expectedcars {
public static void main(String[] args){
int n = 100000;
int l = 10000;
long z = 0;
for(int i=0;i<l;i++){
z+=n-simulate(n);
}
System.out.println(((double) z)/((double) l));
#include <stdlib.h>
#include <time.h>
#include "iostream"
#include <math.h>
using namespace std;
double p;
int interval(double l, double a){
a = a - floor(a);
if(l<1.0) return 0;
#include <stdlib.h>
#include <time.h>
#include "iostream"
#include <math.h>
using namespace std;
double p;
//n is the length of a car
double n;
double e = 0.0000001;
//double e = 0;