Skip to content

Instantly share code, notes, and snippets.

View holms's full-sized avatar

Roman Gorodeckij holms

View GitHub Profile
@holms
holms / .Xdefaults
Created February 28, 2013 16:55
~/.Xdefaults for xterm and urxvt.
URxvt.xftAntialias: false
!URxvt.font: xft:Bitstream Vera Sans Mono:pixelsize=10
URxvt.font: xft:Terminal-10
!URxvt*saveLines: 9999
!URxvt*background: #000000
!URxvt*foreground: #ffffbf
!URxvt*scrollBar: False
!URxvt*SaveLines: 2000
!URxvt*loginShell: True
@holms
holms / .tmux.conf
Created March 1, 2013 10:32
my tmux configuration
set-option -g mode-mouse on
set-option -g mouse-resize-pane on
set-option -g mouse-select-pane on
set-option -g mouse-select-window on
set-option -g xterm-keys on
@holms
holms / rsync.sh
Last active December 14, 2015 21:39
rsync don't replace existing files in destination
rsync -av --ignore-existing nova.old/* nova/
@holms
holms / svn2git
Last active December 19, 2015 19:38
Convert / Migrate svn repository to git repository
svn co https://server/svn/repo repo-svn
svn log -q | awk -F '|' '/^r/ {sub("^ ", "", $2); sub(" $", "", $2); print $2" = "$2" <"$2">"}' | sort -u > ../users.txt
git svn clone --stdlayout --no-metadata -A users.txt https://server/svn/repo repo-tmp
# Note that the "--stdlayout" flag implies you have the common "trunk/branches/tags" svn layout. If your layout differs
# become familiar with --tags, --branches, --trunk options
cd repo-tmp
git svn fetch
# skipping branching if interested go here (3rd answer):
# http://stackoverflow.com/questions/79165/how-to-migrate-svn-with-history-to-a-new-git-repository
cd ../
@holms
holms / git-dir2repo.sh
Created July 25, 2013 10:21
Create repository from git subdirectory
git clone /XYZ /ABC # To clone your local repository
cd ABC
git remote rm origin
# only rewrite the HEAD branch and ignore tags and other branches
git filter-branch --tag-name-filter cat --prune-empty --subdirectory-filter subdirectory_to_repo HEAD
# then delete the backup reflogs so the space can be truly reclaimed (although now the operation is destructive)
git reset --hard
git for-each-ref --format="%(refname)" refs/original/ | xargs -n 1 git update-ref -d
git reflog expire --expire=now --all
git gc --aggressive --prune=now
$ /usr/libexec/qemu-kvm -m 256 -drive file=server.img -cdrom some.iso -boot d -net nic -net user -vnc :0
$ ssh -L 5900:127.0.0.1:5900 your_ip_here
@holms
holms / gist:6999632
Created October 15, 2013 22:24
Accessing a raid logical volume from debian
Install lvm2:
$ sudo apt-get install lvm2
Load the necessary module(s):
$ sudo modprobe dm-mod
Scan your system for LVM volumes and identify in the output the volume group name that has your Fedora volume (mine proved to be VolGroup00):
@holms
holms / gist:6999640
Last active December 25, 2015 15:39
Chroot And Mount Raid Or Actual Hard Disk From Rescue Kernel / CD
http://www.cyberciti.biz/faq/centos-rhel-linux-mount-raid-hard-disk-from-livecd/
Note: If you see the error chroot: '/usr/bin/bash': permission denied, remount with the exec permission: mount -o remount,exec /mnt/arch.
@holms
holms / iptables-rules
Created October 22, 2013 15:02
Iptables default rules
#!/bin/bash
#
# iptables example configuration script
#
# Flush all current rules from iptables
#
iptables -F
#
# Allow SSH connections on tcp port 22
# This is essential when working on remote servers via SSH to prevent locking yourself out of the system
@holms
holms / install-chef-solo.sh
Last active November 27, 2017 18:31
install chef-solo and bootstrap a node
#--------------------------------------------------------------------------------------------------------#
# #
# *** Chef repository setup together with chef-solo, knife-solo, libririan-chef and vagrant *** #
# #
# This guide is for people who has around 2-3 vm's (on vps or just dedicated server) with their side #
# project. My intension just to show you, how to create chef repository, and provision your vm's from #
# laptop/desktop without using chef server/client and additional fuss. Also this guide includes vargrant #
# setup just for testing your recipes. #
# -------------------------------------------------------------------------------------------------------#