Skip to content

Instantly share code, notes, and snippets.

Avatar

Piotr Pelczar athlan

View GitHub Profile
@athlan
athlan / Dockerfile
Last active Oct 17, 2021
Docker cron env variables
View Dockerfile
FROM XXXX
#Install cron
RUN apt-get update; \
apt-get install -y cron; \
apt-get clean; \
touch /var/log/cron.log
COPY crontab.txt /etc/cron.d/crontab
COPY run-cron.sh /usr/local/app/entrypoint/run-cron.sh
@athlan
athlan / ConcurrentMementoSupplier.java
Created Jul 11, 2019
ConcurrentMementoSupplier Java
View ConcurrentMementoSupplier.java
package pl.athlan.common.concurrent;
import java.util.function.Supplier;
import javax.annotation.concurrent.ThreadSafe;
/**
* Thread-safe implementation of {@link MementoSupplier}.
*
* @param <T>
@athlan
athlan / FlyweightConcurrentSupplier.java
Created Jul 11, 2019
FlyweightConcurrentSupplier Java
View 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;
/**
View ObjectPool.java
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 / 01. symfony-moneyphp-mapping.yml
Last active May 8, 2019
moneyphp/money Doctrine mapping
View 01. symfony-moneyphp-mapping.yml
doctrine:
orm:
mappings:
Money:
type: xml
dir: '%kernel.project_dir%/PATH_TO_MAPPING'
prefix: 'Money'
@athlan
athlan / notatki.md
Last active Nov 8, 2018
WJUG 114. [MID PL] Warsztaty: Java Flight Recorder i JMC - Michał Weyer i Jakub Słota - Notatki
View notatki.md

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 / commands.md
Last active Jul 17, 2019
Usefull linux commands
View commands.md

Most space-consuming directories

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

Find files newer than..

find . -type f -newermt 2018-01-01
@athlan
athlan / directadmin-ssl-cert-cli.php
Last active Mar 5, 2018
Script pastes the SSL certificates into Direct Admin panel via CLI
View directadmin-ssl-cert-cli.php
<?php
// h - host
// u - user
// p - pass
// d - domain
// c - cert
// k - private key
$options = getopt("h:u:p:d:c:k:");
@athlan
athlan / adblock-disabled-google-analytics.html
Last active Mar 31, 2016
Measure check Adblock disabled and push into Google Analytics
View adblock-disabled-google-analytics.html
<!-- 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 / test-writable.php
Last active Mar 6, 2016
test-writable.php
View 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>