Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@reddec
reddec / views.go
Created December 25, 2023 09:29
Load a single template (view) along with all layouts (_layout.gohtml) from directories, starting from the top and going down to the current directory
package web
import (
"errors"
"fmt"
"html/template"
"io/fs"
"os"
"path"
"strings"
@reddec
reddec / sample.sql
Created January 7, 2023 03:24
SQLite document
-- https://www.sqlite.org/json1.html
CREATE TABLE stat
(
id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
started_at TIMESTAMP NOT NULL DEFAULT current_timestamp,
finished_at TIMESTAMP NOT NULL DEFAULT current_timestamp,
meta JSON NOT NULL DEFAULT '{}' -- JSON!
);
CREATE INDEX stat_meta_project ON stat (meta ->> 'project');
@reddec
reddec / crix-simple.py
Last active December 11, 2019 08:25
Very very simple logic for crix automatic trading
# Welcome to CRIX.
# This file is a minimal example to get you started.
# If you have any questions, you can always ask us on Telegram: https://t.me/joinchat/AAKXwhUQzCJTcSd4h76LYQ
# Or check out Catalyst's documentation: https://enigma.co/catalyst/
# Happy trading!
# youtube: https://www.youtube.com/watch?v=yswBW0uyqgQ&t=5s
# Imports
import pandas as pd
import numpy as np
0xaD9b872817b05315611B23F1C16306e0E692ab87
@reddec
reddec / 8d3f76cb4d343720913305c599524bbc96e17f6c
Created October 19, 2017 07:53
8d3f76cb4d343720913305c599524bbc96e17f6c
0x8d3f76cb4d343720913305c599524bbc96e17f6c
0xcb8606ae62a075cdd20c7da79b79bd387c0f7280
0xE650dABEC5005E0A7e847f64BFcd743Bd1Bb1a50
0x7d60184a28111092225d274c743993D8C9d9D7bb
0xaD9b872817b05315611B23F1C16306e0E692ab87
@reddec
reddec / backup-compose.sh
Created July 29, 2017 07:38
Simple backup of docker-compose with images and data-volumes
#!/bin/sh
if [ "1$1" != "1" ]; then
cd "$1"
fi
BACKUP_IMAGES="backup/images"
BACKUP_VOLUMES="backup/volumes"
rm -rf "$BACKUP_IMAGES"