Skip to content

Instantly share code, notes, and snippets.

View nikoncode's full-sized avatar

Mikita Karaliou nikoncode

  • Poland
View GitHub Profile
@nikoncode
nikoncode / common.sql
Created July 24, 2013 22:05
Запрос для получения информации о пользователе по должности more to more
SELECT users.*, COUNT(*) AS c
FROM users, work, userwork
WHERE userwork.wid = work.id AND userwork.uid = users.id
AND work.name IN ('%IMPLODED ARRAY%')
GROUP BY users.id
HAVING c = %COUNT OF %IMPLODED ARRAY%%
@nikoncode
nikoncode / add.php
Created August 29, 2013 21:15
long polling
<?php
$db = new mysqli("localhost", "root", "", "test");
$db->query("INSERT INTO messages (text, time) VALUES ('".$_POST["text"]."', '".time()."');");
@nikoncode
nikoncode / 1.cpp
Created September 29, 2013 13:37
Task for Dasha #2_2
#include <stdio.h>
int main () {
int num1, num2, cur_num1, cur_num2, temp=1, res=0;
scanf("%d %d",&num1, &num2);
while (num1 % 10 != 0) {
cur_num1 = num1 % 10;
cur_num2 = num2 % 10;
if (cur_num1 % 2 != 0 | cur_num1 != cur_num2) {
res += cur_num1 * temp;
@nikoncode
nikoncode / merge_arrays.java
Created October 7, 2013 17:34
merge sort multi threading
public class merge_arrays {
public static final int CNT_ELEMENTS = 10000000;
public static int[] left(int[] array) {
int midpoint = array.length / 2;
int left[] = new int [midpoint];
for (int i=0;i<midpoint;i++)
left[i] = array[i];
return left;
}
@nikoncode
nikoncode / 2.cpp
Last active December 25, 2015 15:19
laba
#include <stdio.h>
#include <limits.h>
int * arr_read(int &n) {
printf("Введите n=");
scanf("%d",&n);
int * arr = new int[n];
for (int i = 0; i < n; ++i) {
printf("a[%d]=", i);
scanf("%d", &arr[i]);
@nikoncode
nikoncode / 1.cpp
Last active December 30, 2015 22:49
salo
while ((p=strchr(p,'+'))) {
char * substr = p;
char * minus = strchr(p, '-');
if (minus == 0) break;
while ((substr=strchr(substr,'B'))) {
if (substr < minus) {
c++;
substr++;
} else {
break;
@nikoncode
nikoncode / LR_7.cpp
Created December 17, 2013 17:14
vovan
#include <stdio.h>
#include <string.h>
#include <conio.h>
struct drugstore {
char name[20];
char manufacturer[20];
unsigned long cost;
char type[20];
char indications[50];
@nikoncode
nikoncode / gist:9375444
Last active August 29, 2015 13:57
find
AnsiString search_path = ExtractFileDir(Application->ExeName)+"\\dlls\\"; //файлы будут искаться в папке dlls рядом с программой
...
ListBox1->Items->Clear(); //очищаем лист бокс
WIN32_FIND_DATA w32; //Создаем структура для хранения результатов поиска
HANDLE file = FindFirstFile((search_path+"*.dll").c_str(), &w32); //ищем первый файл с расширением dll, результат пишем в созданную структуру
bool is_finded = true; // помечаем что файл найден
while (is_finded) { //пока файл найден
if(!(w32.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) { //если это не папка, а файл
ListBox1->Items->Add(w32.cFileName); //добавляем имя в список
}
This file has been truncated, but you can view the full file.
-- phpMyAdmin SQL Dump
-- version 3.5.1
-- http://www.phpmyadmin.net
--
-- Хост: 127.0.0.1
-- Время создания: Мар 22 2014 г., 13:38
-- Версия сервера: 5.5.25
-- Версия PHP: 5.3.13
SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
@nikoncode
nikoncode / sphinx.conf
Created March 23, 2014 11:12
sphinx indexes
searchd
{
listen = 1337:mysql41
pid_file = /var/run/searchd.pid
log = /var/log/sphinxsearch/log.txt
query_log = /var/log/sphinxsearch/query_log.txt
}
source users
{