Skip to content

Instantly share code, notes, and snippets.

View Abbe98's full-sized avatar
📧
Tons of notifications here, send me an email instead.

Albin Larsson Abbe98

📧
Tons of notifications here, send me an email instead.
View GitHub Profile
@Abbe98
Abbe98 / soch.js
Last active March 2, 2020 18:45
Detta är ett ganska minimalt exempel på användning av SOCH
// Detta är ett ganska minimalt exempel på användning av SOCH
// Notera att det saknas felhantering vid HTTP fel
// Notera även att sochSearch() inte stödjer paginering och att den använder presentationsformatet
// Det går att klistra in detta exempel direkt i webbläsarens konsol
// Det går inte att göra frågor från andra HTTPS resurser
// hjälp funktion för att göra http frågor och parsa JSON
const fetchSoch = async (url) => await (await fetch(url, { headers: new Headers({ 'Accept': 'application/json' }) })).json();
// funktion för att göra en enkel sökning
@Abbe98
Abbe98 / count_images_without_license_by_org.rq
Last active April 21, 2019 19:32
SparQL queries for K-Samsök
SELECT DISTINCT ?sOrg (COUNT(?item) AS ?count) WHERE {
OPTIONAL { ?item <http://kulturarvsdata.se/ksamsok#serviceOrganization> ?sOrg . }
?item <http://kulturarvsdata.se/ksamsok#image> ?image .
FILTER NOT EXISTS { ?image <http://kulturarvsdata.se/ksamsok#mediaLicenseUrl> ?license }
} GROUP BY ?sOrg
import re
import sys
import pywikibot
import bbr
from pywikibot import pagegenerators
from tqdm import tqdm
pywikibot.handle_args(sys.argv[1:])
var mapillaryEndpoint = 'https://a.mapillary.com/v3/images?client_id=WHZlUV9FNXhFZ24xZEZQRHZzUlZ3QToyZjg5ZWI2YzQ1Zjg0ZWJm&radius=50&closeto=';
var style = '\
#mapillary-container {\
position: absolute;\
left: 0;\
right: 0;\
top: 0;\
z-index: 3000;\
background: #FFF;\
min-height: 100vh;\
@Abbe98
Abbe98 / getVideoDetails.py
Created September 25, 2017 16:13 — forked from jaivikram/getVideoDetails.py
Python gist to obtain video details like duration, resolution, bitrate, video codec and audio codec, frequency using 'ffmpeg'
#! /usr/bin/env python
import os
import sys
import re
import tempfile
def getVideoDetails(filepath):
tmpf = tempfile.NamedTemporaryFile()
os.system("ffmpeg -i \"%s\" 2> %s" % (filepath, tmpf.name))
lines = tmpf.readlines()
@Abbe98
Abbe98 / Leaflet.Slider.css
Last active April 24, 2017 17:22
Another Leaflet example
/*
* Leaflet Slider plugin Albin Larsson MIT 2016-2017
*/
.LeafletSlider {
width: calc(100% - 30px);
margin-left: 15px;
margin-right: 15px;
user-select: none;
height: 30px;
}
@Abbe98
Abbe98 / README.md
Last active April 24, 2017 16:19
Basic Leaflet introduction example

Leaflet exempel 1

Detta exemplet avser att visa hur du kan:

  • Skapa en karta.
  • Lägga till flera kartlager.
  • Göra ett urval av dessa lager valbara.
  • Visa geometrier på kartan och göra dessa klickbara.

Tips

@Abbe98
Abbe98 / temp.xml
Last active February 10, 2017 23:21
<?xml version="1.0" encoding="utf-8"?>
<!--
Course setting symbol list
This contains a list of the IOF symbols for control
descriptions, 2004 version.
Each symbol is described in a coordinate system where the
enclosing box is 200x200 units, and the center of the box is
@Abbe98
Abbe98 / example.js
Created February 10, 2017 13:41
Example of the stream.wikimedia.org API
var url = 'https://stream.wikimedia.org/v2/stream/recentchange';
var eventSource = new EventSource(url);
eventSource.onmessage = function(event) {
var data = JSON.parse(event.data);
if (data.server_name == 'sv.wikipedia.org') {
console.log(event)
}
}
@Abbe98
Abbe98 / neo4j_cypher_cheatsheet.md
Created January 26, 2017 15:37 — forked from DaniSancas/neo4j_cypher_cheatsheet.md
Neo4j's Cypher queries cheatsheet

Neo4j Tutorial

Fundamentals

Store any kind of data using the following graph concepts:

  • Node: Graph data records
  • Relationship: Connect nodes (has direction and a type)
  • Property: Stores data in key-value pair in nodes and relationships
  • Label: Groups nodes and relationships (optional)