Skip to content

Instantly share code, notes, and snippets.

View severak's full-sized avatar

Mikoláš Štrajt severak

View GitHub Profile
@severak
severak / depng.c
Created October 16, 2018 09:12 — forked from eXeC64/depng.c
Quick tool to list and dump data chunks from a PNG file
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdint.h>
#include <endian.h>
int main(int argc, char** argv)
{
if(argc < 2)
return 1;
@severak
severak / ultrahack.pixi
Created September 6, 2018 22:15
plays PNGs as MIDI
// tohle je uplne ultra hack. Prehrava to obrazky do MIDI.
include "midi_selector.pixi"
midi_dev = -1
midi_port = 0
mc = midi_open_client( "Pixi MIDI Client" )
midi_selector( mc, MIDI_PORT_READ | MIDI_PORT_WRITE )
@severak
severak / sotds.go
Last active June 25, 2023 17:39
generates songs of the day
package main
import (
"database/sql"
"fmt"
"flag"
"os"
"log"
"runtime"
"html/template"
@severak
severak / iframe.php
Created July 6, 2018 10:41
generates kyselo iframe for embedding
<?php
// params
$blog = isset($_GET['blog']) ? $_GET['blog'] : 'admin';
$limit = !empty($_GET['limit']) ? (int) $_GET['limit'] : 5;
if ($limit >100) $limit=100;
// vars
$message = false;
$posts = [];
$title = 'Kyselo IFRAME';
@severak
severak / sotdplaylist.go
Created June 27, 2018 22:36
sotd playlist 2.0
package main
import (
"database/sql"
"fmt"
"flag"
"os"
// "html/template"
"strings"
"net/url"
@severak
severak / sotds.php
Created June 26, 2018 22:32
generates sotds page
<?php
// builds playlist page
$forUser = null; // or set null to build global playlist
// hacked by Severak
// source: https://stackoverflow.com/a/17799714
/**
* Get Youtube video ID from URL
*
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>Slova dne</title>
</head>
<body>
<?php
ini_set('display_errors', 1);
$db = new PDO('sqlite:'.__DIR__.'/db/kyselo.sqlite');
@severak
severak / knihovna.sql
Created January 31, 2018 10:55
tak nějak
CREATE TABLE IF NOT EXISTS "meta" (
"k" text NOT NULL,
"v" text NOT NULL,
PRIMARY KEY ("k")
);
CREATE TABLE IF NOT EXISTS "license" (
"id" integer NOT NULL PRIMARY KEY AUTOINCREMENT,
"name" text NOT NULL,
FOREIGN KEY ("id") REFERENCES "book" ("id")
@severak
severak / 4chandump.log
Created October 29, 2017 14:11
4chandump.log
pi@raspberrypi:~ $ file
Usage: file [-bcEhikLlNnprsvzZ0] [--apple] [--extension] [--mime-encoding] [--mime-type]
[-e testname] [-F separator] [-f namefile] [-m magicfiles] file ...
file -C [-m magicfiles]
file [--help]
pi@raspberrypi:~ $ cd Downloads/
pi@raspberrypi:~/Downloads $ file _pol_118.zst
_pol_118.zst: Zstandard compressed data (v0.8+), Dictionary ID: None
pi@raspberrypi:~/Downloads $ apt-cache search zstd
libzstd-dev - fast lossless compression algorithm -- development files
@severak
severak / milos.php
Last active September 7, 2017 12:14
transparentní účet Miloše Zemana - kolik darovali trollové a kolik voliči
<?php
// spočítá, kolik Milošovi darovali jeho voliči a kolik trolové
// na vstupu je uložené HTML transparentního účtu z
// https://www.fio.cz/ib2/transparent?a=2501277007
$html = file_get_contents('milos69.html');
$doc = new DOMDocument();
$doc->loadHTML($html);
$sxml = simplexml_import_dom($doc);