Skip to content

Instantly share code, notes, and snippets.

@maksverver
maksverver / Test output (baseline)
Created Feb 16, 2020
sqlite3 UTF16 conversion bugs
View Test output (baseline)
SQLite version 3.32.0 (2020-02-03 12:25:18 8130bbb4217bd4a4db1f6bf97115a60bee8b29943bed0c7bdf54bba5edbed8fc)
Input: 6600 6f00 6f00 2000 2400 2000 6200 6100 7200 (UTF-16)
Expected output: 66 6f 6f 20 24 20 62 61 72 (UTF-8)
Actual output: 66 6f 6f 20 24 20 62 61 72 (UTF-8)
Expected output: 6600 6f00 6f00 2000 2400 2000 6200 6100 7200 (UTF-16)
Actual output: 6600 6f00 6f00 2000 2400 2000 6200 6100 7200 (UTF-16)
Test passed.
Input: 6600 6f00 6f00 2000 3dd8 a9dc 2000 6200 6100 7200 (UTF-16)
@maksverver
maksverver / PKGBUILD
Created Dec 28, 2019
gog-stardew-valley 1.4.3.379
View PKGBUILD
# Maintainer: Dan Beste <drb@wishalloy.io>
pkgname='gog-stardew-valley'
pkgver=1.4.3.379
pkgrel=1
# Fix upstream versioning shenanigans:
epoch=1
pkgdesc="You’ve inherited your grandfather’s old farm plot in Stardew Valley.
Armed with hand-me-down tools and a few coins, you set out to begin your new
life."
@maksverver
maksverver / 14.c
Created Dec 14, 2018
Advent of Code 2018 day 14
View 14.c
#include <stdio.h>
#include <stdlib.h>
static int *scores;
static size_t size;
static size_t capacity;
static int current;
void AddScore(int x) {
if (size == capacity) {
@maksverver
maksverver / 14.py
Created Dec 14, 2018
Advent of Code 2018 day 14
View 14.py
from itertools import islice
import sys
def Generate():
scores = [3, 7]
yield scores[0]
yield scores[1]
i = 0
j = 1
while True:
@maksverver
maksverver / 09.c
Created Dec 9, 2018
Advent of Code 2018 day 9 in C
View 09.c
#include <stdio.h>
#include <stdlib.h>
int Solve(int players, int marbles) {
int *scores = calloc(players, sizeof(int));
int *prev = calloc(marbles, sizeof(int));
int *next = calloc(marbles, sizeof(int));
int i = 0;
for (int j = 1; j < marbles; ++j) {
if (j%23 != 0) {
View sqlite3-utf16-unpaired-surrogates.c
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sqlite3.h>
void insert_utf8(sqlite3 *db, const char *text) {
sqlite3_stmt *stmt = NULL;
int err = sqlite3_prepare(db, "INSERT INTO tab(col) VALUES (?)", -1, &stmt, NULL);
assert(err == SQLITE_OK);
@maksverver
maksverver / ScrambledWords.cc
Created Mar 25, 2018
Kickstart Round A 2018 - problem C: Scrambled Words
View ScrambledWords.cc
// https://code.google.com/codejam/contest/9234486/dashboard#s=p2&a=2
#include <bits/stdc++.h>
using namespace std;
namespace {
struct Key {
char first, last;
View 3B.py
from collections import defaultdict
import sys
N = int(sys.stdin.readline())
grid = defaultdict(lambda: 0)
grid[0, 0] = 1
x, y = 0, 0
dx, dy = 1, 0
while grid[x, y] <= N:
@maksverver
maksverver / PKGBUILD
Created Jul 16, 2017
Fix for Katawa Shoujo with Ren'Py > 6.99.10
View PKGBUILD
# Based on original katawa-shoujo PKGBUILD (but use native renpy instead of bundled one) written by Anton Larionov <diffident dot cat at gmail dot com>
# Maintainer: Cravix < dr dot neemous at gmail dot com >
pkgname=katawa-shoujo
pkgver=1.3.1
pkgrel=2
pkgdesc="a bishoujo-style visual novel by Four Leaf Studios built on renpy"
arch=('any')
url='http://katawa-shoujo.com/'
license=('CCPL:BY-NC-ND')
@maksverver
maksverver / PKGBUILD
Created Jul 6, 2017
Golly 2.8 PKGBUILD
View PKGBUILD
# Maintainer: Kyle Sferrazza <kyle.sferrazza@gmail.com>
# Contributor: Maks Verver <maksverver@geocities.com>
# Contributor: p2k <Patrick.Schneider@uni-ulm.de>
# Contributor: nokangaroo <nokangaroo@aon.at>
pkgname=golly
pkgver=2.8
pkgrel=3
pkgdesc="A simulator for Conway's Game of Life and other cellular automata"
arch=('i686' 'x86_64')
You can’t perform that action at this time.