App-Cheats
view release on metacpan or search on metacpan
# Loop through array input ($* $@)
for n in "$@"; do echo "[$n]"; done
# Add to an associative array/hash in bash
h[a b c]="abc val"
h[d e f]="def val"
h[x y z]="xyz val"
# Print an associative array/hash in bash
echo ${h[@]}
echo ${h[*]}
# Check if associative array/hash in bash is set.
if [[ -z ${h[abc]} ]]; then
echo yup
fi
# Bash var sublty (bug 1). Unset array is missing instead of empty
a=(one two "three four" "five")
print_args "${a[@]}"
print_args "${a[@]}" 5
unset b
print_args "${b[@]}" 5
print_args "${b}" 5
# Bash provide default if undef or empty.
unset v1
v2=""
v3="data"
echo "A${v1:- }B"
echo "A${v2:- }B"
echo "A${v3:- }B"
# Trick/hack to prevent work sptting when assigning the output
# of a bash function to an array.
unset v; IFS=$'\n' read -r -d '' -a v < <(_build_AND_regex); declare -p v
#
# IFS=$'\n': This sets the Internal Field Separator (IFS) to newline (\n).
This ensures that spaces in the output of _my_function won't cause
word splitting.
# read -r -d '' -a v: This command reads input into the array variable v.
# -r: Prevents backslash escapes from being interpreted.
# -d '': Delimiter option set to an empty string. This ensures that
read reads until it encounters a null byte (this effectively
reads the whole output as a single line).
# -a v: Assigns the input to the array variable v.
# < <(_my_function): This redirects the output of _my_function to the
read command.
#############################################################
## Bash - Ascii Art
#############################################################
# Ascii Art
figlet "svn update"
# Nice format for representing binary numbers (art,ascii)
figlet "0000011111" -f digital
# Show all available figlest fonts (ascii art)
figlist | perl -lne '$a=/\bfonts.*:$/ ... /.*:/; print if $a > 1 and $a !~ /E/'
# There are the nicer fonts
banner big lean slant smslant standard
# favorite
slant
figlet "svn update" -f slant
# Center the ascii art (justify)
figlet "svn update" -f slant -c
# Right justify the ascii art and set a width of 60
figlet "svn update" -f slant -r -w 60
#############################################################
## Bash - Autocomplete
#############################################################
# Example of using autocompletion (tab)
/usr/share/bash-completion/completions/perltidy
/usr/share/bash-completion/completions/perl
/usr/share/bash-completion/completions/ip
# Generate autocompletion for own scripts (Bash,Tab)
# Options - aaa aba bbb ccc
_sb_tab(){
COMPREPLY=( $(compgen -W "`sb info`" -- "${COMP_WORDS[COMP_CWORD]}") )
}
complete -F _sb_tab sb
# Colon should not be a word break in perl.
export COMP_WORDBREAKS=${COMP_WORDBREAKS//:}
# View all tab completions (Bash,Tab,auto)
complete
# Delete all tab completions (Bash,Tab,auto)
complete -r
# Use existing autocompletions
complete -p | grep ls # finds _longopt
complete -F _longopt my_function
# Bash autocomplete special variables
# COMP_WORDS is an array containing all individual words in the current command line.
# COMP_CWORD is an index of the word containing the current cursor position.
# COMPREPLY is an array variable from which Bash reads the possible completions.
# Tab completions source of bash commands (Bash,Tab,auto)
vi /etc/bash_completion
vi /usr/share/bash-completion/bash_completion
# Generate autocompletion for own scripts (Bash,Tab)
bash_autotab(){
# COMPREPLY=( $(compgen -W "$*" -- "${COMP_WORDS[COMP_CWORD]}") )
#
local cur="${COMP_WORDS[COMP_CWORD]}"
#
# Get possible words without consider colon characters
_get_comp_words_by_ref -n : cur
#
COMPREPLY=( $(compgen -W "$*" -- "$cur") )
});
});
</script>
# JQuery ToolTip does NOT require a title (using "items")
<div class="cell" data-data-details="my tip" title="">ABC2</div>
<script>
// Runs only when page has loaded
$(function() {
$( ".cell" ).tooltip({
content: function(event, ui) { return $(this).attr("data-details"); },
items: ".row .cell",
});
});
</script>
// Jquery html and css to show tooltips (body no longer jumps or flickers).
# function _init(){
#
# $(".row .cell").tooltip({
# content: function(event, ui) {
# const details_raw = $(this).attr('data-details');
# const details = details_raw.replace(/\n|\\n/g, "<br>");
# return details;
# },
# items: ".row .cell",
# show: false,
# hide: false,
# });
#
# $(".row .cell").on("click", (event) => {
# const $cell = $(event.target);
# let tooltip_id = $cell.attr("data-tooltip_id");
# if(tooltip_id){
# // Hide
# $(document.getElementById(tooltip_id)).remove();
# $cell.removeAttr("data-tooltip_id");
# $cell.removeClass("clicked_tooltip");
# }
# else{
# // Show
# tooltip_id = "clicked_tooltip_" + next_uid++;
# $('.ui-tooltip[id*=ui-id-]')
# .clone()
# .attr("id", tooltip_id)
# .removeAttr("opacity")
# .appendTo("body");
# // Clicked cell knows about the tooltip
# $cell.attr("data-tooltip_id", tooltip_id);
# $cell.addClass("clicked_tooltip");
# }
#
# });
# }
# JQuery Tooltip CSS
#/* ------------------- Tooltip ------------------------- */
#.ui-tooltip {
# padding: 10px 20px;
# border-radius: 20px;
# font: bold 14px"Helvetica Neue", Sans-Serif;
# box-shadow: 0 0 7px black;
# background-color: white;
# width: fit-content;
# position: absolute;
#}
#
#/* Prevent seeing content appended to the body */
#.ui-helper-hidden-accessible {
# display: none;
#}
#
#.table .cell.clicked_tooltip {
# color: #06a003;
# font-weight: 600;
#}
#############################################################
## JQuery - Variables
#############################################################
# Store jquery variables inside html elements
# Using data() preserves the type of the variable.
# Using attr() simply converts the variable to a string.
var1 = 123
var2 = [123,456]
var3 = {a:123,b:456}
//
$('#level1').data("var", var1)
$('#level1').data("var")
123
typeof $('#level1').data("var")
"number"
//
$('#level1').data("var", var2)
$('#level1').data("var")
(2)Â [123, 456]
typeof $('#level1').data("var")
"object"
//
$('#level1').data("var", var3)
$('#level1').data("var")
{a: 123, b: 456}
typeof $('#level1').data("var")
"object"
#############################################################
## Make
#############################################################
# Go to a particular directory before running make
make -Cdir
# Show what commands make will do (but don't do it, executed)
make -n
make --just-print
# Show make database variables
make --print-data-base
# Count how many items are in a list
letters := aa bb cc dd ee
count:
@echo "have $(words $(letters)) words"
# Run a different makefile
make -f my_file
# Print value of a variable in gnu make (echo)
# Can't use a simple "echo", unless inside a block
$(info VARIANT is $(VARIANT))
# Abort gnu make execution (exit,goto end)
Ev('h') # height
Ev('w') # width
#
# Keyboard Info
Ev('k') # Physical Key Value 37 37
Ev('K') # Letter A a
Ev("N") # Decimal 65 97
#
# Event Type
Ev('T') # KeyPress
# Perl Tk Event Info (PTk,bin methods,Ev)
# Stop events in callback.
return # Exits only current sub
Tk::break # Stops all callbacks for an event
# View order of bindings for a widget (PTk,bin methods,Ev)
print for $b->bindtags
print "$_: ", $b->bind($_) for $b->bindtags
# Order order of bindings for a widget (PTk,bin methods,Ev)
$b->bindtags("[all]")
# View the bindtags for (PTk):
# Class
# Install
# Toplevel
# All
perl -MTk -le '$b=MainWindow->new->Button->pack; $b->bind("<ButtonRelease-1>", sub{exit}); map {print $_; printf " $_\n" for $b->bind($_)} $b->bindtags'
# Check if widget exists, if widget if packed (mapped,PTk)
perl -MTk -le '$mw=MainWindow->new; $b=$mw->Button(-text => "unpack", -command => sub{$b->packForget})->pack; $mw->Button(-text => "Check status", -command => sub{print for "",Exists($b), $mw->appname, $b->ismapped()})->pack; MainLoop'
# Track mouse movements (PTk)
perl -MTk -le '$mw=MainWindow->new; $mw->geometry("200x200+0+0"); $w=$mw->Label(-textvariable => \$t, -width => 20)->pack; $mw->bind("<Motion>", sub{$t=join ", ", $mw->pointerxy}); MainLoop'
# Track mouse movements (PTk)
# More positional values
perl -MTk -le '$w=tkinit; $w->geometry("200x200"); $w->Label(-textvariable => \$t, -justify => "left")->pack; $w->bind("<Motion>", sub{$t=sprintf "pointerxy:%s,%s\nxy:%s,%s\nroot:%s.%s\nvroothw:+%s,+%s\nvrootxy:%s,%s\nscreen:%s", $w->pointerxy, $w->x...
# Add tab completion to an entry widget
perl -MTk -le '$mw=MainWindow->new; $e=$mw->Entry(-textvariable => \$t)->pack; $e->focus; $e->bind("<Tab>", sub{@a=glob "$t*"; $t=shift @a if @a; $e->selectionClear}); MainLoop'
# Bind Enter/Carriage Return key (PTk)
$e->bind("<Return>"
# Swap button (PTk)
perl -MTk -le '$mw=MainWindow->new; for(1..3){my $b=$mw->Button(-text => "B$_", -width => 20)->pack; $b->configure(-command => sub{ ($n)=grep{$b[$_] eq $b}0..$#b; return unless $n > 0; @b[$n,$n-1]=@b[$n-1,$n]; $_->packForget for @b; $_->pack for @b})...
# Drag and swap buttons (PTk)
perl -MTk -le '$mw=MainWindow->new; my @b; sub id{my($n)=grep{$b[$_] eq $_[0]}0..$#b; $n} for(1..3){push @b, $mw->Button(-text => "B$_", -width => 20)->pack} $mw->bind("<ButtonRelease-1>",[sub{$m=id(shift); $n=id($mw->containing(@_)); @b[$m,$n]=@b[$n...
# Swap frames of buttons (PTk)
perl -MTk -le '$mw=MainWindow->new; my @b; sub id{my($n)=grep{$b[$_] eq $_[0]}0..$#b; $n} for my $fi(1..3){my $f=$mw->Frame->pack; push @b,$f; $f->Button(-text => "Btn - $fi - $_", -width => 20)->pack(-side => "left") for 1..3} $mw->bind("<ButtonRele...
# Notebook example 1. multiple pages/tabs (PTk)
perl -MTk -MTk::NoteBook -le '$nb=MainWindow->new->NoteBook->pack(-fill => "both", -expand => 1); @pgs = map { $nb->add("page$_", -label => "Page $_") } 0..5; $pgs[0]->Button(-text => "Button $_")->pack(-fill => "both") for 1..5; $pgs[1]->Label(-text...
# Notebook example 2. multiple pages/tabs (PTk)
# Command when clicking a page/tab
perl -MTk -MTk::NoteBook -le '$nb=MainWindow->new->NoteBook(-font => "Courier 14 bold")->pack(-fill => "both", -expand => 1); @pgs = map { $nb->add("page$_", -label => "Page $_") } 0..20; $pgs[0]->Button(-text => "Button $_")->pack(-fill => "both") f...
# Notebook example 3. multiple pages/tabs (PTk)
# Page deletion
perl -MTk -MTk::NoteBook -le '$nb=MainWindow->new->NoteBook->pack(-fill => "both", -expand => 1); @pgs = map { $nb->add("page$_", -label => "Page $_") } 0..10; $nb->pagecget("page0", "-state"); $pgs[0]->Button(-text => "Button $_")->pack(-fill => "bo...
# Notebook example 4. multiple pages/tabs (PTk)
# Get page by name
perl -MTk -MTk::NoteBook -le '$nb=MainWindow->new->NoteBook->pack(-fill => "both", -expand => 1); @pgs = map { $nb->add("page$_", -label => "Page $_") } 0..10; $nb->pagecget("page0", "-state"); $pgs[0]->Button(-text => "Button $_")->pack(-fill => "bo...
# Notebook example 5. multiple pages/tabs (PTk)
# 2 rows
perl -MTk -MTk::NoteBook -le '$nb=MainWindow->new->NoteBook->pack(-fill => "both", -expand => 1); $nb->add("page0$_", -label => "Page $_") for 1..5; map { my $nb = $_; $nb->add("page1$_", -label => "Page $_") for 6..10; } map $_->NoteBook->pack, ma...
# Notebook example 6. multiple pages/tabs (PTk)
perl -MTk -MTk::NoteBook -le '$nb=MainWindow->new->NoteBook->pack; $nb->add("page0$_", -label => "Page $_") for 1..5; @pgs = map $nb->page_widget($_), $nb->pages; ($p,@rest)=@pgs; $nb1=$p->NoteBook->pack; $nb1->add("page1$_", -label => "Page $_") for...
# Entry widget validation options (PTk)
perl -MTk -le 'MainWindow->new->Entry(-validate => "key", -validatecommand => sub{$_[1] =~ /\d/}, -invalidcommand => sub{ print "ERROR" })->pack->focus; MainLoop'
# Making Scrollbars (PTk)
# When text widget is scrolled its "-yscrollcommand" command is invoked. This calls $s->set(...)
# When the scrollbar is clicked on "-command" is invoked which calls $t->yview(...)
perl -MTk -le '$mw=MainWindow->new; $s=$mw->Scrollbar; $t=$mw->Text(-yscrollcommand => ["set" => $s]); $s->configure(-command => ["yview" => $t]); $s->pack(-side => "right", -fill => "y"); $t->pack(-fill => "both"); MainLoop'
# Scale widget example (PTk)
perl -MTk -le 'MainWindow->new->Scale(-from => 1, -to => 5, -tickinterval => 1, -showvalue => 0)->pack; MainLoop'
# Balloon widget example (PTk)
perl -MTk -MTk::Balloon -le '$mw=MainWindow->new; $b=$mw->Button(-text => "DO NOTHING")->pack; $mw->Balloon->attach($b, -msg => "button"); MainLoop'
# Balloon widget example (PTk)
perl -MTk -le '$w=tkinit; $bt=$w->Button(-text => "this does nothing")->pack; $w->Balloon->attach($bt, -msg => "really nothing"); MainLoop'
# Listbox example (PTk)
perl -MTk -le '$w=MainWindow->new; $lb=$w->Scrolled("Listbox", -scrollbars => "osoe")->pack; $lb->insert(0,1..10); $w->Button(-text => "SHOW", -command => sub{@s=$lb->curselection; print $lb->get(@s) if @s})->pack; MainLoop'
# Handle clicking the "X" button on a window to close (PTk)
perl -MTk -le '$w=MainWindow->new; sub e{print "safe exit"; $w->destroy} $w->protocol("WM_DELETE_WINDOW", \&e); $w->Button(-text => "EXIT", -command => \&e)->pack; MainLoop'
# Menu(bar) example (PTk)
perl -MTk -le '$w=MainWindow->new; $m=$w->Menu; $w->configure(-menu => $m); %h=map{$_ => $m->cascade(-label => "~$_")} qw/File Edit Help/; $h{File}->command(-label => "Exit", -command => sub{exit}); MainLoop'
# Menu(bar) example using -menuitems (PTk)
perl -MTk -le '$w=MainWindow->new; $m=$w->Menu; $w->configure(-menu => $m); %h=map{$_ => $m->cascade(-label => "~$_", -menuitems => [[checkbutton => "MY_CHECK"],[command => "MY_CMD", -command => sub{print "exit"}, -accelerator => "Ctrl-o"],[radiobutt...
# Simple Menu(bar) example using -menuitems (PTk)
perl -MTk -le '$w=MainWindow->new; $m=$w->Menu; $w->configure(-menu => $m); $m->cascade(-label => "~File", -menuitems => [[command => "new", -accelerator => "Ctrl-n"],"",[command => "Open", -accelerator => "Ctrl-o"]]); MainLoop'
# Simple 2 Menu(bar) example using -menuitems (PTk)
perl -MTk -le '$w=MainWindow->new; $m=$w->Menu; $w->configure(-menu => $m); $m->cascade(-label => "~File", -menuitems => [[cascade => "new", -accelerator => "Ctrl-n", -menuitems => [map [command => $_],qw/PNG JPEG TIFF/], -tearoff => 0],"",[command =...
# Color changing menu(bar) (PTk)
perl -MTk -le '$color="$red"; $w=MainWindow->new; $mi=[[cascade => "~Edit", -menuitems => [[cascade => "~Background", -menuitems => [map [radiobutton => $_, -variable => \$color, -command => [sub{my $c=shift; $w->configure(-background => $c); print "...
# Very primitive notebook (poor man's notebook) (PTk)
perl -MTk -le '$w=MainWindow->new; ($top,$bot)=map{$w->Frame->pack} 1..2; @b=map { $top->Button(-text => "B$_", -command => [sub{print shift}, $_])->pack(-side => "left") } 1..3; @f=map{$bot->Frame} 1..3; $f[0]->pack; $f[0]->Label(-text => "L1")->pac...
# Wait until variable is changes. Other button can still be pressed though. (PTk)
perl -MTk -le '$w=MainWindow->new; $w->Entry(-width => 20, -textvariable => \$t)->pack; $w->Button(-text => "PRINT", -command => sub{print "ABC"})->pack; $w->Button(-text => "PAUSE", -command => sub{$w->waitVariable(\$t); print "DONE"})->pack; MainLo...
..............1...............
..............1...............
..............................
..............................
..............................
perl -MTk -le '$w=MainWindow->new; $s=30; $p=pack("b$s"x$s,`cat start.bm`); $w->DefineBitmap(start => $s,$s,$p); $w->Button(-bitmap => "start")->pack; MainLoop'
# DirTree example (PTk)
perl -MTk -le 'MainWindow->new->Scrolled("DirTree")->pack(qw/-fill both -expand 1/); MainLoop'
# LabEntry example (PTk,label and entry in one)
perl -MTk -le 'tkinit->LabEntry(-label => "name", -textvariable => \$name, -labelPack => [qw/ -side left /], -width => 20)->pack; MainLoop'
# Clicking a button will send it to the top. Cycle through
perl -MTk -le '$w=tkinit; @b=map{$w->Button(-text => $_)->pack} a..c; $_->configure(-command => sub{$b[-1]->pack(-before => $b[0]); unshift @b, pop @b }) for @b; MainLoop'
# Show or hide widgets based on a checkbutton (advanced options)
perl -MTk -le '$w=tkinit; $b=$w->Button->pack(qw/ -side bottom /); $p=1; $w->Checkbutton(-text => "Pack", -variable => \$p, -command => sub{ if($p){ $i=$b->{packInfo}; $b->pack(@$i) } else { $b->{packInfo} = [$b->packInfo]; $b->packForget } })->pack...
# Sleep/Wait (PTk)
$mw->after(3000) # ms
#############################################################
## Perl Modules - Tk (Bind)
#############################################################
# Make Control-C binding (PTk)
perl -MTk -le '$b=tkinit->Button(-text => "Try Control-C"); $b->configure(-command => sub{$b->focus}); $b->pack->bind("<Control-Key-c>", sub{print "Hit C"}); MainLoop'
# Show the name an value of each pressed key (PTk)
perl -MTk -le '$e=tkinit->Entry->pack; $e->focus; $e->bind("<Key>", sub{my($w)=@_; my $E=$w->XEvent; printf "%s %s\n", $E->K, $E->N}); MainLoop'
#
# Simpler
perl -MTk -le '$e=tkinit->Entry->pack; $e->focus; $e->bind("<Key>", sub{my $E=shift->XEvent; printf "%s %s\n", $E->K, $E->N}); MainLoop'
#
# Using newer "Tk::event"
perl -MTk -le '$e=tkinit->Entry->pack; $e->focus; $e->bind("<Key>", sub{printf "%s %s\n", $Tk::event->K, $Tk::event->N}); MainLoop'
# Three (3) ways to get the widget reference of a binding (PTk)
perl -MTk -le '$b=tkinit->Button(-command => \&cb)->pack; $b->bind("<ButtonRelease-3>", \&cb); sub cb {print "\nargs: @_"; print "->W" . $Tk::event->W; print "widget " . $Tk::widget}; MainLoop'
# Find out value of keypress
perl -MTk -le 'tkinit->Entry->pack->bind("<KeyPress>", sub{$e=$Tk::event; print $e->K . " " . $e->N}); MainLoop'
#############################################################
## Perl Modules - Tk (Canvas)
#############################################################
# Take a canvas and create a postscript then a pdf
perl -MTk -le '$w=tkinit; $c=$w->Canvas->pack; $c->createLine(20,20,200,200,200,20); $b=$w->Button(-text => "Save", -command => sub{$c->postscript(-file => "tk.ps")})->pack; MainLoop'
ps2pdf tk.ps tk.pdf
xpdf tk.pdf
#############################################################
## Perl Modules - Tk (Tags)
#############################################################
# Text tags example (PTk)
perl -MTk -le '$t=tkinit->Text->pack; $t->tagConfigure("bold", -font => "Courier 24 bold"); $t->insert("end", "Normal Text\n"); $t->insert("end", "Bold Text\n", "bold"); MainLoop'
# Make select text bold (PTk)
perl -MTk -le '$w=tkinit; $t=$w->Text->pack; $t->tagConfigure("bold", -font => "bold"); $t->insert("end", "A Bunch of text"); $w->Button(-text => "BOLD", -command => sub{$t->tagAdd("bold", "sel.first", "sel.last")} )->pack; MainLoop'
# Check if a selection exists (PTk)
perl -MTk -le '$w=tkinit; $t=$w->Text->pack; $t->tagConfigure("bold", -font => "bold"); $t->insert("end", "A Bunch of text"); $w->Button(-text => "BOLD", -command => sub{$t->tagAdd("bold", "sel.first", "sel.last") if $t->tagRanges("sel")} )->pack; Ma...
#############################################################
## Perl Modules - Tk (Appendix B)
#############################################################
# Adjuster example (PTk,Appendix B)
perl -MTk -le '$w=tkinit; %def=qw/-fill both -expand 1/; $b=$w->Button(-text => "Button A")->pack(%def); $w->Adjuster(-side => "top", -widget => $b)->pack(qw/-fill x/); $w->Button(-text => "Button B")->pack(%def); MainLoop'
# Balloon Example (Ptk,Appendix B)
perl -MTk -le '$w=tkinit; $btn=$w->Button(-text => "Button A")->pack; $bl=$w->Balloon; $bl->attach($btn, -msg => "click me"); MainLoop'
# Bitmap Example (Ptk,Appendix B)
# BrowseEntry Example (Ptk,Appendix B)
#
# Simple
perl -MTk -MTk::BrowseEntry -le 'tkinit->BrowseEntry(-label => "label", -variable => \$v, -choices => [1..10], -browsecmd => sub{print "Clicked $v"})->pack; MainLoop'
#
# Insert additional values
perl -MTk -MTk::BrowseEntry -le '$b=tkinit->BrowseEntry(-label => "label", -variable => \$v, -choices => [1..10], -browsecmd => sub{print "Clicked $v"})->pack; $b->insert("end",20,30); MainLoop'
# Button Example (Ptk,Appendix B)
# Canvas Example (Ptk,Appendix B)
#
# Simple useless canvas
perl -MTk -le '$c=tkinit->Scrolled("Canvas")->pack; MainLoop'
#
# Click in canvas window will show x,y coordinates
perl -MTk -le 'sub print_xy { my($c,$x,$y)=@_; print "(x,y) = @{[ $c->canvasx($x) ]}, @{[ $c->canvasy($y) ]} " } $c=tkinit->Scrolled("Canvas")->pack; $c->Subwidget("canvas")->CanvasBind("<Button-1>", [ \&print_xy, Ev("x"), Ev("y") ]); MainLoop'
# ColorEditor Example (Ptk,Appendix B)
# Dialog Example (Ptk,Appendix B)
# DirTree Example (Ptk,Appendix B)
# Entry Example (Ptk,Appendix B)
# ErrorDialog Example (Ptk,Appendix B)
# FileSelect Example (Ptk,Appendix B)
# Frame Example (Ptk,Appendix B)
# HList Example (Ptk,Appendix B)
perl -MTk -MTk::HList -le '$h=tkinit->HList(-indent => 20)->pack; $h->add(qw/A -text a/); $h->add(qw/A.B -text a->b/); MainLoop'
# Label Example (Ptk,Appendix B)
# LabEntry Example (Ptk,Appendix B)
# Learn how to use Text indices (demo)
perl -MTk -le '%def=qw/-side left/; $mw=tkinit; $t=$mw->Text->pack; ($i,$d)=map{my $v; $mw->LabEntry(-label => "$_:", -textvariable => \$v, -labelPack => [%def])->pack(%def); \$v} qw/Index Data/; $mw->Button(-text => "INSERT", -command => sub{$t->ins...
# LabFrame Example (Ptk,Appendix B)
# ListBox Example (Ptk,Appendix B)
# MainWindow Example (Ptk,Appendix B)
C:\Windows\System32\drivers\etc
# Check if a program on Windows is 32 or 64 bit (objdump,stat,file)
Control + Shift + ESC
-> More Details
-> "Details" tab
Right Click
Select Columns
Platform
#
# Another way
"C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.21.27702\bin\Hostx64\x64\dumpbin" /headers hinstall.exe | findstr machine
# Find windows start location folder (autostart scripts)
Windows + R
type:
shell:startup
shell:common startup
# Delete a deeply nested folder on Windows
cd bad_dir
mkdir empty
robocopy empty bad_dir /mir :: mirror blank directory over nested
rmdir empty bad_dir
# Question:
# What differences are between Authenticated Users, SYSTEM, Administrators
# (ADMIN\Administrators), and Users (ADMIN\Users) (Windows 10)
#
# Answer:
# They are all default users and groups Windows uses to maintain
# permissions, typically for security purposes.
#
# Authenticated Users is a pseudo-group (which is why it exists, but is not
# listed in Users & groups), it includes both Local PC users and Domain users.
#
# SYSTEM is the account used by the operating system to run services,
# utilities, and device drivers. This account has unlimited power and access
# to resources that even Administrators are denied, such as the Registry's SAM.
#
# Administrators can do just about everything a user would want to do with
# Windows, typically this includes the first user you create with windows.
# You are probably a member of this group.
#
# Users are accounts with lower permissions, and typically require an Administrator
# to enter their password to do anything that would bring up a UAC console in
# Windows. You can create accounts with these permissions (I do it for my
# guest account) with the "Add Remove User Accounts" menu in the Control Panel.
# Find out who have a file opened
# Need to have this setup one time (as admin)
openfiles.exe /local on
# restart PC
#############################################################
## Windows - Outlook
#############################################################
# Windows Outlook.
# Monospaced font
Courier New
#############################################################
## Windows - Registry
#############################################################
# Registry file location on windows 10
C:\Users\<USER>\NTUSER.DAT
# Script to update the windows registry
#
@echo off
echo.
cd ..
reg add HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\MY_PATH /t REG_SZ /v AppPath /d %cd% /f
echo.
echo AppPath = %cd%
echo.
pause
# Dump windows 10 registry to a file (query,view,search)
reg export "HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\MY_PATH" my.reg
reg export "HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\MY_PATH" my.reg /y
# Enable Restore Points in Windows 10
Win + r
Type: regedit
Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows NT\SystemRestore
Double - Click "DisableSR"
1 - Disabled
0 - Enabled
#
# Restart PC for changes to take effect.
# Add the "Open command window here" option back to windows 10 commamd prompt (registry,DOS)
# when doing right click.
#
# Go to the regestry
Win + r
type: regedit
#
# For these paths:
Computer\HKEY_CLASSES_ROOT\Directory\shell\cmd
Computer\HKEY_CLASSES_ROOT\Directory\background\shell\cmd
#
# Update permissions:
- Right-click the PowerShell (folder) key, and click Permissions.
- Click the Advanced button.
- On "Advanced Security Settings," click the Change link next to "Owner".
- Type your account name in the provided field, click Check Names to verify
you're typing the account name correctly, and click OK.
- Check the Replace owner on subcontainers and objects option.
- Click Apply.
- Click OK.
- On "Permissions," select the Administrators group.
- Under "Permissions for Administrators," select Allow for the Full Control option.
- Click Apply.
- Click OK.
#
( run in 0.706 second using v1.01-cache-2.11-cpan-5735350b133 )