Skip to content

Instantly share code, notes, and snippets.

Avatar
🚀
Looking for a job

Sergey Ponomarev stokito

🚀
Looking for a job
View GitHub Profile
View DataSource.groovy
environments {
development {
dataSource {
...
configClass = com.example.OverrideGrailsDomainConfiguration
}
}
View Project1.pas
program Project1;
{$APPTYPE CONSOLE}
uses
SysUtils;
var
A: array of Integer; // массив целых чисел
View BeerSpec.groovy
import spock.lang.Specification
import spock.lang.Unroll
/**
A programmer drinks exactly goalPints of beer every evening.
One evening, the programmer opens his fridge and sees a number of smallBottles of beer (1 pint each) and a number of bigBottles of beer (3 pints each).
The programmer needs to decide whether he can pick some bottles and start drinking, or has to run to the store to buy some more bottles.
The programmer is "greedy" and never consumes a bottle partially.
Write a Java-method which returns true if it is possible to make the goal by choosing from the given (whole) bottles, or false otherwise.
Note that it is not necessary to "take" all bottles — some may remain unused.
View check.c
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <crypt.h>
/*
To compile:
$ gcc check.c -lcrypt -o check
$ ./check
*/
View keybase.md

Keybase proof

I hereby claim:

  • I am stokito on github.
  • I am stokito (https://keybase.io/stokito) on keybase.
  • I have a public key ASCpL3KIIhac4IjEIhLojZyzFSqceSuBLJaf08RZXn4sXQo

To claim this, I am signing this object:

@stokito
stokito / StacktracePatternLayout.java
Created Nov 11, 2017
StacktracePatternLayout: LOG4J pattern enhanced for stacktraces
View StacktracePatternLayout.java
package com.example;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import org.apache.log4j.PatternLayout;
import org.apache.log4j.helpers.PatternConverter;
import org.apache.log4j.helpers.PatternParser;
import org.apache.log4j.spi.LoggingEvent;
@stokito
stokito / pom.xml
Last active Dec 5, 2017
Example of creation symlink to target folder on Windows. symlink may be to another partion with more space or even in memory (that increases build speed up to 20%)
View pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.github.stokito</groupId>
<artifactId>clean-symlink-sample</artifactId>
<version>1.0-SNAPSHOT</version>
<build>
View XMLEscaper.java
package util;
import java.text.CharacterIterator;
import java.text.StringCharacterIterator;
public class XMLEscaper {
public static final String[] ESCAPED_CHAR = {"&", "'", "\"", "<", ">"};
public String escape(String aText) {
if (aText == null) return null;
View placeholder.css
/* BEGIN OF RESPONSIVE PLACEHOLDER CLASS */
/**
placeholder-xs class to show placeholder with field name for mobile phones but to hide and show label instead on larger screens.
Media for bigger devices than phones (tablet, laptops larger than 767px)
*/
@media (min-width: 768px) {
.placeholder-xs::-webkit-input-placeholder { /* Chrome */
color: transparent;
}
@stokito
stokito / openssl.MD
Created Jan 15, 2018 — forked from jchandra74/openssl.MD
HOWTO: Create Your Own Self-Signed Certificate with Subject Alternative Names Using OpenSSL in Ubuntu Bash for Window
View openssl.MD

HOWTO: Create Your Own Self-Signed Certificate with Subject Alternative Names Using OpenSSL in Ubuntu Bash for Window

Overview

My main development workstation is a Windows 10 machine, so we'll approach this from that viewpoint.

Recently, Google Chrome started giving me a warning when I open a site that uses https and self-signed certificate on my local development machine due to some SSL certificate issues like the one below:

Self-Signed SSL Issue in Chrome