Skip to content

Instantly share code, notes, and snippets.

View ondrg's full-sized avatar

Ondra Geršl ondrg

View GitHub Profile
@fprochazka
fprochazka / fastcgi.conf
Last active April 10, 2020 03:07
nginx config files
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param QUERY_STRING $query_string;
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param CONTENT_TYPE $content_type;
fastcgi_param CONTENT_LENGTH $content_length;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
fastcgi_param REQUEST_URI $request_uri;
fastcgi_param DOCUMENT_URI $document_uri;
fastcgi_param DOCUMENT_ROOT $document_root;
@louismullie
louismullie / pi-monte-carlo.py
Created September 23, 2012 07:31
Monte Carlo Estimation of PI in Python
import random as r
import math as m
# Number of darts that land inside.
inside = 0
# Total number of darts to throw.
total = 1000
# Iterate for the number of darts.
for i in range(0, total):
@JakubTesarek
JakubTesarek / .bashrc
Last active October 27, 2021 19:59
.bashrc file with useful shortcuts. The file can update itself using `updaterc`. Also contains detection of platform it's running on
# if not running interactively, don't do anything
[ -z "$PS1" ] && return
# Detect platform
platform='unknown'
unamestr=`uname`
if [[ "$unamestr" == 'Linux' ]]; then
platform='linux'
elif [[ "$unamestr" == 'FreeBSD' ]]; then
platform='freebsd'
@ricsiga
ricsiga / nginx_virtual_document_root.conf
Last active November 23, 2022 14:19
virtual document root for Nginx
# [0-9].example.com -> /srv/tickets.example.com/[0-9]/app/build
# http://nginx.org/en/docs/http/server_names.html
server {
listen 80;
server_name "~^(?<subdomain>^\d).example.com$";
root /srv/tickets.example.com/$subdomain/app/build;
}