Skip to content

Instantly share code, notes, and snippets.

View jiri-jagos's full-sized avatar

Jiri Jagos jiri-jagos

View GitHub Profile
/*
* Takes provided URL passed as argument and make screenshots of this page with several viewport sizes.
* These viewport sizes are arbitrary, taken from iPhone & iPad specs, modify the array as needed
*
* Usage:
* $ casperjs screenshots.js http://example.com
*/
var casper = require("casper").create();
@jiri-jagos
jiri-jagos / README.md
Created September 24, 2015 20:42 — forked from magnetikonline/README.md
Setting Nginx FastCGI response buffer sizes.

Nginx FastCGI response buffer sizes

By default when Nginx starts receiving a response from a FastCGI backend (such as PHP-FPM) it will buffer the response in memory before delivering it to the client. Any response larger than the set buffer size is saved to a temporary file on disk. This process is also explained at the Nginx ngx_http_fastcgi_module page document page.

Since disk is slow and memory is fast the aim is to get as many FastCGI responses passing through memory only. On the flip side we don't want to set an excessively large buffer as they are created and sized on a per request basis (i.e. it's not shared memory).

The related Nginx options are:

@jiri-jagos
jiri-jagos / build.xml
Last active March 22, 2016 19:08 — forked from hectorsanjuan/build.xml
Phing build.xml for Symfony2 projects
<?xml version="1.0" encoding="UTF-8"?>
<project name="${projectName}" basedir="." default="build:main">
<!-- Properties -->
<property name="dir.app" value="${project.basedir}/app" />
<property name="dir.src" value="${project.basedir}/src" />
<property name="dir.build" value="${project.basedir}/app/build" />
<!--<property name="dir.docs" value="${dir.build}/docs" />-->
<!--<property name="dir.docs.phpdoc" value="${dir.docs}/phpdoc" />-->
<!--<property name="dir.docs.docblox" value="${dir.docs}/docblox" />-->
<property name="dir.reports" value="${dir.build}/logs" />
@jiri-jagos
jiri-jagos / DoctrineDbalStatementInterface.php
Created March 23, 2016 16:49 — forked from gnutix/DoctrineDbalStatementInterface.php
Mock Builder for Doctrine EntityManager / Connection mock objects.
<?php
namespace Mocks;
use Doctrine\DBAL\Driver\Statement;
/**
* Doctrine DBAL Statement implementing \Iterator.
*
* This class has been created because of a bug in PHPUnit Mock Objects.

SSH agent forwarding and screen

When connecting to a remote server via SSH it is often convenient to use SSH agent forwarding so that you don't need a separate keypair on that server for connecting to further servers.

This is enabled by adding the

ForwardAgent yes

option to any of your Host entries in ~/.ssh/config (or alternatively with the -A option). Don't set this option in a wildcard Host * section since any user on the remote server that can bypass file permissions can now als use keys loaded in your SSH agent. So only use this with hosts you trust.

@jiri-jagos
jiri-jagos / README.md
Created February 2, 2018 12:40 — forked from phillipgreenii/README.md
Running NPM Scripts through maven

I am in the process of introducing single page applications to where I work. For development, using node based build tools is much easier for the single page applications. However, the build process for our organization is based upon maven. Our solution started with the maven plugin frontend-maven-plugin. It worked great at first, but then we ran into a situation that I couldn't make work with it.

As stated before, at our organization, we have the older ecosystem which is maven and the newer ecosystem which is node. Our goal was to keep the hacking to a minimum. We did this by putting all of the hacks into a single super node based build file. This is what maven calls and the reason frontend-maven-plugin wasn't sufficient. The super node based build script calls all of the other build scripts by spawning npm run. Try as I might, I could not figure out how to make the spawn work. front-end-maven-plugin downloads npm

@jiri-jagos
jiri-jagos / config.md
Created September 8, 2018 00:01 — forked from 0XDE57/config.md
Firefox about:config privacy settings

ABOUT

about:config settings to harden the Firefox browser. Privacy and performance enhancements.
To change these settings type 'about:config' in the url bar. Then search the setting you would like to change and modify the value. Some settings may break certain websites from functioning and rendering normally. Some settings may also make firefox unstable.

I am not liable for any damages/loss of data.

Not all these changes are necessary and will be dependent upon your usage and hardware. Do some research on settings if you don't understand what they do. These settings are best combined with your standard privacy extensions (HTTPS Everywhere, NoScript/Request Policy, uBlock origin, agent spoofing, Privacy Badger etc), and all plugins set to "Ask To Activate".

@jiri-jagos
jiri-jagos / README.md
Created October 9, 2018 10:46 — forked from curran/README.md
Towards Reusable Charts Example

This example is code written by Mike Bostock in 2012 as part of his tutorial Towards Reusable Charts. I put together this bl.ock so that the example code can be seen in its entirety in one page and studied. To get this working, I needed to include additional CSS for axes, taken from this log axis example.

Here are some learning resources related to this example:

package com.objectpartners.buesing.util;
import java.util.Collections;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Map;
/**
* @author Neil Buesing
*/
@jiri-jagos
jiri-jagos / MimeTypes.java
Created April 23, 2019 12:43 — forked from markwhitaker/MimeTypes.java
Standard MIME type constants ready to use in a Java project
public final class MimeTypes
{
public static final class Application
{
public static final String ATOM_XML = "application/atom+xml";
public static final String ATOMCAT_XML = "application/atomcat+xml";
public static final String ECMASCRIPT = "application/ecmascript";
public static final String JAVA_ARCHIVE = "application/java-archive";
public static final String JAVASCRIPT = "application/javascript";
public static final String JSON = "application/json";