Skip to content

Instantly share code, notes, and snippets.

View Xydez's full-sized avatar

Johannes Xydez

  • Sweden
View GitHub Profile
@Xydez
Xydez / backside.html
Last active April 4, 2024 12:17
Anki template - Japanese definition
<div class="with-furigana">
{{FrontSide}}
</div>
<hr id="answer">
<div class="card-back">
<div class="row hide-if-empty">
{{#CharactersReading}}<div class="reading" lang="ja">{{CharactersReading}}</div>{{/CharactersReading}}
{{#CharactersKanji}}<div class="kanji-form" lang="ja">【{{CharactersKanji}}】</div>{{/CharactersKanji}}
@Xydez
Xydez / gist:9d2e250e54501b2983b07d2565cead93
Last active October 3, 2023 07:43
"watermark not defined for continuous aggregate" - TimescaleDB refresh continuous aggregate fails

"watermark not defined for continuous aggregate"

What is this?

It probably means you need to set your continuous aggregate watermarks to zero before refreshing them.

Run this SQL to see your continous assgregates.

SELECT

view_name,

@Xydez
Xydez / _elevation.scss
Created September 30, 2021 14:59
Material Design Shadows - Sass mixin
/**
* Material design shadow mixin
*
* All credit goes to the Angular Material
* See https://github.com/angular/components/blob/master/src/material/core/style/_elevation.scss
*/
@use "sass:map";
@use "sass:math";
@use "sass:meta";
@Xydez
Xydez / skola24.ts
Last active September 1, 2021 16:40
Interface for the Skola24 API written in TypeScript
import axios from "axios";
export interface Lesson {
from: string,
to: string,
name: string,
teacher?: string,
classroom?: string
}
@Xydez
Xydez / Ripple.scss
Created August 19, 2021 16:27
Vue Ripple effect
.ripple {
position: relative;
overflow: hidden;
}
.ripple-element {
display: inline-block;
position: absolute;
background-color: red;
border-radius: 50%;
use typemap::TypeMap;
pub trait Event: 'static {}
type ListenerVec<E> = Vec<Box<dyn FnMut(&E)>>;
pub struct EventDispatcher {
listeners: TypeMap
}
@Xydez
Xydez / Config.ts
Created July 1, 2021 16:25
Lightweight and simple config loader
import fs from "fs/promises";
export default class Config<T> {
private constructor(private path: string, public value: T) {}
public static async load<T>(path: string, default_value?: T): Promise<Config<T>> {
try {
const data = await fs.readFile(path);
return new Config<T>(path, JSON.parse(data.toString("utf-8")) as T);
@Xydez
Xydez / Logger.ts
Created June 30, 2021 19:58
Lightweight and simple logger class for TypeScript
import chalk from "chalk";
import fs from "fs/promises";
export enum LogLevel {
Trace, Debug, Info, Warn, Error, Fatal
}
type FormatFunction = (level: LogLevel, message: string, color: boolean) => string;
interface LoggerOptions {
@Xydez
Xydez / trackers.txt
Created December 21, 2020 22:55
Here's my huge list of BitTorrent trackers acquired from the internet.
http://5.79.83.193:2710/announce
http://5.79.249.77:6969/announce
http://5.182.210.186:6969/announce
http://5rt.tace.ru:60889/announce
http://37.19.5.139:6969/announce
http://37.19.5.155:6881/announce
http://46.4.109.148:6969/announce
http://49.12.113.1:8866/announce
http://51.81.46.170:6969/announce
http://51.254.244.161:6969/announce
import fs from "fs/promises";
import path from "path";
export default class File
{
private data?: Buffer;
constructor(private filePath: string, private relative: boolean = true)
{}