scripts
This commit is contained in:
parent
5f25d1e192
commit
689f7e7db5
8
append_avidemux.sh
Executable file
8
append_avidemux.sh
Executable file
@ -0,0 +1,8 @@
|
||||
DEOCODEC="Xvid"
|
||||
AUDIOCODEC="MP3"
|
||||
dd=`ls *.AVI`
|
||||
avidemux --video-codec $VIDEOCODEC --audio-codec $AUDIOCODEC --force-alt-h264 --load "$dd" --save ${FIL%.*}.avi --quit
|
||||
#for FIL in `ls *.AVI | sort` ; do
|
||||
# echo $FIL
|
||||
# avidemux --video-codec $VIDEOCODEC --audio-codec $AUDIOCODEC --force-alt-h264 --load "$FIL" --save ${FIL%.*}.avi --quit
|
||||
#done
|
10
fast_atan2/Makefile
Normal file
10
fast_atan2/Makefile
Normal file
@ -0,0 +1,10 @@
|
||||
|
||||
|
||||
|
||||
TEST:
|
||||
gcc f_atan2.c -o test -lm
|
||||
./test > test.txt
|
||||
ls -l test.txt
|
||||
vi test.txt
|
||||
echo " try plot 'test.txt' using 8:14 in gnuplot"
|
||||
gnuplot < test.gpt
|
7
fast_atan2/README.txt
Normal file
7
fast_atan2/README.txt
Normal file
@ -0,0 +1,7 @@
|
||||
|
||||
This fast arctan2 seems to be plus or minus 5 degree accuracy
|
||||
for a typical magnitude range as found in the magnetic sense servo.
|
||||
|
||||
Probably OK for use in a game but not when 0.1 degrees accuracy might be required
|
||||
|
||||
22JUN2017
|
59
fast_atan2/f_atan2.c
Normal file
59
fast_atan2/f_atan2.c
Normal file
@ -0,0 +1,59 @@
|
||||
#include <stdio.h>
|
||||
#include <math.h>
|
||||
|
||||
#define PI 3.14159265358979323844
|
||||
|
||||
double angle;
|
||||
double coeff_1 = PI/4.0;
|
||||
double coeff_2 = 3.0*(PI/4.0);
|
||||
double abs_y;
|
||||
|
||||
//-----------------------------------------------
|
||||
// Fast arctan2
|
||||
double arctan2(double y, double x)
|
||||
{
|
||||
double r;
|
||||
//coeff_1 = pi/4;
|
||||
//coeff_2 = 3*coeff_1;
|
||||
abs_y = fabs(y)+1e-10; // kludge to prevent 0/0 condition
|
||||
if (x>=0)
|
||||
{
|
||||
r = (x - abs_y) / (x + abs_y);
|
||||
angle = coeff_1 - coeff_1 * r;
|
||||
}
|
||||
else
|
||||
{
|
||||
r = (x + abs_y) / (abs_y - x);
|
||||
angle = coeff_2 - coeff_1 * r;
|
||||
}
|
||||
if (y < 0)
|
||||
return(-angle); // negate if in quad III or IV
|
||||
else
|
||||
return(angle);
|
||||
}
|
||||
|
||||
|
||||
|
||||
int main() {
|
||||
double x,y,mag;
|
||||
printf("#\n#\n#1 2 3 4 5 6 7 8 9 10 11 12 13 14 \n#\n");
|
||||
|
||||
for (x=-2.0;x<=2.0;x+=0.001) {
|
||||
for(y=-2.0;y<=2.0;y+=0.001) {
|
||||
mag = sqrt(x*x+y*y);
|
||||
if ( mag < 1.6 && mag > 1.4 ) {
|
||||
printf ( " x %f y %f mag %f atan2 %f arctan2 %f diff %f diffdeg %f\n",
|
||||
x,
|
||||
y,
|
||||
sqrt(x*x+y*y),
|
||||
atan2(y,x) * 360.0/(2*PI) ,
|
||||
arctan2(y,x) * 360.0/(2*PI) ,
|
||||
atan2(y,x) - arctan2(y,x),
|
||||
360.0/(2*PI) * (atan2(y,x) - arctan2(y,x) )
|
||||
);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
4
fast_atan2/test.gpt
Normal file
4
fast_atan2/test.gpt
Normal file
@ -0,0 +1,4 @@
|
||||
|
||||
|
||||
plot "test.txt" using 8:14 with lines
|
||||
!sleep 2000
|
28
flac_to_mp3.sh
Executable file
28
flac_to_mp3.sh
Executable file
@ -0,0 +1,28 @@
|
||||
#!/bin/bash
|
||||
|
||||
|
||||
# converts ALAC M4A Apple nonsense files to mp3 and converts spaces and tabs
|
||||
# to underscores in the file names.
|
||||
|
||||
# people who put spaces in files names should be put in poorly supplied
|
||||
# penal colonies along with pedos and terrorists.
|
||||
|
||||
SAVEIFS=$IFS
|
||||
IFS=$(echo -en "\n\b")
|
||||
for f in *.flac
|
||||
do
|
||||
echo " f " $f
|
||||
u=`echo $f | sed 's/[ ]/_/g'`
|
||||
echo u is $u remove all those stupid spaces in filenames
|
||||
cp $f $u
|
||||
t=`echo $u | sed 's/flac$/mp3/'`
|
||||
ls -l \'$u\'
|
||||
echo dollar u: $u becomes dollar t: $t
|
||||
echo "PROCESSING: " avconv -i \'$f\' -f mp3 $t
|
||||
avconv -analyzeduration 20000000 -i $u -qscale:a 0 -f mp3 output.mp3
|
||||
echo -------------------------- CONVERTED $f
|
||||
ls -l output.mp3
|
||||
mv output.mp3 $t
|
||||
rm -rf $u
|
||||
done
|
||||
IFS=$SAVEIFS
|
7
flip_horizontal
Executable file
7
flip_horizontal
Executable file
@ -0,0 +1,7 @@
|
||||
fred=`ls *.[jJ][Pp][Gg]`
|
||||
|
||||
for l in $fred
|
||||
do
|
||||
convert $l -flop AF_$l
|
||||
echo $l to AF_$l
|
||||
done
|
20
heater_model.gpt
Normal file
20
heater_model.gpt
Normal file
@ -0,0 +1,20 @@
|
||||
set xrange[0:4096]
|
||||
set yrange[0:15]
|
||||
|
||||
set xlabel "DAC demand in millivolts (inverted i.e. 4096-demand)"
|
||||
set ylabel "Output voltage from LM2676 current source"
|
||||
|
||||
R1 = 10000
|
||||
R2 = 2200
|
||||
R3 = 1500
|
||||
|
||||
f(x) = - (R1 * ( 1.2/R2 - ((x/1000.0)-1.2)/R3 ) + 1.2)
|
||||
|
||||
plot f(x)
|
||||
!sleep 20
|
||||
|
||||
set terminal png
|
||||
set output "heater_lm2676_fb.png"
|
||||
|
||||
plot f(x)
|
||||
|
4
join_avi_files.sh
Executable file
4
join_avi_files.sh
Executable file
@ -0,0 +1,4 @@
|
||||
|
||||
ff=`ls *.AVI`
|
||||
|
||||
mencoder -oac copy -ovc copy -idx -o output.avi $ff
|
7
join_avi_mencoder.sh
Executable file
7
join_avi_mencoder.sh
Executable file
@ -0,0 +1,7 @@
|
||||
|
||||
|
||||
|
||||
ff=`ls *.AVI`
|
||||
|
||||
|
||||
mencoder -oac copy -ovc copy -idx -o output.avi $ff
|
27
m4a_to_flac.sh
Executable file
27
m4a_to_flac.sh
Executable file
@ -0,0 +1,27 @@
|
||||
#!/bin/bash
|
||||
|
||||
|
||||
# converts ALAC M4A Apple nonsense files to mp3 and converts spaces and tabs
|
||||
# to underscores in the file names.
|
||||
|
||||
# people who put spaces in files names should be put in poorly supplied
|
||||
# penal colonies along with pedos and terrorists.
|
||||
|
||||
SAVEIFS=$IFS
|
||||
IFS=$(echo -en "\n\b")
|
||||
for f in *.m4a
|
||||
do
|
||||
echo " dollar f is " $f
|
||||
u=`echo $f | sed 's/[ ]/_/g'`
|
||||
echo u is $u remove all those stupid spaces in filenames
|
||||
cp $f $u
|
||||
t=`echo $u | sed 's/m4a$/flac/'`
|
||||
ls -l \'$u\'
|
||||
echo dollar u: $u becomes dollar t: $t
|
||||
echo "PROCESSING: " avconv -i \'$f\' -f mp3 $t
|
||||
avconv -i $u -f flac output.flac
|
||||
echo -------------------------- CONVERTED $f
|
||||
mv output.flac $t
|
||||
rm -rf $u
|
||||
done
|
||||
IFS=$SAVEIFS
|
28
m4a_to_mp3.sh
Executable file
28
m4a_to_mp3.sh
Executable file
@ -0,0 +1,28 @@
|
||||
#!/bin/bash
|
||||
|
||||
|
||||
# converts ALAC M4A Apple nonsense files to mp3 and converts spaces and tabs
|
||||
# to underscores in the file names.
|
||||
|
||||
# people who put spaces in files names should be put in poorly supplied
|
||||
# penal colonies along with pedos and terrorists.
|
||||
|
||||
SAVEIFS=$IFS
|
||||
IFS=$(echo -en "\n\b")
|
||||
for f in *.m4a
|
||||
do
|
||||
echo " dollar f is " $f
|
||||
u=`echo $f | sed 's/[ ]/_/g'`
|
||||
echo u is $u remove all those stupid spaces in filenames
|
||||
cp $f $u
|
||||
t=`echo $u | sed 's/m4a$/mp3/'`
|
||||
ls -l \'$u\'
|
||||
echo dollar u: $u becomes dollar t: $t
|
||||
echo "PROCESSING: " avconv -i \'$f\' -f mp3 $t
|
||||
#avconv -i $u -qscale:a 0 -f mp3 output.mp3
|
||||
avconv -i $u -f mp3 output.mp3
|
||||
echo -------------------------- CONVERTED $f
|
||||
mv output.mp3 $t
|
||||
rm -rf $u
|
||||
done
|
||||
IFS=$SAVEIFS
|
28
m4a_to_ogg.sh
Executable file
28
m4a_to_ogg.sh
Executable file
@ -0,0 +1,28 @@
|
||||
#!/bin/bash
|
||||
|
||||
|
||||
# converts ALAC M4A Apple nonsense files to mp3 and converts spaces and tabs
|
||||
# to underscores in the file names.
|
||||
|
||||
# people who put spaces in files names should be put in poorly supplied
|
||||
# penal colonies along with pedos and terrorists.
|
||||
|
||||
SAVEIFS=$IFS
|
||||
IFS=$(echo -en "\n\b")
|
||||
for f in *.m4a
|
||||
do
|
||||
echo " dollar f is " $f
|
||||
u=`echo $f | sed 's/[ ]/_/g'`
|
||||
echo u is $u remove all those stupid spaces in filenames
|
||||
cp $f $u
|
||||
t=`echo $u | sed 's/m4a$/ogg/'`
|
||||
ls -l \'$u\'
|
||||
echo dollar u: $u becomes dollar t: $t
|
||||
echo "PROCESSING: " avconv -i \'$f\' -f mp3 $t
|
||||
#avconv -i $u -qscale:a 0 -f mp3 output.mp3
|
||||
avconv -i $u -f ogg output.ogg
|
||||
echo -------------------------- CONVERTED $f
|
||||
mv output.ogg $t
|
||||
rm -rf $u
|
||||
done
|
||||
IFS=$SAVEIFS
|
13
make_pdfs_from_odt.sh
Executable file
13
make_pdfs_from_odt.sh
Executable file
@ -0,0 +1,13 @@
|
||||
#!/bin/bash
|
||||
|
||||
#fred=`ls *.odt`
|
||||
#
|
||||
#for l in $fred
|
||||
#do
|
||||
#echo $l
|
||||
#p=`echo $l | sed 's/.odt//'`
|
||||
#ooconvert --force $p.odt $p.pdf
|
||||
#done
|
||||
|
||||
libreoffice --headless --convert-to pdf:writer_pdf_Export *.odt
|
||||
|
2
my_diff.sh
Executable file
2
my_diff.sh
Executable file
@ -0,0 +1,2 @@
|
||||
kompare "$2" "$5"
|
||||
|
9
resize.sh
Executable file
9
resize.sh
Executable file
@ -0,0 +1,9 @@
|
||||
|
||||
|
||||
|
||||
fred=`ls *.[jJ][Pp][Gg]`
|
||||
|
||||
for l in $fred
|
||||
do
|
||||
convert $l -resize 50% -quality 60 AA_$l
|
||||
done
|
15
simmning/sim.awk
Normal file
15
simmning/sim.awk
Normal file
@ -0,0 +1,15 @@
|
||||
|
||||
|
||||
|
||||
BEGIN { FS = ":"; old_tid = 0.0; }
|
||||
|
||||
{
|
||||
#print "min",$1,"sec",$2,"msec",$3
|
||||
tid = 60*($1);
|
||||
tid += $2;
|
||||
tid *= 1000.0;
|
||||
tid += $3;
|
||||
#print tid;
|
||||
print NR, tid - old_tid, (tid - old_tid) / 1000.0;
|
||||
old_tid = tid;
|
||||
}
|
4
simmning/sim.gpt
Normal file
4
simmning/sim.gpt
Normal file
@ -0,0 +1,4 @@
|
||||
|
||||
|
||||
plot "sim.dat" using 1:3 with lines
|
||||
!sleep 20
|
6
simmning/sim.sh
Executable file
6
simmning/sim.sh
Executable file
@ -0,0 +1,6 @@
|
||||
|
||||
|
||||
|
||||
cat simmning_siffror.txt | sed 's/,/:/' > dd.txt
|
||||
cat dd.txt | awk -f sim.awk > sim.dat
|
||||
gnuplot < sim.gpt
|
25
simmning/simmning_siffror.txt
Normal file
25
simmning/simmning_siffror.txt
Normal file
@ -0,0 +1,25 @@
|
||||
00:58,780
|
||||
2:26,270
|
||||
3:53,340
|
||||
5:17,290
|
||||
6:40,810
|
||||
8:05,020
|
||||
9:27,180
|
||||
10:49,120
|
||||
12:05,500
|
||||
13:27,560
|
||||
14:44,270
|
||||
16:02,520
|
||||
17:22,080
|
||||
18:47,000
|
||||
20:05,000
|
||||
21:25,060
|
||||
22:42,980
|
||||
24:03,270
|
||||
25:13,940
|
||||
26:38,570
|
||||
27:59,240
|
||||
29:18,500
|
||||
30:28,600
|
||||
31:51,290
|
||||
32:58,940
|
60
vimrc.vimrc
Normal file
60
vimrc.vimrc
Normal file
@ -0,0 +1,60 @@
|
||||
|
||||
"
|
||||
" go back to command mode
|
||||
" as soon as a curcor key is pressed
|
||||
"
|
||||
inoremap <left> <esc><left>
|
||||
inoremap <right> <esc><right>
|
||||
inoremap <up> <esc><up>
|
||||
inoremap <down> <esc><down>
|
||||
|
||||
set nu
|
||||
set hlsearch
|
||||
set incsearch
|
||||
|
||||
"
|
||||
"
|
||||
" from vim forum http://vim.wikia.com/wiki/Show_fileencoding_and_bomb_in_the_status_line
|
||||
"
|
||||
if has("statusline")
|
||||
set statusline=%<%f\ %h%m%r%=%{\"[\".(&fenc==\"\"?&enc:&fenc).((exists(\"+bomb\")\ &&\ &bomb)?\",B\":\"\").\"]\ \"}%k\ %-14.(%l,%c%V%)\ %P
|
||||
endif
|
||||
|
||||
" ~/.vimrc (configuration file for vim only)
|
||||
" skeletons
|
||||
function! SKEL_spec()
|
||||
0r /usr/share/vim/current/skeletons/skeleton.spec
|
||||
language time en_EN
|
||||
if $USER != ''
|
||||
let login = $USER
|
||||
elseif $LOGNAME != ''
|
||||
let login = $LOGNAME
|
||||
else
|
||||
let login = 'unknown'
|
||||
endif
|
||||
let newline = stridx(login, "\n")
|
||||
if newline != -1
|
||||
let login = strpart(login, 0, newline)
|
||||
endif
|
||||
if $HOSTNAME != ''
|
||||
let hostname = $HOSTNAME
|
||||
else
|
||||
let hostname = system('hostname -f')
|
||||
if v:shell_error
|
||||
let hostname = 'localhost'
|
||||
endif
|
||||
endif
|
||||
let newline = stridx(hostname, "\n")
|
||||
if newline != -1
|
||||
let hostname = strpart(hostname, 0, newline)
|
||||
endif
|
||||
exe "%s/specRPM_CREATION_DATE/" . strftime("%a\ %b\ %d\ %Y") . "/ge"
|
||||
exe "%s/specRPM_CREATION_AUTHOR_MAIL/" . login . "@" . hostname . "/ge"
|
||||
exe "%s/specRPM_CREATION_NAME/" . expand("%:t:r") . "/ge"
|
||||
setf spec
|
||||
endfunction
|
||||
autocmd BufNewFile *.spec call SKEL_spec()
|
||||
" filetypes
|
||||
filetype plugin on
|
||||
filetype indent on
|
||||
" ~/.vimrc ends here
|
Loading…
Reference in New Issue
Block a user