Skip to content

Instantly share code, notes, and snippets.

@lcc-321
lcc-321 / download_all_pic.sh
Created July 20, 2012 08:15
download all pic
#!/bin/bash
auth='--ntlm --user xxmu\xxyxy:1234567'
host="http://www.xxmu.edu.cn"
dir=$host"/tpxz/2012%E5%B1%8A%E6%9C%AC%E7%A7%91%E6%AF%95%E4%B8%9A%E7%94%9F%E6%AF%95%E4%B8%9A%E5%85%B8%E7%A4%BC%E7%85%A7%E7%89%87/"
function get_href {
grep -io 'href="[^"]*"' | sed -r 's/href="([^"]*)"/\1/i'
@lcc-321
lcc-321 / testall.py
Created March 27, 2012 10:52
pyunit test all
#!/usr/bin/python2.6
# -*- coding: utf-8 -*-
import sys, os, re, unittest
test = re.compile("test\.py$", re.IGNORECASE)
def get_test_files(dir, files):
""" recursion search test module
Args: dir: search root directory, files: result container """
for file in os.listdir(dir):
@lcc-321
lcc-321 / progressbar.html
Created March 15, 2012 08:54
css3 animation progressbar
<!DOCTYPE html>
<html>
<style>
div.progressbar {
background-color: #6188F5; background-repeat: repeat-x;
background-position: 0 0; background-size: 16px 9px;
background-image: -webkit-linear-gradient(315deg,transparent,transparent 33%,
rgba(0, 0, 0, 0.12) 33%, rgba(0, 0, 0, 0.12) 66%, transparent 66%,
transparent);
background-image: -moz-linear-gradient(315deg,transparent,transparent 33%,
@lcc-321
lcc-321 / recursive_to_loop.c
Created November 3, 2011 04:01
F[0]=1; F[1]=1; F[n]=F[n div 2]+F[n div 3]+F[n div 5]+F[n div 7] with C
#include <stdio.h>
#include <stdlib.h>
#define true 1
#define false 0
typedef struct {
unsigned long long buff[65535];
int size;
} collection;
@lcc-321
lcc-321 / recursive_to_loop.rb
Created November 2, 2011 07:02
F[0]=1; F[1]=1; F[n]=F[n div 2]+F[n div 3]+F[n div 5]+F[n div 7] with Ruby
def loop_f(n)
collect_div_2 = []
collect_div_3 = []
collect_div_5 = []
collect_div_7 = []
div_r = n
while true
div_r /= 2
if div_r == 0 || div_r == 1