Skip to content

Instantly share code, notes, and snippets.

@EvaGL
EvaGL / toLia.cpp
Created November 29, 2011 22:53
Diagram editor. Some bugs are fixed.
#include <windows.h>
#include <list>
HBRUSH hBrush;
HDC hdc;
RECT rect;
using namespace std;
int xPos, xPos1, yPos, yPos1, curX, curY, oldX, oldY, oldX1, oldY1;
bool IFCLICKED = 0;
bool IFRESIZED = 0;
@EvaGL
EvaGL / Main.java
Created March 30, 2012 09:47
Stackless Qsort
import java.util.Random;
public class Main {
private static boolean isSorted(int[] a) {
for (int i = 1; i < a.length; i++)
if (a[i - 1] > a[i])
return false;
return true;
}
@EvaGL
EvaGL / Node.java
Created May 11, 2012 23:33
Concurrent T-Tree
import java.util.Arrays;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;
import java.util.concurrent.locks.ReentrantReadWriteLock;
public class Node {
static final int MIN_ELEMENTS = 30, MAX_ELEMENTS = 2 * MIN_ELEMENTS;
private int[] data;
private int len;
@EvaGL
EvaGL / Code.java
Created September 8, 2012 21:29
Newton Method
public class Code {
static double border = 1;
public static double supLimPositive(double coef[]){
int m = 0;
for (int i = 0; i < coef.length; i++){
if (coef[i] < 0) {
m = i;
break;
}
// if (m!=0) break; Напоминание о том, как кое-кто хорошо отдохнул летом
@EvaGL
EvaGL / if.l
Created March 9, 2013 14:55
Example with while
declare void @read(i32*)
declare void @write(i32)
@a = global i32 0
@b = global i32 0
define i32 @main() {
call void @read(i32* @a)
call void @read(i32* @b)
%1 = load i32* @a
#include <stdio.h>
using namespace std;
typedef long long int64;
int used[100][100];
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, -1, 0, 1};
int64 count(int x, int y, int len, int f, int wasRotate, int fCount) {
if (len == 0)
#include <stdio.h>
int main() {
int i=5;
switch ( 2 ) {
case 0:
for ( i=0; i<10; i++ ) {
case 1:
printf("A i=%d\n",i);
case 2:
#include <cv.h>
#include <highgui.h>
int main() {
cv::Mat image(200, 200, CV_8UC3);
for (int i = 0; i < 200; ++i)
for (int j = 0; j < 200; ++j) {
image.ptr<unsigned char>(i)[3*j] = j * 255 / 200;
image.ptr<unsigned char>(i)[3*j + 2] = j * 255 / 200;
}
import socket
import re
import os
f = open(os.devnull, 'w')
keys = []
bad = [0]*255
while True:
for ip in xrange(1, 254):
if bad[ip] > 0:
@EvaGL
EvaGL / meta.cpp
Last active December 29, 2015 08:09
struct tree{
int meta[3];
int value;
tree *left;
tree *right;
tree() {
meta[0] = 2; //pointers count
meta[1] = sizeof(int) * 4; // offset to left
meta[2] = meta[1] + sizeof(tree*); // offset to right