-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnotes.txt
624 lines (460 loc) · 16.2 KB
/
notes.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
#!/bin/bash
# rand-string.sh
# Generating an 8-character "random" string.
if [ -n "$1" ] # If command-line argument present,
then #+ then set start-string to it.
str0="$1"
else # Else use PID of script as start-string.
str0="$$"
fi
POS=2 # Starting from position 2 in the string.
LEN=8 # Extract eight characters.
str1=$( echo "$str0" | md5sum | md5sum )
# Doubly scramble ^^^^^^ ^^^^^^
#+ by piping and repiping to md5sum.
randstring="${str1:$POS:$LEN}"
# Can parameterize ^^^^ ^^^^
echo "$randstring"
exit $?
# bozo$ ./rand-string.sh my-password
# 1bdd88c4
# No, this is is not recommended
#+ as a method of generating hack-proof passwords.
--------------------------------------
# You might want to convert your return statement to an echo statement - that way your function output could be captured using $() braces, which seems to be exactly what you want.
#
# Here is an example:
#
# function fun1(){
# echo 34
# }
#
# function fun2(){
# local res=$(fun1)
# echo $res
# }
# Another way to get the return value (if you just want to return an integer 0-255) is $?.
#
# function fun1(){
# return 34
# }
#
# function fun2(){
# fun1
# local res=$?
# echo $res
# }
# Also, note that you can use the return value to use boolean logic like fun1 || fun2 will only run fun2 if fun1 returns a 0 value. The default return value is the exit value of the last statement executed within the function.
# ------------------------
# The return statement sets the exit code of the function, much the same as exit will do for the entire script.
#
# The exit code for the last command is always available in the $? variable.
#
# function fun1(){
# return 34
# }
#
# function fun2(){
# local res=$(fun1)
# echo $? # <-- Always echos 0 since the 'local' command passes.
#
# res=$(fun1)
# echo $? #<-- Outputs 34
# }
-------------------
local message="$1"
if [ "$message" == "" ]; then
#nincs message -> csinalunk
a=`date +%Y-%m-%d-%H-%M-%S`
b=`whoami`
message="${a}-${b}"
echo "message:" $message
#else
#van message -> azt hasznaljuk
fi
-----------------
background and no rinya for short tasks
ConEmu64.exe ${WGPATH}/mtool/bat/moka.bat -new_console:bn
ez a jo szerintem
start ConEmu64.exe -run ${MBAT}/moka.bat -new_console:nb
-------------------------
# get changed files list and remove files that should be ignored
CHANGED=$(git diff --name-only $LAST_COMMIT HEAD | grep -vf ignore.txt)
echo $CHANGED
---------------
m.typeintree $PWD png | xargs -L 1 -d '\n' vleff.sh
nem kell a delimiter
m.typeintree $PWD png | xargs -L 1 vleff.sh
viszont -r hogy ures sorra ne fusson
m.typeintree $PWD png | xargs -r -L 1 vleff.sh
-t echoes the assembled command GREAT DEBUG feature!!
m.typeintree $PWD png | xargs -t -r -L 1 vleff.sh pina
and generates command:
vleff.sh pina /q/Work/tropenzorg/3d/Scene/deetpack/Texture/uvlayout.png
<list generator> | xargs -r -L 1 <exe> <exe_arg1> <exe_arg2>
fantastic pseudo code:
foreach line in <list generator>
run <exe> <exe_arg1> <exe_arg2> line
-------------------------------
pipe to shell scripts
If the external program (that you are scripting) already takes input from stdin, your script does not need to do anything. For example, awk reads from stdin, so a short script to count words per line:
#!/bin/sh
awk '{print NF}'
Then
./myscript.sh <<END
one
one two
one two three
END
outputs
1
2
3
----
check to ensure there is stdin first, and if not, then use a command line argument instead if given.
#!/bin/bash
# Check to see if a pipe exists on stdin.
if [ -p /dev/stdin ]; then
echo "Data was piped to this script!"
# If we want to read the input line by line
while IFS= read line; do
echo "Line: ${line}"
done
# Or if we want to simply grab all the data, we can simply use cat instead
# cat
else
echo "No input was found on stdin, skipping!"
# Checking to ensure a filename was specified and that it exists
if [ -f "$1" ]; then
echo "Filename specified: ${1}"
echo "Doing things now.."
else
echo "No input given!"
fi
fi
------------------------------
find $PWD | xargs -n1
-------------------
>runcomp.bat a:\mlnworkgroup\mtool\_tmp\0408217275_.comp 1 1 1
"c:\Program Files\Blackmagic Design\Fusion Render Node 16\FusionRenderNode.exe" a:\mlnworkgroup\mtool\_tmp\0408217275_.comp -render -start 1 -end 1 -step 1 -pri high -quiet -quit
atnevezem .compra es lerendereli... ^^^
---
>/dev/null 2>&1;
silence to devnull
---
exactly the string -
.
beginning
...
spearator
.
substitute
.
s!BBB-aaaCClllccEEE!uu!p
echo "US/Central - 10:26 PM (CST)" | sed -n "s/^.*-\s*\(\S*\).*$/\1/p"
-n suppress printing -> only prints the match
s substitute
^.* anything at the beginning
- up until the dash
\s* any space characters (any whitespace character)
\( start capture group
\S* any non-space characters
\) end capture group
.*$ anything at the end
\1 substitute 1st capture group for everything on line
p print it
-------------
dictionary locally declared and passed on ... wonderful
m.roff(){
# add new stuff
sounds[malac]="roff";
# and use it
echo "ugatas ${sounds[dog]}";
}
m.dictdemo(){
# create
declare -A sounds;
# add
sounds[dog]="vau";
echo "ugatas ${sounds[dog]}";
# call a function that can use the dict
m.rof;
echo "rofoges ${sounds[malac]}";
#print all
echo ${sounds[@]};
# destroy
unset -v sounds;
echo ${sounds[@]};
}
------------------
exporting functions
list of variables exported
export -p > ebbe.txt
list of exported funcs
declare -x -F
exp funcs and code
declare -x -f
------------------------------
import hashlib, time
def generate_uid(node):
hash = hashlib.md5()
hash.update(node.path() + str(time.time()))
node.setUserData('uid', hash.hexdigest()[:10])
# To get the value:
node.userData.get('uid')
-----
multiple conditions
function kuka() {
local k="${1}";
local n="${2}";
if [[ ( "$k" -eq 1 && "$n" = "11" ) || ( "$k" -eq 2 && "$n" = "fos" ) ]]; then
echo "megvan";
else
echo "nincs meg";
fi
}
-----------------
submit comp to network manager - worx - LUA
fuscript.exe -l lua -i
fu = Fusion("192.168.0.15")
dump(fu:GetAttrs())
res =fu:QueueComp({ FileName = [[q:\Work\snap\Comp\box60ml_label_corrector.comp]], QueuedBy = "Bob Lloblaw", Start = 1, End = 2, Step = 1 });
print(res) --> ami egy renderjob submittolva RenderJob
---
ugyanez python
fu = bmd.scriptapp("Fusion")
fu.QueueComp({
"FileName": "q:\\Work\\snap\\Comp\\box60ml_label_corrector.comp",
"QueuedBy": "bub",
"Start": 1,
"End": 25,
"Step": 5,
"ProxyScale": 2
})
fu = bmd.scriptapp("Fusion")
fu.QueueComp({"FileName": "q:\\Work\\snap\\Comp\\box60ml_label_corrector.comp", "Start": 1,"End": 25, "Step": 5 })
---------------------
FRAME SAVED SCRIPT - single file no seq - FUSION
path, name = string.match(filename, "^(.+[/\\])(.+)")
name, extension = string.match(name, "^(.+)(%..+)$")
barename, sequence = string.match(name, "^(.-)(%d+)$")
print("bare:"..barename..extension)
os.remove(path..barename..extension)
os.rename(filename, path..barename..extension)
os.remove(filename)
--------------------
auses all images on the image stack to be output
igy irod ki az osszeset - write all from stack
oiiotool multi.tif -sisplit -o:all=1 sub%04d.tif
--
R, G, B, A, Z_noice, N_noice.Y, N_noice.Z, N_noice.X, denoise_albedo_noice.R, denoise_albedo_noice.G, denoise_albedo_noice.B
-ch R, G, B, A, Z_noice, N_noice.Y, N_noice.Z, N_noice.X, denoise_albedo_noice.R, denoise_albedo_noice.G, denoise_albedo_noice.B, variance.R=1, variance.G=1, variance.B=1, variance.A=1
oiiotool.exe -i cpuoutuj.exr --ch variance.R=1,variance.G=1,variance.B=1,variance.A=1 -o vch.exr
oiiotool.exe -i gpuout.exr --ch R,G,B,A,Z_noice,N_noice.Y,N_noice.Z,N_noice.X,denoise_albedo_noice.R,denoise_albedo_noice.G,denoise_albedo_noice.B -o pimped.exr
erase all metadata
--eraseattrib ".*"
-------------------------
WGPATH a:\mlnworkgroup
--ch variance.R=R,variance.G=G,variance.B=B,variance.A=1
ebbe mar csak a meta kell!!!
oiiotool.exe -i kamuvar.exr --ch variance.R=R,variance.G=G,variance.B=B,variance.A=1 gpuout.exr --chappend -o chkamuvar.exr
oiiotool.exe -i kamuvar.exr --ch variance.R=R,variance.G=G,variance.B=B,variance.A=1 gpuout.exr --chappend --nosoftwareattrib --attrib "arnold/aovs/variance/filter" "variance_filter" --attrib "arnold/aovs/variance/filter_width" 2 --attrib "arnold/aovs/variance/lpe" 1 --attrib "arnold/aovs/variance/lpe_expression" "C.*" --attrib "arnold/aovs/variance/source" "RGBA" --attrib "arnold/aovs/RGBA/filter" "gaussian_filter" --attrib "arnold/aovs/RGBA/filter_width" 2 --attrib "arnold/aovs/RGBA/lpe" 1 --attrib "arnold/aovs/RGBA/lpe_expression" "C.*" --attrib "arnold/aovs/RGBA/source" "RGBA" -o chkamuvar.exr
-------------------
render a cpu image for proper arnold metadata:
orig_cpu_meta.exr
make it one empty channel (K) -> this is the master that contains the metadata
oiiotool.exe -i orig_cpu_meta.exr --ch K=0 --nosoftwareattrib -o only_meta.exr
gpu beauty + laplacian --abs is to abs() the result
oiiotool.exe -i gpuout.exr --ch variance.R=R,variance.G=G,variance.B=B,variance.A=1 --laplacian --abs --nosoftwareattrib --eraseattrib ".*" -o gpu_laplacian_abs.exr
append variance to gpu render
oiiotool.exe -i gpu_laplacian_abs.exr gpuout.exr --chappend --nosoftwareattrib --eraseattrib ".*" -o vared.exr
add metadata - the image size is determined by the first input - meta image is small...
oiiotool.exe -i vared.exr only_meta.exr --metamerge --chappend --nosoftwareattrib -o metaed.exr
feed noice!
noice.exe -i metaed.exr -o dnmetaed.exr
oiiotool.exe -i orig_cpu_meta.exr --ch K=0 --nosoftwareattrib -o only_meta.exr
oiiotool.exe -i gpuout.exr --ch variance.R=R,variance.G=G,variance.B=B,variance.A=1 --laplacian --abs --nosoftwareattrib --eraseattrib ".*" -o gpu_laplacian_abs.exr
oiiotool.exe -i gpu_laplacian_abs.exr gpuout.exr --chappend --nosoftwareattrib --eraseattrib ".*" -o vared.exr
oiiotool.exe -i vared.exr only_meta.exr --metamerge --chappend --nosoftwareattrib -o metaed.exr
noice.exe -i metaed.exr -o dnmetaed.exr
--
Contrast enhancement: stretch pixel value range to exactly fit [0-1]
oiiotool input.tif -subc {TOP.MINCOLOR} -divc {TOP.MAXCOLOR} -o out.tif
---
python puska
# sampling quality => hi or lo
if smpQuality == "lo":
rop1.parm("ar_enable_adaptive_sampling").set(False)
rop2.parm("ar_enable_adaptive_sampling").set(False)
rop3.parm("ar_enable_adaptive_sampling").set(False)
rop4.parm("ar_enable_adaptive_sampling").set(False)
_msg("sampling quality: lo")
else:
rop1.parm("ar_enable_adaptive_sampling").set(True)
rop2.parm("ar_enable_adaptive_sampling").set(True)
rop3.parm("ar_enable_adaptive_sampling").set(True)
rop4.parm("ar_enable_adaptive_sampling").set(True)
_msg("sampling quality: hi")
#_msg("outScale " + outScale)
resfrac = "1"
if outScale == "2":
resfrac = "0.5"
if outScale == "4":
resfrac = "0.25"
if outScale == "8":
resfrac = "0.125"
_msg("resolution fraction: " + resfrac)
if outScale == "1":
rop1.parm("override_camerares").set(False)
rop2.parm("override_camerares").set(False)
rop3.parm("override_camerares").set(False)
rop4.parm("override_camerares").set(False)
# rop1.parm("res_fraction").set("0.5")
# rop2.parm("res_fraction").set("0.5")
# rop3.parm("res_fraction").set("0.5")
# rop4.parm("res_fraction").set("0.5")
else:
rop1.parm("override_camerares").set(True)
rop2.parm("override_camerares").set(True)
rop3.parm("override_camerares").set(True)
rop4.parm("override_camerares").set(True)
rop1.parm("res_fraction").set(resfrac)
rop2.parm("res_fraction").set(resfrac)
rop3.parm("res_fraction").set(resfrac)
rop4.parm("res_fraction").set(resfrac)
#rop1.parm("override_camerares").set(False)
#rop1.parm("res_fraction").set("0.5")
# rop1.parm("override_camerares").set(False)
# rop1.parm("ar_enable_adaptive_sampling").set(True)
# rop2.parm("override_camerares").set(False)
# rop2.parm("ar_enable_adaptive_sampling").set(True)
# rop3.parm("override_camerares").set(False)
# rop3.parm("ar_enable_adaptive_sampling").set(True)
# rop4.parm("override_camerares").set(False)
# rop4.parm("ar_enable_adaptive_sampling").set(True)
# _msg("render is half res")
# _msg(" ")
---
# _msg("rop1 params ")
# for parm in rop1.allParms():
# _msg( parm.path() + " " + str(parm.eval()))
# onrop = rop1.parm("override_camerares").eval()
# keepRes = False
# _msg(" onrop:" + str(onrop))
# if ( outScale == "1" and onrop == 0 ):
# keepRes = True
# _msg("keep res: " + str(keepRes))
--
prompt
function m.title() {
if [[ -z "$ORIG" ]]; then
ORIG=$PS1
fi
TITLE="\[\e]2;$*\a\]"
PS1=${ORIG}${TITLE}
}
-------------------
function m.fstore() {
filedata[${#filedata[@]}]=$1
}
# 0 - OK - do nothing
# 1 - empty path - nonfixable
# 2 - no extension - nonfixable
# 3 - fixable - fix it!
m.dfile() {
local isnic=0;
local n="${1}";
local fnoext="${n%.*}"; # no ext
local ffile="${n##*/}"; # full filename
local fdir="${n%/*}"; # directory part
local parent=${fdir##*/} # parent
local vext=$(m.vfxext "${ffile}");
local vname=${ffile%"${vext}"};
# cannot handle case
if [[ ${#n} == 0 ]]; then
#echo "ERR wtf, empty file to check for nice...";
return 1; # don't work with empty path
fi
# cannot handle case
# zero dots?
local fdot=$(m.dotcount "{$ffile}");
if [[ $fdot == 0 ]]; then
#echo "SKIP file with no extension ${n}"
return 2; # well valid, don't touch it!
fi
# dots > 2 ?
local dots=$(m.dotcount "${vname}");
if [[ $dots > 0 ]]; then
isnic=3;
fi
# white space?
local hasws=0;
m.hasws "${vname}";
if [[ $? == 1 ]]; then
isnic=3;
hasws=1;
fi
MVRB=1;
if [[ $MVRB == 1 ]]; then
echo " orig ${n}";
echo " dir ${fdir}";
echo " no ext ${fnoext}";
echo " parent ${parent}";
echo " full file ${ffile}";
echo " vfx name ${vname}";
echo " vfx ext ${vext}";
echo " is nice ${isnic}";
echo " has ws ${hasws}";
echo " dots ${dots}";
fi
m.fstore $fdir;
m.fstore $vname;
m.fstore $vext;
return $isnic;
}
m.isfixable(){
m.dfile "${1}";
local res=$?;
echo "dfile res:${res}----${1}";
if [[ $res == 3 ]]; then
return 0; #fixable
fi
if [[ $res == 0 ]]; then
return 1; #ok
else
return 1; #unfixable 1 and 2
fi
}
m.fix2nice(){
declare -a -g filedata;
local fn="${1}";
#echo "${fn}";
local np="";
m.isfixable "${fn}";
#echo "${fn}";
local res=$?;
#echo "[res:${res}][${filedata[0]}][${filedata[1]}][${filedata[2]}]";
local vname="${filedata[1]}";
echo "vn-(${vname})";
if [[ ${res} == 0 ]]; then
echo "fixable ${fn}";
vname=${filedata[1]};
np=$(m.tonice "${vname}");
echo "javitott[${np}]";
echo ' '
fi
unset -v filedata;
}
------------
spatr=$(basename ${inputfile});
REPLACE . with "" nothing
spatr=$(echo "dn_${spatr}" | sed 's|\.||g');
----
string contains
string='My long string'
if [[ $string == *"My long"* ]]; then
echo "It's there!"
fi
-------------
pyhton package version
pip install --upgrade --force-reinstall --no-cache-dir --ignore-installed pycurl==7.43.0.2