Skip to content

Instantly share code, notes, and snippets.

View athlan's full-sized avatar

Piotr Pelczar athlan

View GitHub Profile
@athlan
athlan / README.md
Created January 16, 2024 19:57
Diagnose docker container size

Sometimes there's a problem where containers taking up all space. The following checklist helps with diagnosing what is the root cause of that.

  1. Basic commands to check docker status and consumed size
docker system df
docker system df -v
docker container ls -s
@athlan
athlan / Dockerfile
Last active May 24, 2022 21:59
Docker cron env variables
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 July 11, 2019 14:59
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 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;
/**
@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 / 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 / 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 / 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 / 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 / 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() {