Skip to content

Instantly share code, notes, and snippets.

View maxkarelov's full-sized avatar
🏠
Working from home

Max Karelov maxkarelov

🏠
Working from home
View GitHub Profile
@maxkarelov
maxkarelov / liang-barsky-algorithm.cpp
Created April 14, 2015 09:27
Implementation of the Liang–Barsky algorithm for clipping polygons
#define INFINITY float::MaxValue
polygon^ Pclip (polygon^ P, point Pmin, point Pmax) {
polygon^ P1 = gcnew polygon(0);
point A = P[P->Count - 1];
int k = 0;
while (k < P->Count) {
point B = P[k];
float t1out, t2in, t2out,
xin, xout, txin, txout,
@maxkarelov
maxkarelov / mallot-polygons-clipping-algorithm.cpp
Last active August 29, 2015 14:20
The implementation of the Mallot algorithm of polygon clipping
int ExtCode(point A, point Pmin, point Pmax) {
int C = 0;
if (A.x < Pmin.x) {
C += 1;
if (A.y < Pmin.y) C += 20;
if (A.y > Pmax.y) C += 24;
return C;
}
if (A.x > Pmax.x) {
FROM debian:wheezy
RUN sed -i 's/# \(.*multiverse$\)/\1/g' /etc/apt/sources.list && \
apt-get update && \
apt-get install -y nasm gcc-multilib && \
rm -rf /var/lib/apt/lists/*
#pragma once
#include "stdafx.h"
#include "Transform.h"
#include <math.h>
std::vector<mat> matrices(0);
mat L;
mat3D T;
#pragma once
#define HEIGHT this->ClientRectangle.Height
#define WIDTH this->ClientRectangle.Width
namespace test3v11 {
using namespace System;
using namespace System::ComponentModel;
using namespace System::Collections;
@maxkarelov
maxkarelov / getInnerPoint.cpp
Last active August 29, 2015 14:21
Function for getting the inner point of polygon
point getInnerPoint(polygon^ P) {
// the following variables have a strict order: y_s < y_ss
float y_s = float::MaxValue,
y_ss = float::MaxValue;
// find two different min values
for (int i = 0; i < P->Count; i++) {
if (P[i].y < y_s) {
y_ss = y_s;
y_s = P[i].y;
Failed StepArgumentException with 'requirement failed: No keystore provided'
########################### MANIFEST ################################
version: "1.1"
header: {}
launch:
steps:
provisionMicroUbuntuAmazon:
action: provisionVms
@maxkarelov
maxkarelov / readme.md
Last active November 5, 2015 21:30
oracle jdk installation

FOR JDK 8u60

RPM:

wget --no-check-certificate --no-cookies --header "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/8u60-b27/jdk-8u60-linux-x64.rpm

TAR GZ:

wget --no-check-certificate --no-cookies --header "Cookie: oraclelicense=accept-securebackup-cookie"  http://download.oracle.com/otn-pub/java/jdk/8u60-b27/jdk-8u60-linux-x64.tar.gz
@maxkarelov
maxkarelov / oraInst.loc
Last active November 5, 2015 21:37
Instruction for weblogic silent mode installation
inventory_loc=/opt/oraInventory
inst_group=
@maxkarelov
maxkarelov / parsing_snippets.md
Last active November 11, 2015 11:09
parsing snippets patterns grep bash curl

get xml tag content

grep -oPm1 "(?<=<title>)[^<]+"