Skip to content

Instantly share code, notes, and snippets.

DOMAIN="www.mydomain.com"
if [[ ! -f "${DOMAIN}.key" ]]
then
echo "x"
openssl req -new -newkey rsa:4096 -nodes -keyout ${DOMAIN}.key -out ${DOMAIN}.csr
fi
echo Y
cp ${DOMAIN}.crt ${DOMAIN}_combined.crt
echo "" >> ${DOMAIN}_combined.crt
@fesor
fesor / README.md
Created July 25, 2018 12:28
Symfony without ORM

Удобный менеджмент миграций с Symfony и Doctrine

Мало кто знает, но что бы работал migration:diff вам не нужно ставить ORM.

Что бы это работало объявим простой сервис:

<?php
# get total requests by status code
awk '{print $9}' /var/log/nginx/access.log | sort | uniq -c | sort -rn
# get top requesters by IP
awk '{print $1}' /var/log/nginx/access.log | sort | uniq -c | sort -rn | head | awk -v OFS='\t' '{"host " $2 | getline ip; print $0, ip}'
# get top requesters by user agent
awk -F'"' '{print $6}' /var/log/nginx/access.log | sort | uniq -c | sort -rn | head
# get top requests by URL
@Rich-Harris
Rich-Harris / service-workers.md
Last active February 24, 2026 02:06
Stuff I wish I'd known sooner about service workers

Stuff I wish I'd known sooner about service workers

I recently had several days of extremely frustrating experiences with service workers. Here are a few things I've since learned which would have made my life much easier but which isn't particularly obvious from most of the blog posts and videos I've seen.

I'll add to this list over time – suggested additions welcome in the comments or via twitter.com/rich_harris.

Use Canary for development instead of Chrome stable

Chrome 51 has some pretty wild behaviour related to console.log in service workers. Canary doesn't, and it has a load of really good service worker related stuff in devtools.

@fesor
fesor / LINKS.md
Last active February 8, 2022 07:56
Годное чтиво
@fesor
fesor / README.md
Last active July 22, 2023 23:00
Symfony Request Object

Symfony Request Object

This is proof-of-concept implementation of laravel's like form requests.

Rational

Most of Symfony developers uses forms to map request data to some Data Transfer Object. This object then passes to validator and system start to work with validated data converted to be compatible with application model.

@kasparsd
kasparsd / php-excel-xlsx-xml.php
Last active January 18, 2021 14:13
Generate the most basic Excel XLSX and XML files in PHP, see https://kaspars.net/blog/wordpress/excel-xlsx-xml-php
<?php
/**
* UPDATE: This has been converted into a proper PHP library,
* see https://github.com/kasparsd/mini-sheets-php
*/
// Note: there are some references to WordPress methods and functions
class cf7_export_excel {
@billionaire
billionaire / curlGetViaGoogleProxy.php
Last active January 15, 2020 20:01
Google Chrome Data Compression Proxy [php, curl]
<?php
var_dump(curlGetViaGoogleProxy('http://4ip.pw/'));
function curlGetViaGoogleProxy($url, $post = '', $cookie = '') {
$timestamp = time();
$authValue = 'ac4500dd3b7579186c1b0620614fdb1f7d61f944'; // via http://superuser.com/a/959419
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
@petemcw
petemcw / docker_instructions.md
Last active September 24, 2024 14:38
Mac OS X Docker Instructions using Dinghy

Docker Installation

A great way to get Docker running smoothly on OS X is to use the awesome project Dinghy. It is basically:

Docker on OS X with batteries included, aimed at making a more pleasant local development experience. Runs on top of docker-machine.

Some of the benefits are:

  • Faster volume sharing using NFS rather than built-in virtualbox/vmware file shares
  • Filesystem events work on mounted volumes