Skip to content

Instantly share code, notes, and snippets.

View ishenkoyv's full-sized avatar

Yurii Ishchenko ishenkoyv

  • Selfemployed
  • Mykolaiv, Ukraine
View GitHub Profile
@ishenkoyv
ishenkoyv / sane-caching.nginx.conf
Created November 12, 2019 17:58 — forked from philipstanislaus/sane-caching.nginx.conf
Sample Nginx config with sane caching settings for modern web development
# Sample Nginx config with sane caching settings for modern web development
#
# Motivation:
# Modern web development often happens with developer tools open, e. g. the Chrome Dev Tools.
# These tools automatically deactivate all sorts of caching for you, so you always have a fresh
# and juicy version of your assets available.
# At some point, however, you want to show your work to testers, your boss or your client.
# After you implemented and deployed their feedback, they reload the testing page – and report
# the exact same issues as before! What happened? Of course, they did not have developer tools
# open, and of course, they did not empty their caches before navigating to your site.
@ishenkoyv
ishenkoyv / jenkins_backup.sh
Created March 21, 2017 15:46
Jenkins Backup
#!/bin/bash
set -e #break on first error
JENKINS_DIRECTORY=/var/lib/jenkins
JENKINS_JOBS_DIRECTORY=/var/lib/jenkins/jobs
JOB_CONFIG_BACKUP_HOME=/root/jenkins_backups
NOW=$(date +%Y-%m-%d_%H-%M-%S)
JOB_CONFIG_BACKUP_TARGET=$JOB_CONFIG_BACKUP_HOME/$NOW
echo "backing up config.xmls of all jenkins jobs under $JENKINS_JOBS_DIRECTORY"
@ishenkoyv
ishenkoyv / README.md
Created November 15, 2016 12:56 — forked from dpb587/README.md
Terminating Gearman Workers in PHP - locally and remotely stopping workers without interrupting jobs.
@ishenkoyv
ishenkoyv / gist:6f8d2c10e200c7a13c16
Created March 25, 2016 23:35 — forked from douglasjarquin/gist:2208690
Amazon RDS Performance Tuning Settings
rds-modify-db-parameter-group {param-group-name} \
--parameters="name=character_set_server, value=utf8, method=pending-reboot" \
--parameters="name=collation_server, value=utf8_general_ci, method=pending-reboot" \
--parameters="name=tmp_table_size, value={DBInstanceClassMemory/16}, method=pending-reboot" \
--parameters="name=max_heap_table_size, value={DBInstanceClassMemory/16}, method=pending-reboot" \
--parameters="name=query_cache_type, value=1, method=pending-reboot" \
--parameters="name=query_cache_size, value=131072, method=pending-reboot" \
--parameters="name=table_open_cache, value=2500, method=pending-reboot" \
--parameters="name=join_buffer_size, value={DBInstanceClassMemory/64}, method=pending-reboot" \
--parameters="name=thread_cache_size, value={DBInstanceClassMemory/12582880}, method=pending-reboot" \

I was tired of Chrome eating all my laptop resources so I decided to put some limit to it with cgroup.

As I was using Ubuntu 12.04 with support for cgroup, I installed the package cgroup-bin and add the following group to the file /etc/cgconfig.conf:

group browsers {
    cpu {
#       Set the relative share of CPU resources equal to 25%
        cpu.shares = "256";
 }
apt-get install php-pear
pear channel-discover pear.pdepend.org
pear install pdepend/PHP_Depend
pear channel-discover pear.phpmd.org
pear install phpmd/PHP_PMD
pear channel-discover pear.phpunit.de
pear channel-discover pear.symfony.com
pear install phpunit/phploc phpunit/phpcpd phpunit/PHP_CodeBrowser phpunit/PHPUnit phpunit/PHPUnit_MockObject phpunit/PHP_CodeCoverage
wget -q -O - https://jenkins-ci.org/debian/jenkins-ci.org.key | apt-key add -
-- PostgreSQL 9.2 beta (for the new JSON datatype)
-- You can actually use an earlier version and a TEXT type too
-- PL/V8 http://code.google.com/p/plv8js/wiki/PLV8
-- Inspired by
-- http://people.planetpostgresql.org/andrew/index.php?/archives/249-Using-PLV8-to-index-JSON.html
-- http://ssql-pgaustin.herokuapp.com/#1
-- JSON Types need to be mapped into corresponding PG types
--
# Set cache dir
proxy_cache_path /var/cache/nginx levels=1:2
keys_zone=microcache:5m max_size=1000m;
# Virtualhost/server configuration
server {
listen 80;
server_name yourhost.domain.com;
# Define cached location (may not be whole site)
1 CPU in system; running 1 parallel copy of tests
Dhrystone 2 using register variables 24237227.4 lps (10.0 s, 7 samples)
Double-Precision Whetstone 2723.7 MWIPS (8.8 s, 7 samples)
Execl Throughput 1474.5 lps (29.8 s, 2 samples)
File Copy 1024 bufsize 2000 maxblocks 225342.8 KBps (30.0 s, 2 samples)
File Copy 256 bufsize 500 maxblocks 61650.3 KBps (30.0 s, 2 samples)
File Copy 4096 bufsize 8000 maxblocks 673875.3 KBps (30.0 s, 2 samples)
Pipe Throughput 364597.8 lps (10.0 s, 7 samples)
Pipe-based Context Switching 71409.3 lps (10.0 s, 7 samples)