Skip to content

Instantly share code, notes, and snippets.

View number-system-converter.cpp
#include <iostream>
#include <string.h>
#include <cmath>
int getInt(const char sym)
{
switch(sym)
{
case '0': return 0;
case '1': return 1;
View substr_count.cpp
#include <iostream>
#include <string.h>
using namespace std;
int main()
{
char in[101];
char sub[31];
cout<<"Введи строку: ";
@nkt
nkt / Bijective.php
Created Oct 12, 2013
Bijective algorithm implementation
View Bijective.php
<?php
/**
* Class Bijective
*/
class Bijective
{
/**
* @var array Alphabet for coding
*/
View vps.sh
#!/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
View cpp_task.md

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

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

Задача

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

@nkt
nkt / rm_chrome_passwords.js
Last active Aug 29, 2015
Removes all chrome saved passwords
View rm_chrome_passwords.js
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 Jun 10, 2014
Doctrine2 enum type implementation.
View EnumType.php
<?php
namespace Nkt\Doctrine\Type;
use Doctrine\DBAL\Platforms\AbstractPlatform;
use Doctrine\DBAL\Types\Type;
/**
* Enum type
View ApiResponse.php
<?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>
View stash-install.sh
#!/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
View gitlab.sh
#!/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