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
#!/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 / .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
# (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 / 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/sh
# Show from which one of integration branches does current branch grows from
# (c) Marek `saji` Augustynowicz
#
# INSTALL:
# git config alias.grows-from '!sh .git/bin/grows-from.sh'
#
# USAGE:
# git grows-from [<commit>]
@marek-saji
marek-saji / change-git-svn-authors.sh
Created March 24, 2013 16:57
Change authors in git-svn repository basing on git-svn's authorfile.
#!/bin/sh
if [ -z "$1" ]
then
cat <<< HELP
(c) Marek 'saji' Augustynowicz
USAGE
change-git-svn-authors.sh RELATIVE_PATH_TO_AUTHORS_FILE
Obtaining authors.txt for your repository
-----------------------------------------
@marek-saji
marek-saji / dabblet.css
Created March 19, 2013 11:43
omganimations.
/**
* omganimations.
*/
.snowflakes
{
height: 3em;
font-size: 2em;
width: 100%;
background-color: #36e;
@marek-saji
marek-saji / colours.sh
Created March 5, 2013 13:49
shell colours
#!/bin/bash
#
# source: http://tldp.org/HOWTO/Bash-Prompt-HOWTO/x329.html
#
# This file echoes a bunch of color codes to the
# terminal to demonstrate what's available. Each
# line is the color code of one forground color,
# out of 17 (default + 16 escapes), followed by a
# test use of that color on all nine background
@marek-saji
marek-saji / .bashrc
Last active December 14, 2015 12:59
Add this to your .bashrc to include current git tag/branch in shell prompt.
PS1_git() {
BRANCH="$( git rev-parse --abbrev-ref HEAD 2>/dev/null )"
BRANCH="$( git describe --abbrev=0 --tags --match="$BRANCH-*" 2>/dev/null || echo "$BRANCH" )"
test -n "$BRANCH" && echo "($BRANCH) "
}
PS1="\[\033[0;34m\]\$( PS1_git )\[\033[0m\]$PS1"
@marek-saji
marek-saji / server.php
Created February 28, 2013 10:23
Run developer's PHP server, but grep-out boring logs about static files.
#!/bin/sh
cd "$( dirname "$0" )/src/public"
echo "\
APPLICATION_ENV=development \
INSTANCE_NAME=crls \
exec php -d max_input_vars=1111 -S 0.0.0.0:8000 2>&1" \
| script /dev/null \
| grep -vP '\[200\]: \/+(image|style|script|logo|theme)'