Change gpedit.msc (see picture) and UAC (Start -> Run -> uac) to never notify
Virtual Box does not run EXE Files on Shared VM Folders
http://hilite.me/ a pritty nice Highlighter
RConsole - native = CMD/Befehle
PowerShell - native = Powershell
INI - native = INI Files
friendlyarm NenoPi Neo Air - Aliases and kill python processes with name
vim ~/.bash_aliases
1 2 | alias kp="pgrep python | xargs sudo kill" alias tp="top -b -n1 | grep python" |
Powershell - check if WLAN connected
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 | function Get-IniFile { param( [parameter(Mandatory = $true)] [string] $filePath ) $anonymous = "NoSection" $ini = @{} switch -regex -file $filePath { "^\[(.+)\]$" # Section { $section = $matches[1] $ini[$section] = @{} $CommentCount = 0 } "^(;.*)$" # Comment { if (!($section)) { $section = $anonymous $ini[$section] = @{} } $value = $matches[1] $CommentCount = $CommentCount + 1 $name = "Comment" + $CommentCount $ini[$section][$name] = $value } "(.+?)\s*=\s*(.*)" # Key { if (!($section)) { $section = $anonymous $ini[$section] = @{} } $name,$value = $matches[1..2] $ini[$section][$name] = $value } } return $ini } $iniFile = Get-IniFile "c:\info\additional_info.ini" $PreferredSSID = $iniFile.NoSection.SerialNumber Function AutoConnect ($PreferredSSID){ #WIFI auto-connect if($PreferredSSID -ne $null){ if(Get-NetAdapter | where {($_.Name -like "*wi-fi*" -or $_.Name -like "*wifi*") -and ($_.Status -eq "Disconnected")}){ netsh wlan connect name=$PreferredSSID Start-Sleep -Seconds 2 netsh wlan set profileparameter name=$PreferredSSID connectionmode=auto } } } while ( Get-NetAdapter | where {($_.Name -like "*wi-fi*" -or $_.Name -like "*wifi*") -and ($_.Status -eq "Disconnected")}){ AutoConnect $PreferredSSID Start-Sleep -Seconds 2 } |
additional_ino.ini file:
1 2 | SerialNumber = 35356345601 CalibrationDate = 22 Oct 2010 |
Powershell - create WLAN Profile from INI File
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 | function Get-IniFile { param( [parameter(Mandatory = $true)] [string] $filePath ) $anonymous = "NoSection" $ini = @{} switch -regex -file $filePath { "^\[(.+)\]$" # Section { $section = $matches[1] $ini[$section] = @{} $CommentCount = 0 } "^(;.*)$" # Comment { if (!($section)) { $section = $anonymous $ini[$section] = @{} } $value = $matches[1] $CommentCount = $CommentCount + 1 $name = "Comment" + $CommentCount $ini[$section][$name] = $value } "(.+?)\s*=\s*(.*)" # Key { if (!($section)) { $section = $anonymous $ini[$section] = @{} } $name,$value = $matches[1..2] $ini[$section][$name] = $value } } return $ini } $iniFile = Get-IniFile "c:\info\additional_info.ini" $SSID = $iniFile.NoSection.SerialNumber $profilefile = "$Env:USERPROFILE\AppData\Roaming\info\" + $SSID + "-WLANProfile.xml" $PW = $SSID $SSIDHEX=($SSID.ToCharArray() |foreach-object {'{0:X}' -f ([int]$_)}) -join'' $xmlfile="<?xml version=""1.0""?> <WLANProfile xmlns=""http://www.microsoft.com/networking/WLAN/profile/v1""> <name>$SSID</name> <SSIDConfig> <SSID> <hex>$SSIDHEX</hex> <name>$SSID</name> </SSID> </SSIDConfig> <connectionType>ESS</connectionType> <connectionMode>auto</connectionMode> <MSM> <security> <authEncryption> <authentication>WPAPSK</authentication> <encryption>AES</encryption> <useOneX>false</useOneX> </authEncryption> <sharedKey> <keyType>passPhrase</keyType> <protected>false</protected> <keyMaterial>$PW</keyMaterial> </sharedKey> </security> </MSM> </WLANProfile> " $XMLFILE > ($profilefile) netsh wlan delete profile name=* netsh wlan add profile filename="$($profilefile)" netsh wlan show profiles $SSID key=clear netsh wlan connect name=$SSID |
1 2 | SerialNumber = 35356345601 CalibrationDate = 22 Oct 2010 |
Powershell - Get IniFile and compare date - vbs
1 | CreateObject("Wscript.Shell").Run "powershell -EP ByPass -NoP -File C:\checkCalibration_all.ps1", 0, False |
Powershell - Get IniFile and compare date - script
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 | param($date = (Get-Date)) function Get-IniFile { param( [parameter(Mandatory = $true)] [string] $filePath ) $anonymous = "NoSection" $ini = @{} switch -regex -file $filePath { "^\[(.+)\]$" # Section { $section = $matches[1] $ini[$section] = @{} $CommentCount = 0 } "^(;.*)$" # Comment { if (!($section)) { $section = $anonymous $ini[$section] = @{} } $value = $matches[1] $CommentCount = $CommentCount + 1 $name = "Comment" + $CommentCount $ini[$section][$name] = $value } "(.+?)\s*=\s*(.*)" # Key { if (!($section)) { $section = $anonymous $ini[$section] = @{} } $name,$value = $matches[1..2] $ini[$section][$name] = $value } } return $ini } $iniFile = Get-IniFile "$Env:USERPROFILE\AppData\Roaming\info.ini" $addIniFile = Get-IniFile "C:\info\additional_info.ini" $language = $iniFile.General.language $calidateIni = $addIniFile.NoSection.CalibrationDate Add-Type -AssemblyName System.Windows.Forms $calidate = [Datetime]::ParseExact($calidateIni, 'dd MMM yyyy', [CultureInfo]'en-us') #' ' #'This is in the additional info.txt = ' + $calidate.AddDays(365) #'This is the date now = ' + $date #' ' if ($calidate -as [DateTime]) { if ($date -ge $calidate.AddDays(365)) { #'Date now is bigger than calidate' #$language if ($language -eq "de") { #echo $language [System.Windows.Forms.MessageBox]::Show("Service fällig.","Info",0) } elseif ($language -eq "en") { [System.Windows.Forms.MessageBox]::Show("Service due.","Info",0) } elseif ($language -eq "fr") { [System.Windows.Forms.MessageBox]::Show("Service dû","Info",0) } elseif ($language -eq "ja") { [System.Windows.Forms.MessageBox]::Show("校正有効期限が失効しました","Info",0) } } elseif ($date -ge $calidate.AddDays(335)) { #'Date now is in 30 days or less than calidate' $diffdate = New-TimeSpan -Start $date -End $calidate.AddDays(365) #'Calidate + 365 = ' + $calidate.AddDays(365) #'This is the date now = ' + $date #"Service fällig in = " + $diffdate.Days + " Tagen" if ($language -eq "de") { [System.Windows.Forms.MessageBox]::Show("Service fällig in " + $diffdate.Days + " Tagen","Info",0) } elseif ($language -eq "en") { [System.Windows.Forms.MessageBox]::Show("Service due in " + $diffdate.Days + " days","Info",0) } elseif ($language -eq "fr") { [System.Windows.Forms.MessageBox]::Show("Prochain service dans " + $diffdate.Days + " jour(s).","Info",0) } elseif ($language -eq "ja") { [System.Windows.Forms.MessageBox]::Show("校正有効期限失効まであと " + $diffdate.Days + " 日","Info",0) } } else { #'no' #[System.Windows.Forms.MessageBox]::Show("Calibration is ok","Info",0) #[string]$linesplit[1] #$date } } |
friendlyarm NenoPi Neo Air - systemd - WLAN AP auto config
1 2 3 4 5 6 7 8 9 10 11 12 13 | [Unit] Description=Copy user wpa_supplicant.conf ConditionPathExists=/boot/wpa_supplicant.conf Before=dhcpcd.service [Service] Type=oneshot RemainAfterExit=yes ExecStart=/bin/mv /boot/wpa_supplicant.conf /etc/wpa_supplicant/wpa_supplicant.conf ExecStartPost=/bin/chmod 600 /etc/wpa_supplicant/wpa_supplicant.conf [Install] WantedBy=multi-user.target |
friendlyarm NenoPi Neo Air - WIFI
VORGEHEN ZUM AKTIVIEREN BZW. ÄNDERN DES PI ALS WLAN HOTSPOT:
Über serielles Terminal (USB-Kabel) auf pi einloggen. Falls WLAN Hotspot bereits existiert, dann mit dem PC sich damit verbinden und ein SSH Terminal Sitzung zum WLAN 192.168.8.1 verbinden. Dann die folgendes eingeben:
1 2 | Sudo touch /usr/share/network-conf/ap/iptables.up.rules sudo turn-wifi-into-apmode yes |
SSID und Passwort eingeben:
default: SSID=sensor-xx PASSWORD=123456789
ALTERNATIVES VORGEHEN ZUM EINRICHTEN DES PI ALS CLIENT:
# Wifi Hotspot am PC einrichten
# Über serielles Terminal auf pi einloggen, dann
1 2 | sudo nmcli dev wifi sudo nmcli dev wifi connect "SSID" password "PASSWORD" ifname wlan0 |
# die Einstellungen werden gespeichert und auch nach Neustart wird Verbindung aufgebaut.
FALLS SCHON MAL IN DEN NETZWERKEINSTELLUNGEN RUMGEFUSCHT WURDE:
1 | sudo nmcli dev
|
#if the status of a device is "unmanaged" it means that device cannot be accessed by NetworkManager. To make it accessed you need to clear the settings under "/etc/network/interfaces" and reboot your system.
1 2 3 | sudo nmcli r wifi on sudo nmcli dev wifi sudo nmcli dev wifi connect "SSID" password "PASSWORD" ifname wlan0 |
How do I grab an INI value within a shell script?
Just include your .ini file into bash body:
File example.ini:
1 2 3 | DBNAME=test DBUSER=scott DBPASSWORD=tiger |
File example.sh
1 2 3 4 5 | #!/bin/bash #Including .ini file . example.ini #Test echo "${DBNAME} ${DBUSER} ${DBPASSWORD}" |
[ Source: https://stackoverflow.com/questions/6318809/how-do-i-grab-an-ini-value-within-a-shell-script ]
Datei in einer windows.wim image ändern
Um Dateien in einer Datei.wim zu ändern, und zwar nicht im 1. Index sondern 2. öffnet man Powershell (ich habs jetzt im admin Modus gestart...
-
Um Dateien in einer Datei.wim zu ändern, und zwar nicht im 1. Index sondern 2. öffnet man Powershell (ich habs jetzt im admin Modus gestart...
-
I am running an DietPi (downloaded on dietpi -> NanoPi Air) on a NanoPi Air. These are the huddles I had: Theme: UART2 and i2c0 Afer read...
-
I have created an image in JPG with 160x128 Pixels, 144 dpi and 24 Bitdepth. But with every exporting try in GIMP it can't be read. Thi...