Skip to content

Instantly share code, notes, and snippets.

View ildarmf's full-sized avatar
🌴

Ildar ildarmf

🌴
  • Frankfurt
View GitHub Profile

Jedis Java Client

Jedis instances are single threaded

  • Don't use the same Jedis connection instance from multiple threads at the same time.
  • Using the same Jedis instance from multiple threads at the same time will result in socket connection errors/resets or strange error messages like "expected '$' but got ' '".

Use JedisPool

  • This allows you to talk to redis from multiple threads while still getting the benefits of reused connections.
  • The JedisPool object is thread-safe and can be used from multiple threads at the same time.
  • This pool should be configured once and reused.
  • Make sure to return the Jedis instance back to the pool when done, otherwise you will leak the connection.
@ildarmf
ildarmf / swap
Last active December 1, 2017 14:08
SWAP – один из механизмов виртуальной памяти, при котором отдельные фрагменты памяти (обычно неактивные) перемещаются из ОЗУ во вторичное хранилище (отдельный раздел или файл), освобождая ОЗУ для загрузки других активных фрагментов памяти.
Более подробно о механизме своппинга можно прочитать в Википедии.
Дополнительно SWAP используется при организации режима сна (hibernation или suspend to disk). При этом в SWAP сохраняется образ оперативной памяти.
Размещение
SWAP может быть размещен на разделе диска, в файле или в RAM. Исторически в Linux SWAP размещался на разделе, но в современных дистрибутивах производительность SWAP-файла не уступает SWAP-разделу. Однако стандартный установщик Ubuntu (до версии 17.04) не умеет создавать SWAP-файл при установке и выдает предупреждение, если SWAP-раздел не определен при разметке диска. Начиная с версии 17.04, Ubuntu предлагает по умолчанию создавать SWAP в файле (объем определяется как 5% от свободного на диске места, но не более 2 Гб). Использование SWAP-файла имеет неко
#!/bin/bash
# file: ttfb.sh
# curl command to check the time to first byte
# ** usage **
# 1. ./ttfb.sh "https://google.com"
# 2. seq 10 | xargs -Iz ./ttfb.sh "https://google.com"
curl -o /dev/null \
-H 'Cache-Control: no-cache' \
-s \
FROM alpine:3.4
ENV NGINX_VERSION 1.11.3
ENV DEVEL_KIT_MODULE_VERSION 0.3.0
ENV LUA_MODULE_VERSION 0.10.6
ENV LUAJIT_LIB=/usr/lib
ENV LUAJIT_INC=/usr/include/luajit-2.0
RUN GPG_KEYS=B0F4253373F8F6F510D42178520A9993A1C052F8 \
[Unit]
Description=dask-scheduler
[Service]
Restart=always
RestartSec=20
TimeoutStartSec=0
ExecStart=/usr/bin/python /usr/local/bin/dask-scheduler --pid-file="/var/run/dasks.pid"
ExecStop=kill /var/run/dasks.pid
docker run -d -p 9100:9100 \
-v "/proc:/host/proc:ro" \
-v "/sys:/host/sys:ro" \
-v "/:/rootfs:ro" \
--net="host" \
quay.io/prometheus/node-exporter \
-collector.procfs /host/proc \
-collector.sysfs /host/sys \
-collector.filesystem.ignored-mount-points "^/(sys|proc|dev|host|etc)($|/)"
@ildarmf
ildarmf / juniper
Created September 29, 2017 19:41
gkp7.admin@gkp7.vop.chel> show configuration
## Last commit: 2015-05-06 16:01:14 UTC by gkp7.admin
version 12.1X44-D35.5;
system {
host-name gkp7.vop.chel;
root-authentication {
encrypted-password "$1$oUqLOyVJ$ZP5.tTSeRxSyWFyglL5nF."; ## SECRET-DATA
}
login {
user gkp7.admin {
@ildarmf
ildarmf / links
Last active September 29, 2017 19:51
find . -mtime +3 -type f -delete
#!/bin/bash
set -x
cd /mnt
for f in $(ls -l | awk '{printf $9 " "}');
do
cd /mnt/$f/log
find . -mtime +30 -type f -delete
@ildarmf
ildarmf / boto for mac
Last active September 17, 2017 23:30
brew install python
sudo easy_install pip
sudo pip install boto
sudo pip install boto3
exception:
sudo pip install botocore3 --upgrade --ignore-installed six
Mac:~ i$ cat .boto
[default]