This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# aus ct http://epaper.heise.de/download/archiv/d797d41f4c80/ct.16.06.160.pdf | |
# create image | |
sudo apt-get install gddrescue | |
lsblk -f -o +SIZE,MODEL | |
sudo ddrescue /dev/sdx image.img | |
cp image.img image.img.bak | |
# rescue files |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Import-CSV SomeFile.csv | Select *,LINENUMBER | ForEach-Object -Begin { $Line = 1 } { | |
$_.LineNumber = $Line++ | |
$_ | |
} | Export-CSV SomeFile.csv |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# several commands via Invoke-RestMethod | |
$request = 'https://piwikdomain/index.php?module=API&method=Live.getLastVisitsDetails&idSite=1&period=day&date=today&format=JSON&token_auth=<token>' | |
$RestCall = Invoke-RestMethod -Uri $request | |
$RestCall | Export-Csv -Delimiter "`t" -Encoding "UTF8" -path whatever1.csv -NoTypeInformation | |
# single line with pipes | |
$request = 'https://piwikdomain/index.php?module=API&method=Live.getLastVisitsDetails&idSite=1&period=day&date=today&format=JSON&token_auth=<token>' | |
( Invoke-RestMethod -Uri $request ) | Select * | Export-Csv -Delimiter "`t" -Encoding "UTF8" -path whatever2.csv -NoTypeInformation |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[System.Uri]$endpoint = "https://login.mailingwork.de/webservice/webservice/json/" | |
$verb = 'getmailings' | |
$params = @{ | |
username='<username>' | |
password='<password>' | |
} | |
$result = Invoke-RestMethod -Uri "$($endpoint)$($verb)" -Method POST -Body $params -Verbose |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"DELETE FROM jobs WHERE rowid NOT IN (SELECT min(rowid) FROM jobs GROUP BY JobId)" | .\sqlite3.exe .\jobs2.sqlite | |
"VACUUM" | .\sqlite3.exe .\jobs2.sqlite |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# create empty array for all server network interfaces | |
$server=@() | |
# run through every datacenter and append every single server to a list | |
( profitbricks datacenter list --json | ConvertFrom-JSON ) | ForEach { | |
# append data from the datacenter | |
$dataCenterId = $_.Id | |
$dataCenterName = $_.Name | |
$dataCenterLocation = $_.Location |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
{ | |
"link": "https://www.example.com/datenschutzbestimmungen", | |
"title": "Datenschutz" | |
}, | |
{ | |
"link": "https://newsletterpopup.de", | |
"title": "Datenschutz_Newsletter" | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# cool function to create a date output in another locale | |
# SOURCE: https://stackoverflow.com/questions/2379514/powershell-formatting-values-in-another-culture | |
function Using-Culture ([System.Globalization.CultureInfo]$culture =(throw "USAGE: Using-Culture -Culture culture -Script {scriptblock}"), | |
[ScriptBlock]$script=(throw "USAGE: Using-Culture -Culture culture -Script {scriptblock}")) | |
{ | |
$OldCulture = [System.Threading.Thread]::CurrentThread.CurrentCulture | |
$OldUICulture = [System.Threading.Thread]::CurrentThread.CurrentUICulture | |
try { | |
[System.Threading.Thread]::CurrentThread.CurrentCulture = $culture | |
[System.Threading.Thread]::CurrentThread.CurrentUICulture = $culture |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<######################### | |
LINKS | |
#########################> | |
<# | |
resource: https://devops.profitbricks.com/api/s3/ | |
https://gist.github.com/chrismdp/6c6b6c825b07f680e710 | |
https://gist.github.com/tabolario/93f24c6feefe353e14bd |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Inspiration: https://www.pipperr.de/dokuwiki/doku.php?id=windows:powershell_oracle_db_abfragen | |
# https://docs.microsoft.com/de-de/dotnet/framework/data/adonet/retrieving-and-modifying-data | |
$assemblyFile = "C:\PathToDLL\System.Data.SQLite.dll" # download precompiled binaries for .net or "System.Data.SQLite" | |
$connString = 'Data Source="file.sqlite";Version=3;' | |
$sqlCommand = "Select * from households limit 100" | |
[Reflection.Assembly]::LoadFile($assemblyFile) | |