This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <string> | |
#include <vector> | |
#include <algorithm> | |
#include <functional> | |
#include <iostream> | |
using namespace std ; | |
class A | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Function UploadFile( url, file, fileType ) | |
Set oXMLHTTP = CreateObject("MSXML2.XMLHTTP") | |
Dim boundary | |
boundary = "12345678" | |
Set objStream = CreateObject("ADODB.Stream") | |
With objStream | |
.Type = 1 ' binary | |
.Open | |
.LoadFromFile(file) | |
End With |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
import gzip | |
''' | |
Extract table from MySQL dump file | |
use like this: | |
python extract_table.py filename.gz table_name > extract.txt | |
''' | |
with gzip.open(sys.argv[1],'rb') as f: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
def LocalMaximaFinder( im, kernel = [ 32, 32 ], threshold = 0, min_distance = 0 ): | |
( h, w ) = im.shape | |
results = [] | |
for y in range(0,h,kernel[0]): | |
for x in range(0,w,kernel[1]): | |
sub = im[y:y+kernel[0],x:x+kernel[1]] | |
max_pxl_value = np.max(sub) | |
if max_pxl_value > threshold: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#openssl-0.9.8l man build problem | |
#Error look like: file.pod around line 000: Expected text after =item, not a number | |
$ cd openssl-0.9.8l | |
$ find doc/ -name '*.pod' -print0 | xargs -0 sed -i 's/^=item \([0-9]\)/=item C<\1>/' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- build/qt-everywhere-opensource-src-4.6.2/src/gui/image/qpnghandler.cpp.ori 2015-08-06 21:07:32.907967363 +0200 | |
+++ build/qt-everywhere-opensource-src-4.6.2/src/gui/image/qpnghandler.cpp 2015-08-06 21:47:40.071884019 +0200 | |
@@ -163,8 +163,11 @@ | |
int bit_depth; | |
int color_type; | |
png_get_IHDR(png_ptr, info_ptr, &width, &height, &bit_depth, &color_type, 0, 0, 0); | |
- | |
- if (color_type == PNG_COLOR_TYPE_GRAY) { | |
+ png_colorp palette; | |
+ int num_palette; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void cvPolyfit( CvMat* src_x, CvMat* src_y, CvMat *dst, int order ) | |
{ | |
CvMat* X = cvCreateMat( src_x->rows, order+1, CV_32FC1 ); | |
for(int i=0;i<=order;i++) | |
{ | |
CvMat* cpy = cvCloneMat( src_x ); | |
cvPow( cpy, cpy, (double)i ); | |
for (int j=0;j<src_x->rows;j++) | |
cvmSet( X, j, i, cvmGet( cpy, j, 0 ) ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Size Rescale(Size original) | |
{ | |
// Figure out the ratio | |
double ratioX = (double)ThumbmailSize.Width / (double)original.Width; | |
double ratioY = (double)ThumbmailSize.Height / (double)original.Height; | |
// use whichever multiplier is smaller | |
double ratio = ratioX < ratioY ? ratioX : ratioY; | |
// now we can get the new height and width | |
int newWidth = Convert.ToInt32(original.Width * ratio); | |
int newHeight = Convert.ToInt32(original.Height * ratio); |
NewerOlder