Skip to content

Instantly share code, notes, and snippets.

@arildm
arildm / saldo-5words.py
Created September 3, 2022 14:00
Script for generating a Swedish word list for Wordle
import xml.etree.ElementTree as ET
# Get saldo.xml at https://spraakbanken.gu.se/resurser/saldo
tree = ET.parse('saldo.xml')
root = tree.getroot()
words = set()
chars = set()
for fr in root.findall(".//FormRepresentation"):
pos_el = fr.find("./feat[@att='partOfSpeech']")
@arildm
arildm / vue-3-workshop.md
Last active February 23, 2022 13:04
Anteckningar inför workshop i Vue.js 3

Vue.js 3 workshop

Anteckningar

Prerequisites

  • Node.js ≥16, npm 8

Init

  1. npm init vue@latest
    • Välj No på allt
  2. cd <projektnamn>
@arildm
arildm / gatunamn.py
Created June 12, 2019 07:44
Scrapes svenskaplatser.se and outputs a headerless csv with {city},{streetname}
import requests
from lxml.cssselect import CSSSelector
from lxml.html import fromstring
SITE = 'https://www.svenskaplatser.se/'
def links(url, selector):
html = requests.get(SITE + url).content.decode()
tree = fromstring(html)
sel = CSSSelector(selector)
<?php
/**
* @file
* Contains \Drupal\mymodule\Feeds\Target\EntityReferenceDefaultValue.
*/
namespace Drupal\mymodule\Feeds\Target;
use Drupal\Core\Form\FormStateInterface;
use Drupal\feeds\Exception\EmptyFeedException;
@arildm
arildm / unity.log
Created March 25, 2013 16:02
Output of running `unity --replace --verbose --log unity.log` from "Classic Gnome (no effects)".
compiz (core) - Info: Loading plugin: core
compiz (core) - Debug: Trying to load core from: /home/arla/.compiz-1/plugins/libcore.so
compiz (core) - Debug: dlopen failed: /home/arla/.compiz-1/plugins/libcore.so: cannot open shared object file: No such file or directory
compiz (core) - Debug: Trying to load core from: /usr/lib/compiz/libcore.so
compiz (core) - Debug: dlopen failed: /usr/lib/compiz/libcore.so: cannot open shared object file: No such file or directory
compiz (core) - Info: Starting plugin: core
compiz (core) - Debug: Started plugin: core
compiz (core) - Debug: pending request:
compiz (core) - Debug: - event serial: 760
compiz (core) - Debug: - event window 0x3400090
2013-03-21 14:13:55 startup archives unpack
2013-03-21 14:14:09 upgrade perl:amd64 5.14.2-13ubuntu0.1 5.14.2-13ubuntu0.2
2013-03-21 14:14:09 status half-configured perl:amd64 5.14.2-13ubuntu0.1
2013-03-21 14:14:09 status unpacked perl:amd64 5.14.2-13ubuntu0.1
2013-03-21 14:14:09 status half-installed perl:amd64 5.14.2-13ubuntu0.1
2013-03-21 14:14:10 status triggers-pending man-db:amd64 2.6.3-1
2013-03-21 14:14:11 status half-installed perl:amd64 5.14.2-13ubuntu0.1
2013-03-21 14:14:11 status half-installed perl:amd64 5.14.2-13ubuntu0.1
2013-03-21 14:14:12 status unpacked perl:amd64 5.14.2-13ubuntu0.2
2013-03-21 14:14:12 status unpacked perl:amd64 5.14.2-13ubuntu0.2
type IP a = State -> (State,a)
data State
andThen :: IP a -> (a -> IP b) -> IP b
f `andThen` g = \s0 -> let (s1,a) = f s0
(s2,b) = g a s1
in (s2,b)
instance Monad IP where
(>>=) = andThen
@arildm
arildm / Top 25 Doctor Who (1963) Episodes.txt
Created October 26, 2012 09:09
Episodes from referenced IMDb list, with episode numbers added
http://www.imdb.com/list/b_36JCbyaYw/
01. s13e82 Pyramids of Mars
02. s26e158 The Curse of Fenric
03. s21e136 The Caves of Androzani
04. s12e78 Genesis of the Daleks
05. s17e105 City of Death
06. s13e84 The Brain of Morbius
07. s25e152 Remembrance of the Daleks
08. s19e122 Earthshock
09. s13e81 Planet of Evil
@arildm
arildm / gist:31adc344b2028d29b5d7
Created May 28, 2015 12:09
Serialized CollectJsonSchema plugin instance, pretty-printed
array(25) {
'#attributes' =>
array(1) {
'class' =>
array(2) {
[0] =>
string(23) "collect-processing-form"
[1] =>
string(19) "collect-schema-form"
}
@arildm
arildm / gist:fa179613ffe6bb1e5d4b
Created May 28, 2015 11:40
Serialized CollectJsonSchema plugin instance
a:25:{s:11:"#attributes";a:1:{s:5:"class";a:2:{i:0;s:23:"collect-processing-form";i:1;s:19:"collect-schema-form";}}s:8:"#process";a:1:{i:0;s:13:"::processForm";}s:12:"#after_build";a:1:{i:0;s:12:"::afterBuild";}s:20:"processor_add_select";a:3:{s:5:"#type";s:6:"select";s:6:"#title";s:13:"Add processor";s:8:"#options";a:2:{s:16:"activity_creator";O:48:"Drupal\Core\StringTranslation\TranslationWrapper":3:{s:9:"*string";s:16:"Activity creator";s:12:"*arguments";a:0:{}s:10:"*options";a:0:{}}s:15:"contact_matcher";O:48:"Drupal\Core\StringTranslation\TranslationWrapper":3:{s:9:"*string";s:15:"Contact matcher";s:12:"*arguments";a:0:{}s:10:"*options";a:0:{}}}}s:20:"processor_add_submit";a:5:{s:5:"#type";s:6:"submit";s:6:"#value";s:3:"Add";s:7:"#submit";a:1:{i:0;s:20:"::submitAddProcessor";}s:24:"#limit_validation_errors";a:1:{i:0;a:1:{i:0;s:20:"processor_add_select";}}s:5:"#ajax";a:3:{s:7:"wrapper";s:24:"processors-table-wrapper";s:8:"callback";a:2:{i:0;O:34:"Drupal\collect\Form\ProcessingForm":9:{s:12:"*