Skip to content

Instantly share code, notes, and snippets.

@Podbrushkin
Podbrushkin / readme.md
Created January 15, 2025 14:45
Kinopoisk Download Votes

Powershell 7

Get-ChildItem *.html | ForEach-Object {
	$html = Get-Content -Raw $_
	$items = $html | Select-String '(?smi)\n {32}(<div class="item.*?)\n {32}</div>' -allmatches | % Matches | % {$_.Groups[1].Value}
	$items | % {
		$num = $_ -match '.*<div class="num">(\d*)</div>.*' ? $Matches[1] : $null
		$href,$title = $_ -match '.*<div class="nameRus"><a href="(.*?)">(.*?)<.*' ? $Matches[1,2] : $null
		$titleEn = $_ -match '.*<div class="nameEng">(.*?)<.*' ? $Matches[1] : $null
		$date = $_ -match '.*<div class="date">(.*?)<.*' ? $Matches[1] : $null
@Podbrushkin
Podbrushkin / recon.ps1
Created October 4, 2024 08:05
Wikidata Reconciliation Powershell
function Convert-PersonToQuery ([pscustomobject]$Person, [switch]$PreciseDate = $false) {
$properties = @()
$birthDates = @()+$person.birthdate+$person.birthdates | ? {$_} | % {[string]$_}
foreach ($bd in $birthDates) {
if ($bd.length -eq 10 -and $PreciseDate) {
$properties += @{pid = 'P569'; v = $bd};
} else {
$properties += @{pid = 'P569@year'; v = $bd.substring(0,4)};
}
@Podbrushkin
Podbrushkin / GraphvizFunction.java
Created September 26, 2024 12:00
Neo4j Export to Graphviz
package myapp;
import java.util.HashSet;
import java.util.Set;
import org.neo4j.graphdb.Node;
import org.neo4j.graphdb.Relationship;
import org.neo4j.procedure.Description;
import org.neo4j.procedure.Name;
import org.neo4j.procedure.UserAggregationFunction;
@Podbrushkin
Podbrushkin / .md
Created September 24, 2024 14:47
Neo4j Tutor

Install Neo4j from ZIP

$url = 'http://dist.neo4j.org/neo4j-community-5.22.0-windows.zip'
$name = ($url -split '/')[-1]

# Download:
Invoke-RestMethod $url -OutFile "~\Downloads\$name"

# Extract:
Expand-Archive "~\Downloads\$name" "~\AppData\Local\Programs"
@Podbrushkin
Podbrushkin / GraphApplication.java
Created November 23, 2023 15:01
Neo4j Embedded with Apoc plugin, export database to Cypher file
package myapp;
import java.io.IOException;
import java.nio.file.Path;
import java.util.List;
import java.util.Map;
import org.neo4j.configuration.connectors.BoltConnector;
import org.neo4j.configuration.helpers.SocketAddress;
import org.neo4j.dbms.api.DatabaseManagementServiceBuilder;
@Podbrushkin
Podbrushkin / GraphApplication.java
Created November 23, 2023 13:44
Neo4j Embedded Example
package myapp;
import java.io.IOException;
import java.nio.file.Path;
import java.util.List;
import java.util.Map;
import org.neo4j.configuration.GraphDatabaseSettings;
import org.neo4j.configuration.GraphDatabaseSettings.LogQueryLevel;
import org.neo4j.configuration.connectors.BoltConnector;
@Podbrushkin
Podbrushkin / DemoApplication.java
Created November 14, 2023 23:29
Spring Data Neo4j MRE
package myapp;
import java.io.File;
import java.time.Duration;
import java.time.LocalDate;
import org.neo4j.configuration.GraphDatabaseSettings;
import org.neo4j.configuration.connectors.BoltConnector;
import org.neo4j.cypherdsl.core.renderer.Configuration;
import org.neo4j.cypherdsl.core.renderer.Dialect;