Skip to content

Instantly share code, notes, and snippets.

@mpaskalev
mpaskalev / gist:750a7c6b4a39046f2ea1
Last active August 29, 2015 14:11
Get number of all real commits from git repository
// without merge
git log --pretty=oneline | grep -vi "merge" | wc -l
// with merge
git rev-list HEAD --count
@mpaskalev
mpaskalev / BrewBindInstallAndSetupMacOSX10_10.sh
Last active September 7, 2023 23:29
Install and setup bind (named) on Mac OS X 10.10.1 with brew 0.9.5
#!/bin/bash
# Run as root or sudo the commands that need it as you go.
# brew version 0.9.5
# Mac OS X 10.10.1
# A little bit changed version of this:
# http://stackoverflow.com/questions/19538118/osx-mavericks-bind-no-longer-installed-how-to-get-local-dns-server-working
@mpaskalev
mpaskalev / gist:bdb15bf96d252251155a
Created May 13, 2015 09:31
Search recursively in files with given extensions
grep what_to_search -r ./ --include="*.extension"
@mpaskalev
mpaskalev / gist:6040d8ccab1f115962527411de690eb2
Last active April 28, 2017 08:29
Get all network interfaces on a Unix machine and settings for each of them
cat /proc/net/dev | grep -Eo '(^[^\:]+)\:' | sed -e 's/^/ethtool/g' | sed -e 's/://g' | while read a; do $a; done
@mpaskalev
mpaskalev / gist:41eff74d0565c771ae95c20f6f9e7b9b
Last active November 27, 2019 00:07
Cloudflare IP ranges for correctly setting real_ip for nginx
# https://www.cloudflare.com/ips/ as of 27.11.2018
set_real_ip_from 103.21.244.0/22;
set_real_ip_from 103.22.200.0/22;
set_real_ip_from 103.31.4.0/22;
set_real_ip_from 104.16.0.0/12;
set_real_ip_from 108.162.192.0/18;
set_real_ip_from 131.0.72.0/22;
set_real_ip_from 141.101.64.0/18;
set_real_ip_from 162.158.0.0/15;
set_real_ip_from 172.64.0.0/13;