Migrate all VMware VM-Datastores, starting with a specific name, from one Datastore evenly (based on percentage usage) to multiple Datastores.
#Connect-VIServer -Server $vCenterServer # Source datastore $datastore = Get-Datastore -Name "VMFS0" # Destinations $ClientVMDatastores = "VMFS1","VMFS2","VMFS3","VMFS4","VMFS5","VMFS6","VMFS7","VMFS8" # starting with following (ignores case) $StartWith = "asdfg" Function Get-DatastoreUsage { param([Parameter(Mandatory=$true)] [System.Array] $Datastores); Return ($Datastores | Foreach-Object { Add-Member -InputObject $_ -MemberType NoteProperty -Name PercentageFree -Force -Value ([float](( $_.FreeSpaceMB / $_.CapacityMB ) * 100)) $_ } | Select-Object -Property Name,Id,CapacityGB,FreeSpaceGB,PercentageFree ` | Sort-Object -Property PercentageFree -Descending ) } $vms = Get-VM -Datastore $datastore $Storages = Get-Datastore -Name $ClientVMDatastores $DestinationStorageFree = 0.0 $DataToMove = 0.0 $vms | % { $DataToMove += $_.UsedSpaceGB } $Storages | % { $DestinationStorageFree += $_.FreeSpaceGB } Write-Host "VM's to migrate: $($vms.Count)" Write-Host "Total GB to move: $([math]::round($DataToMove,2))" Write-Host "Total GB free on all destinations: $([math]::round($DestinationStorageFree,2))" Write-Host "Total GB free on all destinations, after moved: $([math]::round(($DestinationStorageFree - $DataToMove),2))" If(($DestinationStorageFree - $DataToMove) -le 1) { Write-Warning "There would no space left on devices after this operation! exiting..." Exit } If(($cont = Read-Host "Continue? [Y/n]") -eq '') {$cont="Y"}else{$cont=$result} If ($cont -eq 'Y') { $vms | % { $VM = $_ If ($VM.Name.StartsWith($StartWith,"CurrentCultureIgnoreCase")) { $Storages = Get-Datastore -Name $ClientVMDatastores $StoragesUsage = Get-DatastoreUsage -Datastores $Storages $StorageToMoveTo = Get-Datastore -Id $StoragesUsage[0].Id Write-Host "Migrate VM: $VM from $datastore to $StorageToMoveTo" Move-VM -VM $vm -Datastore $StorageToMoveTo | Out-Null } } } $Storages = Get-Datastore -Name $ClientVMDatastores $StoragesUsage = Get-DatastoreUsage -Datastores $Storages $StoragesUsage | Format-Table $PercentageFree = $($i = 0; $a = 0; $StoragesUsage.PercentageFree | % { $i++; $a += $_; }; $a / $i) Write-Host "Total storage % used: $([math]::round($PercentageFree,2))"
Update: check if there is enough free space displays some info before the migrations begin.
Update: moooore stuff :)
Clean-Datastore.ps1
Get-DatastoreUsage.ps1
Init.ps1
Tests.ps1
Test-VISession.ps1
Recording live-streams with livestreamer
This enable you to record a twitch.tv (and many other) stream with VLC or write it into a file and get notified (via mail) when the stream is finished
broadcaster="widgitybear" while true; do date=$(date +%0Y-%0m-%0d.%0k%0M%z) file="twitch.tv_${broadcaster}_$date" livestreamer twitch.tv/$broadcaster best -l info -o $file.flv --retry-open 3 --hds-segment-threads 4 --hls-segment-threads 4 --no-version-check > /dev/null if [[ $? -eq 0 ]]; then sendmail yourmail@example.org << EOF Subject: $broadcaster's stream has finished $file.flv EOF fi echo "$date Waiting 60s... for $broadcaster" sleep 60 done
Ref's: livestreamer.io
Update: Repository
Firefox update: 37.0.1
firefox-release-37.0.1-i686.7z
firefox-release-37.0.1-x86_64.7z
PGP-Signatures and other stuff u might interested in, like build config's, build log files etc -> Link
What's New CHANGED - Disabled HTTP/2 AltSvc FIXED - Start-up crash due to graphics hardware and third party software FIXED - Certificate verification bypass through the HTTP/2 Alt-Svc header FIXED - Loading privileged content through Reader mode
Take care of your DNS server's zone transfer settings, if anyone are allowed to trigger a AXFR (Asynchronous Full Transfer Zone) this could be used by attackers to get information about any subdomains, aliases, MX hosts etc.. compilenix.org was affacted too, until now :(
You can test if your domain(-server) are configured correctly
DOMAIN="YOURDOMAIN.TLD" dig NS $DOMAIN +short | sed -e "s/\.$//g" | while read nameserver; do echo "Testing $DOMAIN @ $nameserver"; dig AXFR $DOMAIN "@$nameserver"; done
There should be something like:
Testing compilenix.org @ ns1.compilenix.org ; <<>> DiG 9.8.4-rpz2+rl005.12-P1 <<>> AXFR compilenix.org @ns1.compilenix.org ;; global options: +cmd ; Transfer failed. Testing compilenix.org @ ns2.compilenix.org ; <<>> DiG 9.8.4-rpz2+rl005.12-P1 <<>> AXFR compilenix.org @ns2.compilenix.org ;; global options: +cmd ; Transfer failed.
Find here, more details of the feature you will: rfc 5936
Ref's:
heise.de
internetwache.org
With you, may the force be.
Firefox update: 37.0
firefox-release-37.0-i686.7z
firefox-release-37.0-x86_64.7z
PGP-Signatures and other stuff u might interested in, like build config's, build log files etc -> Link
What's New NEW - Heartbeat user rating system - your feedback about Firefox NEW - Yandex set as default search provider for the Turkish locale NEW - Bing search now uses HTTPS for secure searching NEW - Improved protection against site impersonation via OneCRL centralized certificate revocation NEW - Opportunistically encrypt HTTP traffic where the server supports HTTP/2 AltSvc CHANGED - Disabled insecure TLS version fallback for site security CHANGED - Extended SSL error reporting for reporting non-certificate errors CHANGED - TLS False Start optimization now requires a cipher suite using AEAD construction CHANGED - Improved certificate and TLS communication security by removing support for DSA CHANGED - Improved performance of WebGL rendering on Windows HTML5 - Implemented a subset of the Media Source Extensions (MSE) API to allow native HTML5 playback on YouTube (Windows only) HTML5 - Added support for CSS display:contents HTML5 - IndexedDB now accessible from worker threads HTML5 - New SDP/JSEP implementation in WebRTC DEVELOPER - Debug tabs opened in Chrome Desktop, Chrome for Android, and Safari for iOS DEVELOPER - New Inspector animations panel to control element animations DEVELOPER - New Security Panel included in Network Panel DEVELOPER - Debugger panel support for chrome:// and about:// URIs DEVELOPER - Added logging of weak ciphers to the web console
gnihihi! I found something to collect :)
Fortune FTW!
You can be replaced by this computer.
alias fortune='echo -e "\n$(tput bold)$(tput setaf $(shuf -i 1-5 -n 1))$(/usr/games/fortune)\n$(tput sgr0)"'
logrotate does simply nothing?
try force file rotaion using:
logrotate -f /etc/logrotate.conf
Firefox update: 36.0.4
firefox-release-36.0.4-i686.7z
firefox-release-36.0.4-x86_64.7z
What's New FIXED - 36.0.3: Security fixes for issues disclosed at HP Zero Day Initiative's Pwn2Own contest FIXED - 36.0.4: Security fixes for issues disclosed at HP Zero Day Initiative's Pwn2Own contest Known Issues UNRESOLVED - Style Editor: Extra white space appearing above the editor for a sourcemapped scss file (1128747) UNRESOLVED - For users who removed the Share & Hello buttons, this new version brings them back unexpectedly (1136300) UNRESOLVED - Firefox Hello does not work for link generators if there is no camera installed (1106941)
The next iteration of software development:
Feature request and bug report are old and busted!!
- Bug request; we need a peace of code wich handle all this mess...couple developers later... uh wtf, it did something and it's broken!1!!
- Feature report; "Hey i found something over here, does anyone know about this?"
Firefox update: 36.0.1
firefox-release-36.0.1-i686.7z
firefox-release-36.0.1-x86_64.7z
What's New FIXED Disable the usage of the ANY DNS query type (1093983) FIXED Fixed a startup crash with EMET (1137050) FIXED Hello may become inactive until restart (1137469) FIXED Print preferences may not be preserved (1136855) FIXED Hello contact tabs may not be visible (1137141) FIXED Accept hostnames that include an underscore character ("_") (1136616) FIXED WebGL may use significant memory with Canvas2d (1137251) FIXED Option -remote has been restored (1080319) FIXED Fix a top crash NEW Pinned tiles on the new tab page can be synced NEW Support for the full HTTP/2 protocol. HTTP/2 enables a faster, more scalable, and more responsive web. NEW Locale added: Uzbek (uz) CHANGED -remote option removed CHANGED No longer accept insecure RC4 ciphers whenever possible CHANGED Phasing out Certificates with 1024-bit RSA Keys CHANGED Shut down hangs will now show the crash reporter before exiting the program CHANGED Add-on Compatibility HTML5 Support for the ECMAScript 6 Symbol data type added HTML5 unicode-range CSS descriptor implemented HTML5 CSSOM-View scroll behavior implemented allowing smooth scrolling of content without custom libraries HTML5 object-fit and object-position implemented. Defines how and where the content of a replaced element is displayed HTML5 isolation CSS property implemented. Create a new stacking context to isolate groups of boxes to control which blend together HTML5 CSS3 will-change property implemented. Hints the browser of elements that will be modified. The browser will perform some performance optimization for these HTML5 Improved ES6 generators for better performance HTML5 Changed JavaScript 'const' semantics to conform better to the ES6 specification. The const declaration is now block-scoped and requires an initializer. It also can not be redeclared anymore. DEVELOPER Eval sources now appear in the Debugger Debug JavaScript code that is evaluated dynamically, either as a string passed to eval() or as a string passed to the Function constructor DEVELOPER DOM Promises inspection DEVELOPER Inspector: More paste options in markup view FIXED Various security fixes FIXED CSS gradients work on premultiplied colors FIXED Fix some unexpected logout from Facebook or Google after restart Known Issues UNRESOLVED Style Editor: Extra white space appearing above the editor for a sourcemapped scss file (1128747) UNRESOLVED For users who removed the Share & Hello buttons, this new version brings them back unexpectedly (1136300) UNRESOLVED Firefox Hello does not work for link generators if there is no camera installed (1106941)
Transfer a mysql database beween two instances/hosts in one step.
Procedure: mysqldump -> gzip -> ssh -> gunzip -> mysql
database="db_name" local_mysql_user="root" local_mysql_password="password" remote_mysql_user="root" remote_mysql_password="password" remote_host="1.2.3.4" remote_ssh_user="root" mysqldump \ --add-locks=FALSE \ --comments=FALSE \ --default-character-set=utf8 \ --events \ --hex-blob=TRUE \ --lock-tables=FALSE \ --max_allowed_packet=1G \ --replace=TRUE \ --routines \ -u $local_mysql_user --password=$local_mysql_password --databases $database | gzip -9 | ssh $remote_ssh_user@$remote_host "gunzip | mysql -u $remote_mysql_user --password=$remote_mysql_password"
Get a simple list of available debian packages, which contains: package name, installed version, new version, short description.
This snipped needs:
- apt-utils
- dpkg
- perl
function c { read input;dpkg -l ${input} | grep " ${input} " | awk '{$1=$2=$3=$4="";print $0}' | sed 's/^ *//';unset input;};function a { apt-get --just-print upgrade 2>&1 | perl -ne 'if (/Inst\s([\w,\-,\d,\.,~,:,\+]+)\s\[([\w,\-,\d,\.,~,:,\+]+)\]\s\(([\w,\-,\d,\.,~,:,\+]+)\)? /i) {print "$1 (\e[1;34m$2\e[0m -> \e[1;32m$3\e[0m)\n"}';};a | while read -r line; do echo -en "$line $(echo $line | awk '{print $1}' | c )\n"; done;
Source: unix.stackexchange.com
You like to have a colorful bash but dont want to mess with a complex $PS1?
This might interest you: https://www.kirsle.net/wizards/ps1.html
PS1="$(if [[ ${EUID} == 0 ]]; then echo -n '\[$(tput bold)\]\[$(tput setaf 1)\]\u'; else echo -n '\[$(tput bold)\]\[$(tput setaf 2)\]\u'; fi; echo '\[$(tput setaf 4)\]@\[$(tput setaf 2)\]\H \[$(tput setaf 3)\]\t \[$(tput setaf 4)\]\w # \[$(tput sgr0)\]\[$(tput sgr0)\]')"
In a normal case your Windows will list a Directory alphabetically ascending, right?
What i expect to see:0 00 01 02 1 2
and this:
5495de6b 54b658fb 54c697d7 54c6a2a6
What i actualy get are this:
and this:
Update: When i list the directory via dir.exe or with powershell (Get-Childitem), i get the listing order as expected.
Set up a ssh client on windows can be awful, specialy when you want to push/pull or to clone a git repo.
On my machine i wasn't able to clone a git repo via ssh because i had to use an non-standard ssh port. Why should this become a problem? When i exec the following line on one of my linux machines it worked:
git clone ssh://git@hostname.com:5632/Compilenix/repo.git
On my Windows it doesn't work, saying something about a refused ssh-key...
The solution, which worked in my case, was to write a ssh client config on my Windows for "hostname.com" into "/C/Users/USERNAME/.ssh/config".
Host hostname.com Port 5632 User git
I just compiled Firefox 35 for my windows, when i opend the developer console i got this one:
_.-~-. 7'' Q..\ _7 (_ _7 _/ _q. / _7 . ___ /VVvv-'_ . 7/ / /~- \_\\ '-._ .-' / // ./ ( /-~-/||'=.__ '::. '-~'' { ___ / // ./{ V V-~-~| || __''_ ':::. ''~-~.___.-'' _/ // / {_ / { / VV/-~-~-|/ \ .'__'. '. ':: _ _ _ ''. / /~~~~||VVV/ / \ ) \ _ __ ___ ___ ___(_) | | __ _ .::' / (~-~-~\\.-' / \' \::::. | '_ ` _ \ / _ \_ / | | |/ _` | :::' /..\ /..\__/ ' '::: | | | | | | (_) / /| | | | (_| | ::' vVVv vVVv ': |_| |_| |_|\___/___|_|_|_|\__,_| '' Hi there, nice to meet you! Interested in having a direct impact on hundreds of millions of users? Join Mozilla, and become part of a global community that's helping to build a brighter future for the Web. Visit https://careers.mozilla.org to learn about our current job openings. Visit https://www.mozilla.org/contribute for more ways to get involved and help support Mozilla. --- If you don't want to see this message next time, run this JS statement: Tabzilla.disableEasterEgg()
I love easter eggs! even though its advertising.
First post; still much to do...
My PGP-Keys and other stuff are at my public directory.