Skip to content

Instantly share code, notes, and snippets.

View nesterione's full-sized avatar
:electron:
doing well

Ihar Nestsiarenia nesterione

:electron:
doing well
View GitHub Profile
@nesterione
nesterione / dynmx.c
Last active August 29, 2015 14:13
dynamic matrix in c language
#include <stdio.h>
#include <stdlib.h>
int main() {
// строк
int n = 10;
// столбцов
int m = 5;
@nesterione
nesterione / findZerosInCollumns.c
Last active August 29, 2015 14:13
Найти столбцы имеющие нулевые элементы
#include <stdio.h>
/**
* find columns with zero elements
*/
void printMx(int n,int m,int mx[n][m]) {
int i,j;
for(i = 0; i< n; i++) {
for(j = 0; j< m; j++) {
printf(" %d ", mx[i][j]);
}
@nesterione
nesterione / listOfStruct.c
Created January 17, 2015 14:59
work with structs example
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
struct story {
char fio[30];
char diagnos[30];
char dat[30];
char notes[30];
};
__author__ = 'igor'
import math
import random
def integr(a,b,n, func):
h = (b - a)/n
sm = 0
for i in range(0,n):
y = func(a+h*i)
sm += y*h
# с каждой новой строки
a = int(input("enter something\n"))
b = int(input("enter something else\n"))
print(a,b)
# Если через пробел разделять переменные, то:
s = input("enter two numbers");
# разбить строку по пробелам
s = s.split()
a = int(s[0])
res.write("HTTP/1.1 200 OK\r\n".getBytes());
res.write("Date: Mon, 23 May 2005 22:38:34 GMT\r\n".getBytes());
res.write("Server: HApache/1.3.3.7 (Unix) (Red-Hat/Linux)\r\n".getBytes());
res.write("Content-Type: image/jpg\r\n".getBytes());
res.write("Content-Disposition: attachment; filename=home.jpg\r\n".getBytes());
res.write(String.format("Content-Length: %d\r\n",imageInByte.length).getBytes());
res.write("Accept-Ranges: bytes\r\n".getBytes());
res.write("Connection: close\r\n".getBytes());
res.write("\r\n".getBytes());
res.write(imageInByte);
public static List<KeyValuePair> secretMethodName(Tree tree) {
List<KeyValuePair> metadata = new ArrayList<>();
KeyValuePair treeId = new KeyValuePair();
treeId.setKey(tree.getId());
treeId.setValue(tree.getRootNodeIds().get(0));
metadata.add(treeId);
KeyValuePair description = new KeyValuePair();
treeId.setKey(tree.getId() + "_" + MetadataConstants.DESCRIPTION_KEY);
treeId.setValue(tree.getDescription());
for (KeyValuePair keyValuePair : rootNode.getMetadata()) {
if (StringUtils.startsWith(keyValuePair.getKey(), id)) {
rootNode.getMetadata().remove(keyValuePair);
}
}