Skip to content

Instantly share code, notes, and snippets.

@1v
1v / gist:7473b4acbaac0d79877d
Last active May 31, 2018 16:45
Nginx behind Apache

Nginx behind Apache

Install mod_proxy_http:

a2enmod proxy_http

Add to /etc/apache2/apache2.conf (change ip):

<VirtualHost 11.1.11.111:80 >
	ServerName site.com
@1v
1v / gist:702381c4440cdb8af85a
Created July 9, 2014 16:07
Ruby: Iterate thru all headers
self.request.headers.each do |header|
next if !header[1].is_a?(String)
@@debug["#{header[0]}"] = header[1]
end
@1v
1v / gist:77595e676132a660843c
Last active July 14, 2016 18:49
Making production on port 80 and development on any other

Making production on port 80 and development on any other

Go to /etc/nginx/conf.d delete all files in it and create two files MyAppDevelopment.conf and MyAppProduction.conf (change MyApp to your app name).

Add to MyAppDevelopment.conf:

upstream MyAppDevelopment {
  server              unix:///tmp/MyAppDevelopment.sock;
}
@1v
1v / gist:a38f247c41ca60f6e48a
Last active August 29, 2015 14:03 — forked from ancap/gist:7616833
Ruby on Rails "Hellow World" app

Ruby on Rails "Hellow World" app

Run:

rails g controller StaticPages index

In config/routes.rb add:

root "static_pages#index"

###Show variable contents from controller in view###

@1v
1v / gist:ff5c3cd78b74e3248c1a
Last active August 29, 2015 14:01
How to pull request in MediaWIki
$wgImageLimits = array(
array(320, 3000),
array(640, 3000),
array(800, 3000),
array(1024, 3000),
array(1280, 3000),
array(1600, 3000),
array(1900, 3000)
);
I want limit only images widths, so I setted all heights to 3000. Now if image height less than 3000 then "Other resolutions" on image page (like https://www.mediawiki.org/wiki/File:Astronotus_ocellatus.jpg) is not displaying (only original size), because of this part in ImagePage.php https://github.com/wikimedia/mediawiki-core/blob/a3983418d5748fbccdda15e0e48af90c50ef1f67/includes/ImagePage.php#L386:
user@comp:~/www/wiki.com/extensions/Math/math$ make
ocamlopt -c util.ml
ocamlc -c render_info.mli
ocamlc -c tex.mli
ocamlyacc parser.mly
9 shift/reduce conflicts.
ocamlc -c parser.mli
ocamlopt -c parser.ml
ocamlc -c html.mli
ocamlopt -c html.ml
@1v
1v / gist:a9f1417d40bae5c8b9d4
Last active August 29, 2015 14:01
MediaWiki Git Installation

Install git:

sudo aptitude install git

Clone from repo (in site root path):

cd www/site.ru/
git clone -b REL1_23 https://gerrit.wikimedia.org/r/p/mediawiki/core.git ./
@namespace url(http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul);
.tabbrowser-tab {
background-color: rgba(255, 255, 255, 0.0) !important;
margin-top: -1px !important;
}
.tabbrowser-tab[selected="true"] {
height: 26px !important;
margin-top: -1px !important;
<?
header('Content-type: text/html; charset=utf-8');
error_reporting( E_ALL );
ini_set( 'display_errors', 1 );
echo "<pre>";
passthru("echo $HOME");
echo "<br>";