Skip to content

Instantly share code, notes, and snippets.

@Krzysiu
Krzysiu / extractAndGeotagFrames.bat
Created November 22, 2017 19:28
Extract frames from video every X seconds and geotag them using GPS data file. Requires exiftool and ffmpeg.
@echo off
rem Ksheesh Geotag Video Frames 0.0.1
rem
rem Extract frames from video every X seconds and geotag them using GPS data file.
rem Requires exiftool and ffmpeg.
rem Copyright (c) 2017 krzysiu.net
rem
rem Permission is hereby granted, free of charge, to any person obtaining a copy
rem of this software and associated documentation files (the "Software"), to deal
@Krzysiu
Krzysiu / bsod_tombstone.html
Last active October 26, 2017 16:47
Tombstone resembling Blue Screen of Death (Win95) in HTML. For the future use, when tombstones will have screen with browsers, YouTube, commercials etc. Mobile version for urns with small displays included.
<html>
<head>
<title>Blue Screen of DEATH tombstone</title>
<!--
BLUE SCREEN OF DEATH 95 TOMBSTONE v1
© krzysiu.net (Krzysztof Blachnicki), 2017
This piece of code is released on following licenses:
* CC BY 4.0 International (https://creativecommons.org/licenses/by/4.0/deed.en)
* BSD 3 with attribution (https://spdx.org/licenses/BSD-3-Clause-Attribution.html)
@Krzysiu
Krzysiu / ahk2exeFrontend.bat
Last active July 18, 2017 21:20
Kind of frontend to AutoHotKey compiler
@echo off
rem Copyright by krzysiu.net, 2017
rem Licensed as MIT (full text: https://opensource.org/licenses/MIT)
setlocal
set binImg1=Unicode 64-bit
set binImg2=Unicode 32-bit
set binImg3=ANSI 32-bit
REM SET YOUR PATH TO COMPILER HERE
@Krzysiu
Krzysiu / pro_dump.php
Created October 10, 2016 16:03
Variation of var_dump which takes modifier as first parameter - PD::RETURN for returning value (default is echo), PD::PRE to contain dump in <pre>, PD::DIE to die() after run, PD::ESCAPE to escape HTML characters
class PD {
const RETURN = 1;
const PRE = 2;
const DIE = 4;
const ESCAPE = 8;
}
function pro_dump() {
if (func_num_args() < 2) return false;
$vars = func_get_args($vars);
@Krzysiu
Krzysiu / restart.bat
Created September 21, 2016 22:42
Restart Windows console (could be used as command)
start cmd & exit
@Krzysiu
Krzysiu / getChoiceCharacter.bat
Last active September 8, 2016 00:35
Windows Batch choice command: get result as character and/or use the last choice as default
@echo off
setlocal
rem Set here all choices
set allChoices=abc
rem Run choice with given choices
choice /c %allChoices%
rem Errorlevel is here number of character from %allChoices%
rem (1=1st choice=1st character). For getting substring of %allChoices% we
@Krzysiu
Krzysiu / inRange.php
Created August 13, 2016 19:12
Check if number is within range - either open or closed one.
<?php
/*! Checks if numer is within range
* @param numeric $number number to check
* @param arr $range array in format [min, max, 'open' => bool]
* @return Boolean result
* @ingroup math
* @version 1
* @note It's very simple, but I've seen a lot of examples which used range() and in_array() which is wrong wrong wrong. Also most of them support only open ranges.
*/
function inRange($number, $range) {
@Krzysiu
Krzysiu / htmlize.php
Created August 13, 2016 19:01
Generate HTML tag from array of parameters. Support for valueless parameters and self-closing tag.
<?php
/*! Generate HTML tag
* @param string $tag tag name (like "a" for <a>)
* @param type $params array of parameters in the format property => value. If value is null (strict), add valueless property
* @param mixed $content if null, generate self-closing tag; if value is given, even empty, add content and close tag
* @return Generated HTML tag
* @ingroup html
* @version 2
*/
function htmlize($tag, $params = [], $content = null) {
@Krzysiu
Krzysiu / getVideo.sh
Last active August 22, 2016 13:11
Youtube-dl wrapper which asks for format before downloading, uses simultaneous connections and more.
#!/usr/bin/env bash
# /----------------------------------------------------------------------------\
# | getVideo b2 |
# | (C) krzysiu.net 2016, multilicensed as MIT, LGPL and CC BY 4.0 |
# | Requires: |
# | * youtube-dl |
# | * aria2c |
# | |
# | Installation: |
@Krzysiu
Krzysiu / remCommand.php
Last active August 13, 2016 18:46
PHP equivalent for DOS/Batch "REM" command, for Batch fanatics
/*
Batch (Dos/Windows) files haven't remark/comment suport in their syntax. The only
official way is to use "rem", which is actually a command. Coders who changed
their language from batch to PHP may feel unfair, cheated, sad, even suicidal.
Here it is - function that mimics REM from batch files. Because that function is
very complicated, probably there are a lot of bugs. Please note me if you'd find
any. I hope it will make your batch>php conversion much easier.
Usage: