Skip to content

Instantly share code, notes, and snippets.

#include <iostream>
#include <string.h>
#include <cmath>
int getInt(const char sym)
{
switch(sym)
{
case '0': return 0;
case '1': return 1;
#include <iostream>
#include <string.h>
using namespace std;
int main()
{
char in[101];
char sub[31];
cout<<"Введи строку: ";
@nkt
nkt / Bijective.php
Created October 12, 2013 12:53
Bijective algorithm implementation
<?php
/**
* Class Bijective
*/
class Bijective
{
/**
* @var array Alphabet for coding
*/
@nkt
nkt / vps.sh
Last active August 29, 2015 13:56
#!/bin/sh
sudo apt-get update
sudo apt-get -y upgrade
sudo apt-get -y dist-upgrade
sudo apt-get install -y software-properties-common python-software-properties
sudo add-apt-repository -y ppa:ondrej/php5
sudo add-apt-repository -y ppa:nginx/development # or ppa:nginx/stable
@nkt
nkt / cpp_task.md
Last active August 29, 2015 13:58

Наибольшая общая подстрока

  • Ограничение времени: 1.5 секунды
  • Ограничение памяти: 512Mb
  • Ввод stdin/input.txt
  • Вывод stdout/output.txt

Задача

Даны K строк, нужно найти их наибольшую общую подстроку

@nkt
nkt / rm_chrome_passwords.js
Last active August 29, 2015 14:01
Removes all chrome saved passwords
var removeButtons = document.querySelectorAll('#saved-passwords-list .row-delete-button')
Array.prototype.slice.call(removeButtons).forEach(function (el) {
el.click()
})
@nkt
nkt / EnumType.php
Created June 10, 2014 17:53
Doctrine2 enum type implementation.
<?php
namespace Nkt\Doctrine\Type;
use Doctrine\DBAL\Platforms\AbstractPlatform;
use Doctrine\DBAL\Types\Type;
/**
* Enum type
<?php
namespace App\CoreBundle\HttpFoundation;
use Doctrine\Common\Collections\Collection;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Validator\ConstraintViolationListInterface;
/**
* @author Nikita Gusakov <dev@nkt.me>
#!/bin/sh
STASH_VERSION='3.8.0'
wget "https://www.atlassian.com/software/stash/downloads/binary/atlassian-stash-${STASH_VERSION}.tar.gz"
tar xvzf "atlassian-stash-${STASH_VERSION}.tar.gz"
sudo adduser --disabled-login --shell /bin/bash --gecos 'Stash' stash
sudo mv "atlassian-stash-${STASH_VERSION}" /home/stash/stash
@nkt
nkt / gitlab.sh
Last active August 29, 2015 14:07
#!/bin/bash
apt-get update -y
apt-get upgrade -y
apt-get install sudo -y
sudo apt-get install -y vim
sudo update-alternatives --set editor /usr/bin/vim.basic
sudo apt-get install -y build-essential zlib1g-dev libyaml-dev libssl-dev libgdbm-dev libreadline-dev libncurses5-dev libffi-dev curl openssh-server redis-server checkinstall libxml2-dev libxslt-dev libcurl4-openssl-dev libicu-dev logrotate python-docutils pkg-config cmake