Skip to content

Instantly share code, notes, and snippets.

View gitfvb's full-sized avatar

Florian von Bracht gitfvb

View GitHub Profile
@gitfvb
gitfvb / readme.md
Created May 6, 2024 14:59
Useful SQLServer Queries

Show last queries and parameter

SELECT TOP 1000 * FROM(SELECT COALESCE(OBJECT_NAME(s2.objectid),'Ad-Hoc') AS ProcName,
  execution_count,s2.objectid,
    (SELECT TOP 1 SUBSTRING(s2.TEXT,statement_start_offset / 2+1 ,
      ( (CASE WHEN statement_end_offset = -1
  THEN (LEN(CONVERT(NVARCHAR(MAX),s2.TEXT)) * 2)
ELSE statement_end_offset END)- statement_start_offset) / 2+1)) AS sql_statement
@gitfvb
gitfvb / README.md
Last active March 28, 2024 20:14
Some notes about the usage of hyperion

Here I can write down some notes

@gitfvb
gitfvb / readme.md
Last active March 23, 2024 12:04
Notes on Quelima R3 WiFi Camera

First

  • Install the app "Sports DV" and change WiFi SSID and password

URLs

  • Wifi and Cam settings are seperated and have different port numbers.
  • Wifi-Settings (just login withoug username and password): http://192.168.25.1
  • Cam LiveStream: http://192.168.25.1:8080/?action=stream
  • Not sure how the configuration is made really... Would need a Man-In-The-Middle-Attack or send the initial ICMP package

Change AP (Cam is the access point) to Station (Cam is a normal WiFi Client)

@gitfvb
gitfvb / README.MD
Last active March 15, 2024 08:51
Just a small note of how I configured my Wemos D1 Mini ESP32 to read a smartmeter (eBZ) and control my door bell

Compilation of Tasmota

Done via vscode and PlatformIO

Changes to compile in platform.ini

platform                    = espressif32
board                       = wemos_d1_mini32
@gitfvb
gitfvb / aws_s3.ps1
Created May 16, 2018 17:41
native powershell for AWS S3
<#########################
LINKS
#########################>
<#
resource: https://devops.profitbricks.com/api/s3/
@gitfvb
gitfvb / timer.ps1
Created September 4, 2020 14:26
A timer in PowerShell controlled through a "tick" event instead of a start-sleep. Script can be run standalone out of the box.
<#
Good example inspired from here
https://gist.github.com/SteveGilham/98a39f621cfed70bfa0a
To explore possible events, type in
$timer | gm
#>
@gitfvb
gitfvb / readme.md
Last active February 1, 2024 08:40
Small script to remove linebreaks of the postcode file of https://www.suche-postleitzahl.org

Steps

  1. Execute this line iwr -Uri "https://gist.githubusercontent.com/gitfvb/eb35179beffac8756c9fc899c0387418/raw/50c0a506590e238a5a363438fa83912205b66bd4/reformat.ps1" -UseBasicParsing | iex in PowerShell (tested with 5.1 and Core). A shortened url can be used like iwr -Uri " https://clvr.ch/postcode" -UseBasicParsing | iex
  2. This script downloads and reformats the file to remove linebreaks that could interrupt the interpretation
  3. You will find the final file in your downloads folder with the name plz_einwohner.csv
  4. Upload the file to FastStats and test it with this expression strlist(numericlistfromfile("Public:\plz_einwohner.csv",1,1)) -> replace the , with ; in a German FastStats
  5. With the following expression you could then access the number of residents
@gitfvb
gitfvb / readme.md
Created January 8, 2024 10:45
Helpful queries for SQLServer

Show tables with rows and size

SELECT
t.NAME AS TableName,
MAX(p.rows) AS RowCounts,
(SUM(a.total_pages) * 8) / 1024.0 as TotalSpaceMB,
(SUM(a.used_pages) * 8) / 1024.0 as UsedSpaceMB,
(SUM(a.data_pages) * 8) /1024.0 as DataSpaceMB
@gitfvb
gitfvb / readme.md
Last active January 6, 2024 22:14
Compress PDF with ghostscript on Windows and DO NOT upload it somewhere in the cloud

You can use this example command in PowerShell or maybe CMD

& "C:\Program Files\gs\gs10.01.1\bin\gswin64c.exe" -q -dNOPAUSE -dBATCH -dSAFER -sDEVICE=pdfwrite -dCompatibilityLevel="1.4" -dPDFSETTINGS=/screen -dEmbedAllFonts=true -dSubsetFonts=true -dColorImageDownsampleType=/Bicubic -dColorImageResolution=144 -dGrayImageDownsampleType=/Bicubic -dGrayImageResolution=144 -dMonoImageDownsampleType=/Bicubic -dMonoImageResolution=144 -sOutputFile="output.pdf" "input.pdf"
@gitfvb
gitfvb / geocode.ps1
Created January 24, 2017 09:01
GeoCoding with OSM, Bing and Google through the PowerShell - no addon needed
# https://msdn.microsoft.com/en-us/library/dn894107.aspx
<#
.Synopsis
This function uses the Google Maps API to Geocode an address.
.DESCRIPTION
This function uses the Google Maps API to Geocode an address by sending a web request to the API and then processes the resulting XML file for the longitude & latitude. The Google API has a threshold and when violated, you get an OVER_QUERY_LIMIT error based on the number of calls made per second and per day. If the function encounters this error it will pause for 2 seconds and throw a warning. If two subsequent calls fail, then the daily max call may have been reached and it will error out.
.EXAMPLE
PS C:\> "7171 Southwest Parkway, Austin, TX" | Get-GeoCode