Wednesday, November 12, 2014

Notes to myself.

Using a blog to keep miscellaneous notes is a wonderful idea.  They should be always there.

# original install
ls -l /var/log/installer

# uptime

# Quicknote (goes into .bash_history)
cat > filename <<EOF

# Quick append (goes into .bash_history)
cat >> filename <<EOF

#Gif to avi
convert test.gif old%02d.jpg
ffmpeg -r 25 -i old%02d.jpg -y -an new.avi

# Strip music
mplayer -ao pcm:fast:file=batmanpiano.mp3 -vo null -vc null Batmanpiano.flv

# get screen size
$ fullscreen=$(xwininfo -root | grep 'geometry' | awk '{print $2;}')
$ echo $fullscreen

# put picures in frame
montage Inputfiles outputfile

# Get video no sound

avconv -f alsa -i pulse -f x11grab -r 30 -s 1280*720 -i :0.0 -vcodec libx264 -preset ultrafast -ab 320k -threads 8 screen.mkv

# remove shopping crap
$ sudo apt-get remove unity-scope-home

#Create the pictures:

$ ffmpeg -i PICT0220.AVI -r 1 -f image2 %05d.png

The pictures should all be the same size as they came from a movie.

Now let's make an animated gif

$ convert -delay 100 *.png hand.gif

Split out gif and reassemble at a slower speed.

convert a.gif %02d.png
convert -delay 6 -loop 0 *.png animation.gif

Note: check the documentation for the programs to get more possibilities.

Gifs to avi

convert test.gif old%02d.jpg
ffmpeg -r 25 -i old%02d.jpg -y -an new.avi

run qemu on 64 bit
qemu-system-x86_64 -m 512 -fda testdisk.img

# How to convert to/from DOS format in VIM…
By Matt Fahrner, on October 9th, 2008

It’s very easy, but also easy to forget how to convert to or from a DOS format file in Unix using “vim” (Vi iMproved), the Open Source “vi”. If the file is in DOS format and you want to convert to Unix, use the command:

:set ff=unix

note that “ff” is an abreviation for “fileformat” which you can also use.

If the file is Unix and you want to write DOS format, use the following command:

:set ff=dos

In both examples it is assuming you are ESCaped out of edit mode and the leading “:” is required.

Note that the difference between the two formats is that:

    DOS format ends each line with a CRLF (carriage-return line-feed) pair.
    Unix format ends each line with a simple LF (line feed).

Neither of these forms should be confused with the C language string delimiter ‘NUL’ which is an ASCII “zero”. That however is an entirely different subject.

# cdrom burning
wodim -devices
wodim: Overview of accessible drives (1 found) :
 0  dev='/dev/sg1'    rwrw-- : 'HL-DT-ST' 'DVD-RW GWA-4082N'
$ wodim -eject -tao speed=0 dev=/dev/sg1 -v -data debian-7.6.0-i386-netinst.iso
TOC Type: 1 = CD-ROM
wodim: Operation not permitted. Warning: Cannot raise RLIMIT_MEMLOCK limits.
scsidev: '/dev/sg1'
devname: '/dev/sg1'
scsibus: -2 target: -2 lun: -2
Linux sg driver version: 3.5.34
Wodim version: 1.1.11
SCSI buffer size: 64512
Device type    : Removable CD-ROM
Version        : 5
Response Format: 2
Capabilities   :
Vendor_info    : 'HL-DT-ST'
Identification : 'DVD-RW GWA-4082N'
Revision       : 'CC15'
Device seems to be: Generic mmc2 DVD-R/DVD-RW.

#bash to create web pages
#pdfs to html
ls *.pdf > pdflista
cut -d "." -f1 filenames > descripts
sed -i -e 's/^/<a href=\"/' pdflista
paste pdflista descripts > pdflista.html
sed -i 's/$/"\>\<\/a\>/' pdflista.html
sed -i 's/$/\<br \/\>/' pdflista.html

#pics to html
# daffinitions
ls *.png > picdatafile
m="not done"
d=" "

#read the file
while read line
do fdata[$a]=$line
        let a=a+1
done < $datafile
# top
echo "<html>" > $htmlfile
echo "<body>" >> $htmlfile
echo "<h2><center>Picture list</center></h2>" >> $htmlfile
echo "<hr>" >> $htmlfile

echo "<center>" >> $htmlfile
echo "<table border="10">" >> $htmlfile

# middle
for (( COUNTER=1; COUNTER<=$a; COUNTER+=3 )); do
echo "<tr>" >> $htmlfile
       for i in `seq 0 2`;
         echo "<td>" >> $htmlfile
         d=`echo ${fdata[$i+$COUNTER]} | sed 's/\([^\.]*\)\..*/\1/'`
         theline='<img src="'${fdata[$i+$COUNTER]}'" alt="'${d}'" width="300" height="300" hspace="20" vspace="20">'
         echo "$theline" >> $htmlfile
         echo "</td>" >> $htmlfile
echo "</tr>" >> $htmlfile
echo "<br />" >> $htmlfile

echo "</table>" >> $htmlfile
echo "</center>" >> $htmlfile

#  bottom
echo "</body>" >> $htmlfile
echo "</html>" >> $htmlfile

# pxeboot scripts
# openbsd pxeboot script
dhcp auto
kernel -n img iso
initrd -n img
boot img

#netbsd in progress
dhcp net0


# local dns file setup
sudo vim /etc/resolvconf/resolv.conf.d/base
sudo resolvconf  -u

#vim cheats
select                                   v                                    
select row(s)                            SHIFT + v                            
select blocks (columns)                  CTRL  + v                            
indent selected text                     >                                    
unindent selected text                   <                                    
list buffers                             :ls                                  
open buffer                              :bN (N = buffer number)              
print                                    :hardcopy                            
open a file                              :e /path/to/file.txt                 
                                         :e C:\Path\To\File.txt               
sort selected rows                       :sort                                
search for word under cursor             *                                    
open file under cursor                   gf                                   
  (absolute path or relative)                                                 
format selected code                     =                                    
select contents of entire file           ggVG                                 
convert selected text to uppercase       U                                    
convert selected text to lowercase       u                                    
invert case of selected text             ~                                    
convert tabs to spaces                   :retab                               
start recording a macro                  qX (X = key to assign macro to)      
stop recording a macro                   q                                      
playback macro                           @X (X = key macro was assigned to)   
replay previously played macro *         @@                                   
auto-complete a word you are typing **   CTRL + n                             
bookmark current place in file           mX (X = key to assign bookmark to)   
jump to bookmark                         `X (X = key bookmark was assigned to 
                                             ` = back tick/tilde key)         
show all bookmarks                       :marks                               
delete a bookmark                        :delm X (X = key bookmark to delete)  
delete all bookmarks                     :delm!                                
split screen horizontally                :split                               
split screen vertically                  :vsplit                              
navigating split screens                 CTRL + w + j = move down a screen    
                                         CTRL + w + k = move up a screen      
                                         CTRL + w + h = move left a screen    
                                         CTRL + w + l = move right a screen   
close all other split screens            :only                                

*  - As with other commands in vi, you can playback a macro any number of times.
     The following command would playback the macro assigned to the key `w' 100
     times: 100@w

** - Vim uses words that exist in your current buffer and any other buffer you
     may have open for auto-complete suggestions.

No comments:

Post a Comment