Skip to content

Instantly share code, notes, and snippets.

View marek-saji's full-sized avatar
:shipit:

Marek ‘saji’ Augustynowicz marek-saji

:shipit:
View GitHub Profile
@marek-saji
marek-saji / dev-tld.md
Last active February 26, 2024 16:12
Configure local DNS server to serve #dev #TLD #ubuntu #linux

Configure local wildcard DNS server

  1. Install Dnsmasq: sudo apt-get install dnsmasq
  2. Since Ubuntu's NetworkManager uses dnsmasq, and since that messes things up a little for us, open up /etc/NetworkManager/NetworkManager.conf and comment out (#) the line that reads dns=dnsmasq. Restart NetworkManager afterwards: sudo restart network-manager.
  3. Make sure Dnsmasq listens to local DNS queries by editing /etc/dnsmasq.conf, and adding the line listen-address=127.0.0.1.
  4. Create a new file in /etc/dnsmasq.d (eg. /etc/dnsmasq.d/dev), and add the line address=/dev/127.0.0.1 to have dnsmasq resolve requests for *.dev domains. Restart Dnsmasq: sudo /etc/init.d/dnsmasq restart.

source: http://brunodbo.be/blog/2013/04/setting-up-wildcard-apache-virtual-host-wildcard-dns

#!/bin/bash
# (c)2012, Marek `saji` Augustynowicz
# Licensed under MIT License, http://marek-saji.mit-license.org
#
# Pass URL(s) as script's parameter(s). If no parameters passed,
# script seeks for `urls` file in current directory and read input
# from there. If no `urls` is to be found, read from stdin.
#
# Script tries to interpret lines as URLs and inteligently downloads them
# (using youtube-dl(1), where it makes sense). If input line does not look like
@marek-saji
marek-saji / .gitconfig
Created October 18, 2013 09:57
With this in .gitconfig you can use n/p keys to cycle through commits, diffs and diffs chunks in git-diff, git-show, git-log and such.
[core]
pager = "printf \".less-history-file:\n.search\n\\\"^(commit|diff|@@)\n.shell\n\" > ~/.gitlesshst ; LESSHISTFILE=~/.gitlesshst less -MFRSX"
#!/bin/bash
# Backup files specified in ~saji/.config/backup-these
# (c) Marek `saji' Augustynowicz
if [ "$EUID" != "0" ]
then
echo "Run as root, yo."
exit 1
fi
@marek-saji
marek-saji / -.sh
Last active December 26, 2015 05:29
stdin in scripts
#!/bin/sh
F=/dev/stdin
while : ; do
ls -al "$F" 2>/dev/null
F=$( readlink "$F" )
[ -z "$F" ] && break
done
@marek-saji
marek-saji / .bashrc
Created November 18, 2013 15:12
Bootstrapped interactive php shell
phpsh () {
BOOTSTRAP_FILE="$(
DIR="$( git rev-parse --show-toplevel 2>/dev/null || echo . )"
ls "$DIR/bootstrap.php" "$DIR/scripts/foo.php" 2>/dev/null | head -n1
)"
php -a -d xdebug.cli_color=1 -d auto_prepend_file="$BOOTSTRAP_FILE" "$@"
}
@marek-saji
marek-saji / foo.php
Last active December 30, 2015 03:49
Rubbish benchmark of design patterns for grouping functions together
<?php
/**
* Performance of design patterns for grouping functions together
*
* ^C, when you get bored.
*/
error_reporting(E_ALL);
class SomeClass
@marek-saji
marek-saji / dabblet.css
Last active January 1, 2016 14:59
cat draggin'
/**
* cat draggin'
*/
html,
body
{
min-height: 100%;
min-width: 100%;
margin: 0; padding: 0;
" be (VI)iMproved
set nocompatible
" UTF-8, anyone?
if has("multi_byte")
if &termencoding == ""
let &termencoding=&encoding
if $TERM == "linux" || $TERM_PROGRAM == "GLterm"
let &termencoding="latin1"
elseif $TERM == "xterm" || $TERM == "xterm-color"
@marek-saji
marek-saji / config
Created February 27, 2014 10:17
Add this to ~/.ssh/config to be able to connect to your koding.com VM via vm-{N}.{NAME}.koding.kd.io
Host *.kd.io
User saji
ProxyCommand ssh %[email protected] nc %h %p