Skip to content

Instantly share code, notes, and snippets.

View qRoC's full-sized avatar
🇺🇦
Defending my home

Andrii Savytskyi qRoC

🇺🇦
Defending my home
View GitHub Profile
@qRoC
qRoC / result.txt
Created November 19, 2015 16:26
& vs new
BenchmarkNewV1Arr-8 2000000000 1.86 ns/op
BenchmarkNewV1Struct-8 1000000000 2.04 ns/op
BenchmarkNewV2Arr-8 1000000000 3.18 ns/op
BenchmarkNewV2Struct-8 500000000 3.24 ns/op
@qRoC
qRoC / main.cpp
Last active February 19, 2018 10:36
GO compiler
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <float.h>
#include <sys/time.h>
#include <stdint.h>
typedef int64_t TimeVal;
@qRoC
qRoC / extensions.sh
Last active March 7, 2016 12:54
php 7.0.2 debian
printf "\n" | pecl install apcu-beta && echo extension=apcu.so > /usr/local/etc/php/conf.d/10-apcu.ini
printf "\n" | pecl install apcu_bc-beta && echo extension=apc.so > /usr/local/etc/php/conf.d/apc.ini
printf "\n" | pecl install channel://pecl.php.net/amqp-1.7.0alpha2 && echo extension=amqp.so > /usr/local/etc/php/conf.d/amqp.ini
pecl install channel://pecl.php.net/ev-1.0.0RC9 && echo extension=ev.so > /usr/local/etc/php/conf.d/ev.ini
cd /etc && git clone --depth=1 -b php7 https://github.com/phpredis/phpredis.git \
&& cd /etc/phpredis \
&& phpize \
DEBIAN 8 Настройка сервера
==========================
Генерация ключей доступа
------------------------
$ cd ~/.ssh
$ ssh-keygen -t rsa
> KEY_NAME
> PASSPHRASE
$ ssh-keygen -R [SERVER_IP]
@qRoC
qRoC / list.sh
Last active April 12, 2016 21:58
DL380 G4 DEBIAN Jessie
vim /etc/apt/sources.list
> deb http://httpredir.debian.org/debian/ jessie main contrib non-free
apt-get update
apt-get install lib32stdc++6 binutils firmware-linux-nonfree
wget http://debian.sevstar.net/hp/pool/non-free/hp-health_8.7.0.1.2-5_amd64.deb
dpkg -i hp-health_8.7.0.1.2-5_amd64.deb
wget http://debian.sevstar.net/hp/pool/non-free/cpqacuxe_8.70-9.0.7-8_amd64.deb
dpkg -i cpqacuxe_8.70-9.0.7-8_amd64.deb
wget http://debian.sevstar.net/hp/pool/non-free/hp-snmp-agents_8.7.0.1.7-9_amd64.deb
mkdir tmp
@qRoC
qRoC / ORMFixture.php
Last active June 18, 2016 18:38
DoctrineFixturesBundle for big data
<?php
// Copyright (c) 2016 Andrey <qRoC.Work@gmail.com> Savitsky. All rights reserved.
// Site: http://qRoC.pro
namespace CommonBundle\DataFixtures;
use Doctrine\Common\DataFixtures\FixtureInterface;
use Doctrine\Common\DataFixtures\OrderedFixtureInterface;
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
@qRoC
qRoC / results
Last active January 24, 2017 15:32 — forked from dongilbert/results
Benchmark newInstanceWithoutConstructor vs unserialize for object creation vs json
PHP 5.6.29:
ReflectionClass::newInstanceWithoutConstructor: 0.17457699775696
ReflectionClass::newInstanceWithoutConstructor(json): 0.11926913261414
unserialize: 0.21122980117798
PHP 7.1.0:
ReflectionClass::newInstanceWithoutConstructor: 0.066795110702515
ReflectionClass::newInstanceWithoutConstructor(json): 0.065139055252075
unserialize: 0.10229301452637
@qRoC
qRoC / ClampSupport.swift
Last active January 13, 2018 00:20
Swift clamp protocol
///
public protocol ClampSupport {
func clamped(from lowerBound: Self, to upperBound: Self) -> Self
func clamped(from lowerBound: Self) -> Self
func clamped(to lowerBound: Self) -> Self
}
public extension ClampSupport where Self: Comparable {
@qRoC
qRoC / Results
Last active January 25, 2018 21:00
Swift simd matrix init bench Raw
Build flags: --configuration release
swiftc: -Ounchecked -gnone -whole-module-optimization -static-stdlib
Time elapsed for inverse: 2.64717900753021 s.
Time elapsed for inverse2: 1.35483705997467 s.
Time elapsed for inverse3: 11.727156996727 s.
Time elapsed for inverse4: 1.38384604454041 s.
Time elapsed for inverse5: 11.8544869422913 s.
Time elapsed for inverse6: 1.38975405693054 s.
Time elapsed for inverse7: 1.37177407939121 s.
@qRoC
qRoC / test.php
Last active May 16, 2018 11:19
Generic PHP interface (version < 5.4.1)
<?php
/// Work in PHP < 5.4.1
interface ITest {
public function testSelf(self $test);
}
class Test implements ITest {
private $a = 10;