Skip to content

Instantly share code, notes, and snippets.

View naftis's full-sized avatar
🔥
­

Pyry Rouvila naftis

🔥
­
View GitHub Profile
@naftis
naftis / locations.json
Created November 8, 2023 10:15
.well-known/locations.json
{"@context":{"@context":"http://spdci.org/","xsd":"http://www.w3.org/2001/XMLSchema#","schema":"http://schema.org/"},"lastUpdated":"2023-11-08T10:15:18.126+00:00","locations":[{"@type":"Place","additionalType":"ADMIN_STRUCTURE","identifier":[{"name":"opencrvs-location","identifier":"0e7f44ef-7f87-404b-99b0-d726b58c005d"}],"name":"Central","containedInPlace":null},{"@type":"Place","additionalType":"ADMIN_STRUCTURE","identifier":[{"name":"opencrvs-location","identifier":"fba1ee42-0634-4153-9832-823f8dfcfef4"}],"name":"Ibombo","containedInPlace":"0e7f44ef-7f87-404b-99b0-d726b58c005d"},{"@type":"Place","additionalType":"ADMIN_STRUCTURE","identifier":[{"name":"opencrvs-location","identifier":"47a36b06-4a51-4793-bfc2-4bf6e3e89c05"}],"name":"Sulaka","containedInPlace":null},{"@type":"Place","additionalType":"ADMIN_STRUCTURE","identifier":[{"name":"opencrvs-location","identifier":"26a6285f-3068-46db-ba79-213d3a4daa76"}],"name":"Ilanga","containedInPlace":"47a36b06-4a51-4793-bfc2-4bf6e3e89c05"},{"@type":"Place","addit
@naftis
naftis / get-a-token.txt
Last active November 2, 2023 10:05
Example payloads for DCI API
# POST /oauth2/client/token?client_id=31a0796d-a59d-417e-854c-da6f336e7d13&client_secret=54a1845c-6c75-4464-ab5c-4a59e6c1e3fc&grant_type=client_credentials
# Response
{
"access_token": "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzY29wZSI6WyJyZWNvcmRzZWFyY2giLCJkZW1vIl0sImlhdCI6MTY5NjkyOTQ3MSwiZXhwIjoxNjk2OTMwMDcxLCJhdWQiOlsib3BlbmNydnM6YXV0aC11c2VyIiwib3BlbmNydnM6dXNlci1tZ250LXVzZXIiLCJvcGVuY3J2czpoZWFydGgtdXNlciIsIm9wZW5jcnZzOmdhdGV3YXktdXNlciIsIm9wZW5jcnZzOm5vdGlmaWNhdGlvbi11c2VyIiwib3BlbmNydnM6d29ya2Zsb3ctdXNlciIsIm9wZW5jcnZzOnNlYXJjaC11c2VyIiwib3BlbmNydnM6bWV0cmljcy11c2VyIiwib3BlbmNydnM6Y291bnRyeWNvbmZpZy11c2VyIiwib3BlbmNydnM6d2ViaG9va3MtdXNlciIsIm9wZW5jcnZzOmNvbmZpZy11c2VyIiwib3BlbmNydnM6ZG9jdW1lbnRzLXVzZXIiXSwiaXNzIjoib3BlbmNydnM6YXV0aC1zZXJ2aWNlIiwic3ViIjoiNjUyNTExNDJmMjkyMTg3ZDc4YWY2ODJiIn0.Nx710qDGFzDfZqkdIQlXmg_TJQ0vQqroQu7d6qy15w8sP-20z4iIUuMSUsfUhb6CAGDfbZU6EKR8J8Zf9eB7PNPzDMoxnTHVo6918esdQdtYqYI9EdnLpWXOG2M2vdQouX6kWA9ybUOkExsTL8HNWF4yufJDyHcepgkITGzprpYlp-3EZhfDvLKu-z8LKJL1wEbH_120sxz9CzH7KnA2Oe
/*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*
* OpenCRVS is also distributed under the terms of the Civil Registration
* & Healthcare Disclaimer located at http://opencrvs.org/license.
*
* Copyright (C) The OpenCRVS Authors located at https://github.com/opencrvs/opencrvs-core/blob/master/AUTHORS.
*/
@naftis
naftis / slonik-multi-insert.ts
Created May 17, 2022 10:43
Insert multiple rows with Slonik
import { DatabaseConnection, sql } from "slonik";
import { pool } from "@database";
const exampleRows = [
{
id: "8b032b40-50c8-41e1-b1c6-c85f655f3004",
title: "Foo",
},
{
id: "f67d76a6-59ca-44cd-b75f-f7ce75bdec57",
aaz
abd
abj
abq
abw
abz
ach
acy
acz
adj
> [4/4] RUN pip3 install -r requirements.txt:
#8 2.096 Collecting absl-py==0.12.0
#8 2.674 Downloading absl_py-0.12.0-py3-none-any.whl (129 kB)
#8 3.293 Collecting astunparse==1.6.3
#8 3.384 Downloading astunparse-1.6.3-py2.py3-none-any.whl (12 kB)
#8 3.701 Collecting blis==0.2.4
#8 3.794 Downloading blis-0.2.4.tar.gz (1.5 MB)
#8 72.9
@naftis
naftis / pizzaonline.user.js
Created June 30, 2019 14:18
pizza online sorter
// ==UserScript==
// @name sort pizzaonline
// @namespace Violentmonkey Scripts
// @match https://pizza-online.fi/restaurants/*
// @grant none
// ==/UserScript==
const items = [...document.querySelectorAll('.vendor-list > li')].map(
originalNode => {
const node = originalNode.cloneNode(true);
@naftis
naftis / aanestyspaikat.json
Last active April 2, 2023 06:31
Eduskuntavaalien äänestyspaikat JSON-muodossa postinumeroineen
{
"stations": [
{
"polling_municipality_code": "091",
"polling_district_code": "001A",
"zip_code": "00170",
"address": "Pohjoisesplanadi 11-13, Helsinki"
},
{
"polling_municipality_code": "091",
@naftis
naftis / autoexec.cfg
Last active June 4, 2021 18:20
autoexec
voice_enable 1
voice_scale 0.6
gameinstructor_enable 0
cl_use_opens_buy_menu 0
fps_max 0
cl_autowepswitch 0
cl_teamid_overhead_always 2 // Always show team id over teammates. 1 = pips; 2 = pips, name, and equipment
r_dynamic "1" // Guns and grenades give light to dark areas
r_drawtracers_firstperson "1" // Draw tracers
public class StringStats {
private static boolean isBadCharacter(char examinedChar) {
final String badCharacters = ",.;:?!'\"/()";
boolean isBad = false;
for(int n = 0; n < badCharacters.length(); n++) {
char badCharacter = badCharacters.charAt(n);
if(badCharacter == examinedChar) {
isBad = true;