cd repository
git log --pretty=email --patch-with-stat --reverse -- path/to/file_or_folder > ../patch
cd ../other_repository
git am < ../patch
A place for John to record his techy notes, both to refer back to when needed, and as a help for others...
Monday, July 08, 2013
Copy history from one git repo to another
Thursday, May 02, 2013
Portable, super efficient alternative to seq
Ever missed seq on a non-gnu system (like older Solaris)?
Here's an extremely portable alternative which turns out to be much more efficient too!
yes '' | head -100000 | cat -n
Phil explained that the efficiency is to do with the way that cat does its line numbering (by incrementing the ASCII characters rather than counting numbers and converting them to characters) Thanks Phil!
Wednesday, March 20, 2013
Trash the hard disk on Solaris VM
If you want to wipe out the boot sector on a Solaris x86 VM so a reboot takes you straight into a net boot to rebuild the host... (because often VMWare takes so long for the console to come up that you don't have a chance to hit F12 before it boots the grub loader)
# dd if=/dev/zero of=/dev/dsk/c1t0d0 count=1 bs=512
Linux: Which processes are using the most RAM?
An easy clear way to see which processes are gobbling all the memory:
$ ps -eo pid,vsz,args | sort -k2n
I got the idea from:
http://superuser.com/questions/398862/linux-find-out-what-process-is-using-all-the-ram
Wednesday, December 19, 2012
Sometimes when you want to do something on the web, they insist you give an email address to sign up.
Many of them won't accept addresses from
https://www.guerrillamail.com/
But they MAY accept addresses from:
easy... just point a mailexpire address at a guerrillamail account...
Job done! :-)
Friday, December 14, 2012
VBS script to launch multiple PuTTY sessions
This is to launch parallel PuTTY sessions to a list of hosts, as by the name of their saved PuTTY sessions.
Set objShell = CreateObject("WScript.Shell")
dim hosts
hosts = "host1 host2 host3 host4"
dim host
for each host in split(hosts)
objShell.Exec "C:\Program Files\PuTTY\PUTTY.EXE -load " + host
next
NB: you could use
objShell.Exec "C:\Program Files\PuTTY\PUTTY.EXE username@" + host
instead of
objShell.Exec "C:\Program Files\PuTTY\PUTTY.EXE -load " + host
If you want to log straight into the box without using a saved session
Monday, December 03, 2012
bash command history elements
While you can do
<command> !$
To reuse the last argument of the previous command, you can also use !:n to get the n'th word from the previous command line.
!:0 is the command, the arguments start at index 1.
!* gives ALL of the arguments without the command.
Tuesday, October 09, 2012
Invalidate nscd cache
If you want nscd to forget a database, you can invalidate it so that it gets reloaded next time you query it.
Use:
nscd -i <database>
e.g.:
nscd -i passwd
Wednesday, August 08, 2012
Adding an ACL with chmod
chmod A+user:$USER:write_attributes/write_acl:allow $FILENAME
Look at http://www.cuddletech.com/blog/pivot/entry.php?id=939 for more.
The secret is in the +
Use:
ls -v(a)
To show the existing ACL.