Skip to content

Instantly share code, notes, and snippets.

View shonenada's full-sized avatar
🤷‍♂️
Focusing

Yaoda Liu shonenada

🤷‍♂️
Focusing
View GitHub Profile
@shonenada
shonenada / compare.jsp
Last active December 16, 2015 02:19
上传图片并且比较图片相似度
<%@ page language="java" contentType="text/html; charset=utf-8" import="java.awt.image.BufferedImage, javax.imageio.ImageIO, java.io.*, java.util.*" %>
<%!
static int[] deColor(BufferedImage orgImgBI)
{
int oWidth = orgImgBI.getWidth();
int oHeight = orgImgBI.getHeight();
int oMinx = orgImgBI.getMinX();
int oMiny = orgImgBI.getMinY();
int i,j;
int pixel, R, G, B, Gray;
@shonenada
shonenada / tinywebserver.py
Created April 18, 2013 16:20
A simple web server in python
#!/usr/bin/env python
#-*- coding:utf-8 -*-
import re
import os
import socket
web_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
web_socket.bind(("127.0.0.1", 8080))
web_socket.listen(5)
@shonenada
shonenada / webserver.c
Created April 20, 2013 04:55
A simple http server in C
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <fcntl.h>
#define WEBROOT "./webroot" // the web server's root directory
@shonenada
shonenada / gauss.h
Created April 20, 2013 04:57
Gaussian elimination.
#ifndef NM_GAUSS_H
#define NM_GAUSS_H
#include <iostream>
#include <math.h>
#include <stdlib.h>
using namespace std;
// A program used Gaussian elimination with maximal column pivoting to calculate equation set.
class Enum(object):
def __init__(self, *args, **kwargs):
raise NotImplemented
class Person(object):
gendor = Enum("gendor", fields=("male", "female", "unknown"))
def __init__(self):
self.gendor = "unknown"
@shonenada
shonenada / lagrange.c
Created June 25, 2013 13:56
lagrange interpolation
#include <stdio.h>
#include <stdlib.h>
#define N 10
#define MIN -5.0
#define MAX 5.0
#define F(x) (1 / (1 + x * x))
double x_at (int i);
double get_lj (int j, double x);
@shonenada
shonenada / piecewise interpolation.c
Created June 25, 2013 13:57
piecewise interpolation
#include <stdio.h>
#include <stdlib.h>
#define N 10
#define MIN -5.0
#define MAX 5.0
#define F(x) (1.0 / (1.0 + x * x))
double x_at(int i);
double get_L(int k, double x);
@shonenada
shonenada / gist:6098197
Created July 28, 2013 10:53
数图待整理笔记- = .
1.图像是自然世界在人的视觉中的一个反映
2.数字图像由有限的元素组成
(每个特定的元素都有特定的位置和幅值,称为像素)
3.数字图像处理:
借用数字计算机对数字图像进行处理
(处理精度高,处理内容丰富,可进行复杂的非线性处理,
有灵活的变通能力)
4.数字图像处理方法大致分为两大类:
(1).空间域法
直接对图像的像素进行处理,包括
@shonenada
shonenada / .bashrc
Created August 30, 2013 05:54
Extract all archive with one command.
extract () {
if [ -f $1 ] ; then
case $1 in
*.tar.bz2) tar xjf $1 ;;
*.tar.gz) tar xzf $1 ;;
*.bz2) bunzip2 $1 ;;
*.rar) rar x $1 ;;
*.gz) gunzip $1 ;;
*.tar) tar xf $1 ;;
*.tbz2) tar xjf $1 ;;
package main
import (
"fmt"
"log"
"net/http"
"strconv"
)
const (