Skip to content

Instantly share code, notes, and snippets.

void qsort(int a[], int l, int r) {
int first, last, key;
first = l; last = r;
key = a[last];
while (first < last) {
while (first<last && a[first]<=key) first++;
a[last] = a[first];
while (first<last && a[last]>=key) last--;
a[first] = a[last];
}
../configure --prefix=/usr/local --mandir=/usr/local/share/man --infodir=/usr/local/share/info --enable-bootstrap --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-languages=c,c++,objc,obj-c++,fortran --disable-dssi --enable-libgcj-multifile --with-ppl --with-cloog --with-tune=generic --build=x86_64-redhat-linux --with-mpc-include=/usr/local/include --with-mpc-lib=/usr/local/lib --disable-multilib
#define C_IplImage_T_RwImage(ipl, rwi) do { \
(rwi).height = (ipl).height; (rwi).width = (ipl).width; \
(rwi).image_size = (ipl).imageSize; (rwi).widthStep = (ipl).widthStep; \
(rwi).imagedata = (uchar*)((ipl).imageData); \
} while(0)
#define C_RwImage_T_IplImage(rwi, ipl) do { \
(ipl).height = (rwi).height; (ipl).width = (rwi).width; \
(ipl).imageSize = (rwi).image_size; (ipl).widthStep = (rwi).widthStep; \
(ipl).imageData = (uchar*)((rwi).imagedata); \
@luoyetx
luoyetx / gtk.css
Created June 7, 2015 10:29
remove bottom boder on title bars on gnome 3.16
/* ~/.config/gtk-3.0/gtk.css */
/* Get rid of unsightly line in ssd title bar and reduce button padding */
.ssd .titlebar {
border: none;
background-image: linear-gradient(to bottom,
shade(@theme_bg_color, 1.042),
shade(@theme_bg_color, 0.999));
box-shadow: none;
border-top: 1px solid shade(@theme_bg_color, 1.072);
@luoyetx
luoyetx / example.cpp
Created June 11, 2015 12:25
多线程非阻塞队列
#include "mqueue.h"
#include <iostream>
#include <string>
#include <vector>
#include <random>
#include <Windows.h>
using namespace std;
struct Data {
@luoyetx
luoyetx / points.c
Last active March 6, 2016 14:56
learn c points in a weird way
#include <stdio.h>
int main(int argc, char *argv[]) {
int data[3][4] = {{1,2,3,4},{5,6,7,8},{9,10,11,12}};
int *p1 = (int *)data;
int **p2 = (int **)data;
int *************pn = (int *************)data;
printf("p1[3] = %d\n", p1[3]);
printf("p2[3] = %d\n", p2[3]);
@luoyetx
luoyetx / ssh.md
Last active August 31, 2015 04:41
ssh for git

生成 key

ssh-keygen -t rsa -C "xxx@xx.xx"

将主目录下的 .ssh/id_rsa.pub 的内容上传到服务平台

@luoyetx
luoyetx / eval_time_macros.c
Created January 11, 2016 01:43
time evaluation
#define TIMER_BEGIN { double __time__ = cv::getTickCount();
#define TIMER_NOW ((double(cv::getTickCount()) - __time__) / cv::getTickFrequency())
#define TIMER_END }
cmake .. -DBLAS=MKL -DMKL_INCLUDE_DIR="D:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2016\windows\mkl\include" -DUSE_CUDA=OFF -DUSE_CUDNN=OFF
@luoyetx
luoyetx / 0_reuse_code.js
Created March 19, 2016 13:48
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console