Skip to content

Instantly share code, notes, and snippets.

View stokito's full-sized avatar
Self-hosting become easier

Sergey Ponomarev stokito

Self-hosting become easier
View GitHub Profile
program Project1;
{$APPTYPE CONSOLE}
uses
SysUtils;
var
A: array of Integer; // массив целых чисел
@stokito
stokito / BeerSpec.groovy
Created November 17, 2014 17:10
Test task
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.
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <crypt.h>
/*
To compile:
$ gcc check.c -lcrypt -o check
$ ./check
*/
@stokito
stokito / pom.xml
Last active December 5, 2017 07:58
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%)
<?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>
> imdisk -h
Control program for the ImDisk Virtual Disk Driver.
For copyrights and credits, type imdisk --version
Syntax:
imdisk -a -t type -m mountpoint [-n] [-o opt1[,opt2 ...]] [-f|-F file]
[-s size] [-b offset] [-v partition] [-S sectorsize] [-u unit]
[-x sectors/track] [-y tracks/cylinder] [-p "format-parameters"] [-P]
imdisk -d|-D [-u unit | -m mountpoint] [-P]
imdisk -R -u unit
/* 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;
}

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 November 11, 2017 15:05
StacktracePatternLayout: LOG4J pattern enhanced for stacktraces
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;
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;
@stokito
stokito / pkg_size.sh
Last active June 24, 2021 03:14
openwrt opkg size of all packages
grep -H Installed-Size: /usr/lib/opkg/info/*.control | sed 's,^.*/\([^/]\+\)\.control:Installed-Size: *\(.*\),\2\t\1,' | sort -n