Skip to content

Instantly share code, notes, and snippets.

View lalinsky's full-sized avatar

Lukáš Lalinský lalinsky

View GitHub Profile
CREATE VIEW area_parent AS
SELECT entity0 AS parent, entity1 AS child FROM l_area_area WHERE link IN (
SELECT id FROM link WHERE link_type IN (
SELECT id FROM link_type WHERE gid = 'de7cc874-8b1b-3a05-8272-f3834c968fb7'
)
);
WITH
RECURSIVE area_root (leaf, id, name, root) AS (
SELECT area.id, area.id, area.name, area_parent.parent
create temporary table track_ac_count as select artist_credit, count(*) from track group by artist_credit;
create temporary table release_ac_count as select artist_credit, count(*) from release group by artist_credit;
create temporary table release_group_ac_count as select artist_credit, count(*) from release_group group by artist_credit;
create temporary table recording_ac_count as select artist_credit, count(*) from recording group by artist_credit;
create temporary table artist_credit_new as
select
artist_credit.id,
artist_credit.name,
artist_credit.artist_count,
server 1:
acoustid=> select * from track where id=1;
-[ RECORD 1 ]-+-------------------------------------
id | 1
gid | 4a7c2f1e-cf40-383c-a1c1-d1272d8234cd
recording | 8
medium | 872243
position | 30
@lalinsky
lalinsky / server.py
Created April 29, 2013 09:55
Example audio fingerprint server using Chromaprint
import chromaprint
from flask import Flask, request, jsonify
SQL_TABLES = """
CREATE TABLE IF NOT EXISTS fingerprint
(
id INTEGER PRIMARY KEY,
fingerprint TEXT NOT NULL
sub can_see_vote_count
{
my ($self, $editor) = @_;
my $editor_id = defined $editor ? $editor->id ? -1;
my $editor_is_involved =
$self->proposer_id == $editor_id ||
$self->candidate_id == $editor_id ||
(defined $self->seconder_1_id && $self->seconder_1_id == $editor_id) ||
(defined $self->seconder_2_id && $self->seconder_2_id == $editor_id);
@lalinsky
lalinsky / AcoustIDTest.vb
Last active December 14, 2015 21:39
AcoustID Compressed Request in VB.NET
Module AcoustIDTest
Sub Main()
Dim clientApiKey As String = "8XaBELgH"
Dim duration As Integer = 641
Dim fingerprint As String = "AQABz0qUkZK4oOfhL-CPc4e5C_wW2H2QH9uDL4cvoT8UNQ-eHtsE8cceeFJx-LiiHT-aPzhxoc-Opj_eI5d2hOFyMJRzfDk-QSsu7fBxqZDMHcfxPfDIoPWxv9C1o3yg44d_3Df2GJaUQeeR-cb2HfaPNsdxHj2PJnpwPMN3aPcEMzd-_MeB_Ej4D_CLP8ghHjkJv_jh_UDuQ8xnILwunPg6hF2R8HgzvLhxHVYP_ziJX0eKPnIE1UePMByDJyg7wz_6yELsB8n4oDmDa0Gv40hf6D3CE3_wH6HFaxCPUD9-hNeF5MfWEP3SCGym4-SxnXiGs0mRjEXD6fgl4LmKWrSChzzC33ge9PB3otyJMk-IVC6R8MTNwD9qKQ_CC8kPv4THzEGZS8GPI3x0iGVUxC1hRSizC5VzoamYDi-uR7iKPhGSI82PkiWeB_eHijvsaIWfBCWH5AjjCfVxZ1TQ3CvCTclGnEMfHbnZFA8pjD6KXwd__Cn-Y8e_I9cq6CR-4S9KLXqQcsxxoWh3eMxiHI6TIzyPv0M43YHz4yte-Cv-4D16Hv9F9C9SPUdyGtZRHV-OHEeeGD--BKcjVLOK_NCDXMfx44dzHEiOZ0Z44Rf6DH5R3uiPj4d_PKolJNyRJzyu4_CTD2WOvzjKH9GPb4cUP1Av9EuQd8fGCFee4JlRHi18xQh96NLxkCgfWFKOH6WGeoe4I3za4c5hTscTPEZTES1x8kE-9MQPjT8a8gh5fPgQZtqCFj9MDvp6fDx6NCd07bjx7MLR9AhtnFnQ70GjOcV0opmm4zpY3SOa7HiwdTtyHa6NC4e-HN-OfC5-OP_gLe2QDxfUCz_0w9l65HiPAz9-IaGO
diff --git a/mbslave-sync.py b/mbslave-sync.py
index 7b1fdfa..2c44285 100755
--- a/mbslave-sync.py
+++ b/mbslave-sync.py
@@ -172,6 +172,7 @@ status = StatusReport(schema_seq, replication_seq)
if config.monitoring.enabled:
status.load(config.monitoring.status_file)
+num_packets = 0
while True:
@lalinsky
lalinsky / gist:2821278
Created May 28, 2012 21:25
CMakeLists.txt for libofa
PROJECT(libofa)
SET(PROJECT_VERSION 0.1.1)
# 1. If the library source code has changed at all since the last update, then increment revision.
# 2. If any interfaces have been added, removed, or changed since the last update, increment current, and set revision to 0.
# 3. If any interfaces have been added since the last public release, then increment age.
# 4. If any interfaces have been removed since the last public release, then set age to 0.
SET(libofa_SOVERSION_CURRENT 0)
SET(libofa_SOVERSION_REVISION 2)
SET(libofa_SOVERSION_AGE 0)
@lalinsky
lalinsky / ingest.php
Created April 18, 2012 20:34
Simple audio fingerprint matching in PHP
<?php
include "utils.php";
$fp = parse_fp($_GET['fp']);
$dbh = new PDO('mysql:host=localhost;dbname=fingerprint', 'fingerprint');
$dbh->beginTransaction();
$sth = $dbh->prepare("INSERT INTO fp (length) VALUES (?)");
echo "DROP TYPE cover_art_presence;" | ./mbslave-psql.py
echo "ALTER TABLE release_meta DROP COLUMN cover_art_presence;" | ./mbslave-psql.py
./mbslave-import.py mbdump-derived.tar.bz2
./mbslave-sync.py
./mbslave-psql.py <sql/updates/20120105-caa-flag.sql
echo "UPDATE replication_control SET current_schema_sequence = 14;" | ./mbslave-psql.py
./mbslave-sync.py