This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Improved ~/.dircolors designed for dark background | |
# Configuration file for dircolors, a utility to help you set the | |
# LS_COLORS environment variable used by GNU ls with the --color option. | |
# Copyright (C) 1996-2018 Free Software Foundation, Inc. | |
# Copying and distribution of this file, with or without modification, | |
# are permitted provided the copyright notice and this notice are preserved. | |
# The keywords COLOR, OPTIONS, and EIGHTBIT (honored by the | |
# slackware version of dircolors) are recognized but ignored. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Console colors for Windows | |
# -------------------------- | |
# Script outputs console color scheme files for Windows in the followng formats: | |
# <win>.reg file - Windows legancy console colors | |
# <putty>.reg file - Putty console colors | |
# <concfg>.json - concfg.json scheme | |
# <wt>.json - Windows Terminal color scheme | |
# | |
# Windows reg file is for default console. Putty sessions are configurable below, see: `puttySessions` variable. | |
# Feel free to change the colors. Provided palette is a simple and reasonable default for dark background. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
define('ITERATIONS', 1000000); | |
# [igbinary serializer PHP extension](https://github.com/igbinary/igbinary) | |
if (!extension_loaded('igbinary')) { | |
throw new DomainException('Required PHP module "igbinary" is not loaded'); | |
} | |
# [MessagePack binary serializer PHP extension](https://github.com/msgpack/msgpack-php) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Create user runtime directory | |
sudo install -d -o www-data -g www-data -m 0700 /run/user/`id -u www-data` | |
# Start user manager | |
sudo systemctl start user@`id -u www-data` | |
# Optionally enable lingering (User manager is spawned for the user at boot and kept around after logouts). | |
sudo loginctl enable-linger www-data | |
# Test it |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# My steps to: | |
# Convert DVD Video to MPEG-4 in MKV without GUI, using only CLI (Command Line Interface) tools. | |
# No need for MeGUI, Avisynth, Handbrake etc.. | |
# ------------------------------------------------------------------------------ | |
# Tools needed: `mediainfo`, `ffmpeg` & `ffprobe`, `x264`, `mkvmerge`, `mplayer` (optional). | |
# Google for them. Use latest versions. Windows tip: avoid Cygwin and get | |
# the official builds, x64, when possible. | |
# Before start use `mediainfo` & `ffprobe` and note down informations about the source material: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Simple OGM chapters generator for MKV Video | |
# ------------------------------------------- | |
# Use it like this: | |
# $ python ogm-chapters.py times.txt [chapters.txt] | |
# Where times.txt contains timestamps separated by a whitespace or comma | |
import sys | |
from pathlib import Path | |
import re |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Long running task with single MySQL transaction. Only one task with the same name | |
* can be running at a time. Next executed task waits untill previous finishes, or | |
* doesn't wait, but throws DomainException instead. | |
* | |
* Use it like so: | |
* $task = new Task('foo', $db); | |
* $task->run(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Script installs Entware-ng (https://github.com/Entware/Entware-ng) | |
# on Synology DSM 6.2 under /opt directory. | |
# Must be run with sudo. Can be used as a scheduled task on system boot. | |
printf -- "---------------------------\n" | |
printf -- "| Installing Entware-ng.. |\n" | |
printf -- "---------------------------\n" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Simple, custom, bulletproof PHP 7 runtime errors/exceptions handling done right (I hope so :). | |
* By handling I mean logging to systemd journal or stderr, and die if any exception, | |
* error, warning, and even notice or strict occurs. This is not all-in-one | |
* or an ultimate solusion, but a good base to start with. | |
* Logs go to stderr or systemd journal (recommended, but optional). Systemd extension | |
* for PHP can be found at https://github.com/systemd/php-systemd | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Fib: | |
"""Iterator that yields numbers in the Fibonacci sequence""" | |
def __init__(self, max): | |
self.max = max | |
def __iter__(self): | |
self.a = 0 | |
self.b = 1 | |
return self |