Skip to content

Instantly share code, notes, and snippets.

View olegchir's full-sized avatar

Oleg Chirukhin olegchir

View GitHub Profile
@olegchir
olegchir / portforwarding.md
Created October 12, 2015 18:13 — forked from kujohn/portforwarding.md
Port forwarding in Mavericks

Port Forwarding in Mavericks


Since Mavericks stopped using the deprecated ipfw (as of Mountain Lion), we'll be using pf to allow port forwarding.

####1. anchor file Create an anchor file under /etc/pf.anchors/<anchor file> with your redirection rule like:

@Configuration
public class MainConfiguration extends WebMvcConfigurerAdapter {
@Bean
public TilesViewResolver setupViewTilesResolver() {
TilesViewResolver resolver = new TilesViewResolver();
resolver.setViewClass(TilesView.class);
resolver.setOrder(0);
return resolver;
@olegchir
olegchir / php7_build_ubuntu.sh
Created May 18, 2016 12:45 — forked from m1st0/php_build_ubuntu.sh
Compiling PHP 7 on Ubuntu 15.04 with Various Supported Modules
#! /bin/bash
## PHP 7 Initial Compile ##
## Some help from the various places like these. ##
# http://www.zimuel.it/install-php-7/
# http://www.hashbangcode.com/blog/compiling-and-installing-php7-ubuntu
## Setup Ubuntu 15.04/15.10 ##
# Other dependencies for PHP 7. Add any missing ones from configure script
# complaints, plus some LAMP needs too.
@olegchir
olegchir / idea-reset-evaluation.sh
Created August 26, 2016 07:22
reset intellij idea 14 evaluation
#!/bin/bash
echo "removeing evaluation key"
rm ~/.IntelliJIdea15/config/eval/idea15.evaluation.key
echo "resetting evalsprt in options.xml"
sed -i '/evlsprt/d' ~/.IntelliJIdea15/config/options/options.xml
echo "resetting evalsprt in prefs.xml"
sed -i '/evlsprt/d' ~/.java/.userPrefs/prefs.xml
@olegchir
olegchir / PHPvsJavaBenchmark1.java
Created September 26, 2016 12:33
PHP vs Java - Hello World average time - #1
package com.olegchir.trollcaster.test1;
import org.openjdk.jmh.annotations.*;
import java.io.File;
import java.io.IOException;
public class PHPvsJavaBenchmark1 {
private static final String PHP_HOME = "C:\\Users\\olegchir\\Downloads\\php-7.0.11-nts-Win32-VC14-x86";
/**
* Created by olegchir on 18.11.2016.
*/
import java.math.BigInteger;
import java.util.concurrent.ForkJoinPool;
import java.util.concurrent.RecursiveTask;
class Sum extends RecursiveTask<BigInteger> {
private static final BigInteger MAX = new BigInteger("1000000000");
private static final BigInteger STREAK = MAX.divide(new BigInteger("16"));
/**
* Created by olegchir on 18.11.2016.
*/
import java.math.BigInteger;
class Sum2 {
private static final BigInteger MIN = BigInteger.ONE;
private static final BigInteger MAX = new BigInteger("10000000000");
private static final BigInteger TWO = new BigInteger("2");
import java.math.BigInteger;
class Sum2 {
private static final BigInteger MIN = BigInteger.ONE;
private static final BigInteger MAX = new BigInteger("10000000000");
private static final BigInteger TWO = new BigInteger("2");
public static void main(String[] args) {
long start = System.nanoTime();
final BigInteger result = (MIN.add(MAX)).multiply(MAX.divide(TWO)); //Hi from mister Gauss, motherfuckers!
#
# Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
#
# Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or