Skip to content

Instantly share code, notes, and snippets.

View athlan's full-sized avatar

Piotr Pelczar athlan

View GitHub Profile
@athlan
athlan / RemoveValuesUnderHistogramTreshold.m
Last active August 29, 2015 14:22
RemoveValuesUnderHistogramTreshold
function [ data_filtered ] = RemoveValuesUnderHistogramTreshold( data, percentageTreshold, numberOfHistogramBins )
%RemoveValuesUnderHistogramTreshold This function removes outstanding data variables that is
% under specific occurences threshold. The occurrences is partitioned
% by histogram method, equals bin size and fixes number of bins.
%
% data_filtered = RemoveValuesUnderHistogramTreshold(DATA, percentageTreshold, numberOfHistogramBins)
% (matrix) DATA : The vector with data
% (double) percentageTreshold : The occurences percentage (relative to maximum)
% that rejects outstanding values. Double value, e. g. 0.5 for under
% 50%
@athlan
athlan / AnnotationTypeInformationMapper.java
Created September 22, 2015 19:30
Spring Data Mongo custom _class value
package selly.spring.data.convert;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.config.BeanDefinition;
@athlan
athlan / test-writable.php
Last active March 6, 2016 20:35
test-writable.php
<?php
var_dump(is_writable('./')); // check if this script can write something to directory
var_dump(get_current_user ()); // display user name that executing this PHP file</pre>
@athlan
athlan / adblock-disabled-google-analytics.html
Last active March 31, 2016 22:21
Measure check Adblock disabled and push into Google Analytics
<!-- adblock checker -->
<div id="ablck_checker" class="ads ad adsbox doubleclick ad-placement carbon-ads"></div>
<script type="text/javascript">
(function() {
var checkAdblockPresence = function(elementId) {
return (getComputedStyle(document.getElementById(elementId))["display"] == "none") ? true : false;
};
var checkAdblockEvent = function() {
@athlan
athlan / directadmin-ssl-cert-cli.php
Last active March 5, 2018 07:48
Script pastes the SSL certificates into Direct Admin panel via CLI
<?php
// h - host
// u - user
// p - pass
// d - domain
// c - cert
// k - private key
$options = getopt("h:u:p:d:c:k:");
@athlan
athlan / commands.md
Last active July 17, 2019 14:19
Usefull linux commands

Most space-consuming directories

df -h .; du -sh -- * | sort -hr

Find files newer than..

find . -type f -newermt 2018-01-01
@athlan
athlan / notatki.md
Last active November 8, 2018 20:23
WJUG 114. [MID PL] Warsztaty: Java Flight Recorder i JMC - Michał Weyer i Jakub Słota - Notatki

Wrocław JUG, 8.11.2018

Wstep

Profilery:

  • Samplujące - próbki o zadanej częstotliwości - dane mogą nie być widoczne - szybksze
  • Instrumentujące - wpinają się w kod i odkładają dane - wolniejsze

JFR

@athlan
athlan / 01. symfony-moneyphp-mapping.yml
Last active May 8, 2019 18:21
moneyphp/money Doctrine mapping
doctrine:
orm:
mappings:
Money:
type: xml
dir: '%kernel.project_dir%/PATH_TO_MAPPING'
prefix: 'Money'
@athlan
athlan / ObjectPool.java
Created July 11, 2019 14:55
Java Object Pool
package pl.athlan.commons.pool;
import static java.util.stream.Collectors.toList;
import java.util.Collection;
import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.BlockingQueue;
import java.util.function.Supplier;
import java.util.stream.IntStream;
@athlan
athlan / FlyweightConcurrentSupplier.java
Created July 11, 2019 14:58
FlyweightConcurrentSupplier Java
package pl.athlan.common.concurrent;
import static java.util.Objects.requireNonNull;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.locks.ReadWriteLock;
import java.util.concurrent.locks.ReentrantReadWriteLock;
import java.util.function.Supplier;
/**