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
# Ensure fpcalc (AcoustID fingerprinter) is installed and in PATH | |
# Ensure TagLibSharp is installed via NuGet: Install-Package TagLibSharp | |
using namespace TagLib | |
$config = @{ | |
AcoustIdApiKey = "useyoursplease" | |
AcoustIdApiUrl = "https://api.acoustid.org/v2/lookup" | |
} | |
$programFilesPath = Get-ChildItem -Path 'C:\Program Files\PackageManagement\NuGet\' -Filter TagLibSharp.dll -Recurse -ErrorAction SilentlyContinue -Depth 6 | |
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
-- Query to retrieve CSS keys and corresponding URLs from WordPress tables | |
-- tested against mysql 5.x | |
-- table prefix is wpjg | |
-- generated with assistance from Claude | |
SELECT | |
c.css_key, | |
CASE | |
WHEN c.css_key = 'homepage' THEN home.option_value |
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
# Set the target database connection details | |
# these are default for the ragis lectures | |
$remoteHost = "34.118.61.196" | |
$databaseName = "ragis" | |
$targetSrid = 7801 # | |
if ($args.Count -lt 2) { | |
Write-Host "Usage: bulk.import.ps1 [source dir] [target schema]" |
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
-- notes: | |
-- Use a CROSS JOIN when you need a simple Cartesian product without any dependency between the rows of the joined tables. | |
-- Use a CROSS JOIN LATERAL when the second table's rows depend on values from the first table's current row, allowing for | |
-- dynamic and row-specific computations during the join process. This is powerful for queries requiring a contextual | |
-- relationship between the data sets. Lateral means "to the side" | |
-- | |
-- using CROSS JOIN and subquery | |
SELECT * FROM ( |
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
<xsl:stylesheet version="1.0" | |
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> | |
<!-- Template to process objectdefs and descend into module_name/objectdef/objectprop and match metaprops --> | |
<xsl:template match="import | objectdefs | objectdefs/* | objectdefs/*/* | objectdefs/*/*/* "> | |
<xsl:copy> | |
<xsl:apply-templates select="*"/> | |
</xsl:copy> | |
</xsl:template> |
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
# geocoding a source CVS with google maps | |
# and then feed into a table in PostGIS | |
# | |
# interestingly some parts of the code were created with ChatGPT4 | |
# but the output, of course, had to be revised a little | |
# | |
# license CC-Attribution | |
3 | |
import 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
SELECT distinct | |
upper(CAST (keywords.str AS varchar2(32))) AS keyword, | |
JP.pkey || '-' || JI.issuenum AS issuekey | |
FROM | |
JIRAACTION jA | |
JOIN jiraissue JI ON | |
JA.issueid = JI.id | |
JOIN project JP ON | |
JI.project = JP.id | |
CROSS JOIN lateral |
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
function Find-Files { | |
[CmdletBinding()] | |
param( | |
[Parameter()] [string] $Glob, | |
[Parameter()] [string] $Path = (Get-Location)) | |
if (-not ( $Path -match '^\w:' ) ) { | |
$Path = (Get-Location).Path + '\' + $Path | |
} |
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
$comDoc = New-Object -Com 'HTMLFile' | |
# load the wiki content | |
$res = Invoke-WebRequest $webLocation | |
# create a webview | |
$comDoc.Write( [System.Text.Encoding]::Unicode.GetBytes($res.Content) ) | |
# query DOM | |
$elems = $comDoc.querySelector('table.prettytable') | |
# unfortunately querySelectorAll fails for various reasons | |
# so we have to enumerate the items manually | |
$codes = $elems.childNodes().item(0).childNodes() ` |
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
-- listing only records that appear more than twice | |
-- in result which finds points within areas | |
-- | |
-- the partitioning allows us to figure the results | |
-- alongside corresponding dulplicate areas | |
-- | |
-- the n.type may be skipped, is included as aexample | |
select * from ( | |
select |
NewerOlder