Skip to content

Instantly share code, notes, and snippets.

@understar
understar / sides
Created January 15, 2014 08:48
Simple roll sides script.
# -*- coding: utf-8 -*-
"""
Created on Wed Jan 08 18:02:10 2014
@author: understar
"""
from __future__ import division
from collections import Counter
import sys
from random import randint
@understar
understar / pca
Created February 16, 2014 08:57
PCA python
# -*- coding: utf-8 -*-
from numpy import mean,cov,double,cumsum,dot,linalg,array,rank
from pylab import plot,subplot,axis,stem,show,figure
def princomp(A):
""" performs principal components analysis
(PCA) on the n-by-p data matrix A
Rows of A correspond to observations, columns to variables.
Returns :
@understar
understar / kernel_pca
Created February 16, 2014 08:59
Kernel PCA
"""
==========
Kernel PCA
==========
This example shows that Kernel PCA is able to find a projection of the data
that makes data linearly separable.
"""
print(__doc__)
#include <sys/stat.h>
#include <sys/mman.h>
#include <fcntl.h>
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
struct xyz
{
float x, y, z;
using System;
using System.Net;
using System.IO;
using Gdk;
namespace TileSticher
{
class App
{
public static int Main (string[] args)
#include <io.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <stdlib.h>
#include <stdio.h>
#include <windows.h>
#include <Share.h>
#include <math.h>
@understar
understar / tmscatch
Last active August 29, 2015 14:04
Download tiles from TIANDITU_SICHUAN
# -*- coding: utf-8 -*-
"""
Created on Wed Jul 23 10:41:47 2014
@author: shuaiyi
"""
import logging
from landez import TilesManager
down = False
@understar
understar / png2tiff.py
Created July 24, 2014 14:00
GDAL project TIANDITUSICHUAN tile png to wgs84 geotiff
import gdal, osr
import numpy as np
levelsdetail = {18:(262144, 131072, 256),
17:(131072, 65536, 256)
}
def lat_lon2index(lat, lon, level): # top left corner
width = levelsdetail[level][0]
height = levelsdetail[level][1]
@understar
understar / img2wav.py
Created July 24, 2014 15:48
基于sstv(slow scan television)技术的图像编码到音频
"""
Demonstrates playing the generated samples directly using PyAudio
Tested on PyAudio 0.2.7 http://people.csail.mit.edu/hubert/pyaudio/
"""
from __future__ import division
from pysstv.sstv import SSTV
from time import sleep
from itertools import islice
import struct, pyaudio

Basic example of taking an output from our server and putting it on a map. As leaflet allows you to add geoJSON directly, we convert it from esri's JSON format to a more standard one.