Skip to content

Instantly share code, notes, and snippets.

View KarelWintersky's full-sized avatar

Karel Wintersky KarelWintersky

View GitHub Profile
@KarelWintersky
KarelWintersky / Flatten array
Last active August 15, 2016 05:19
Flatten array
/**
$data = array(
'user' => array(
'email' => 'user@example.com',
'name' => 'Super User',
'address' => array(
'billing' => 'Street 1',
'delivery' => 'Street 2'
)
),
@KarelWintersky
KarelWintersky / echo_status_cli.php
Last active December 16, 2016 18:28
Echo_status_cli() - раскраска вывода в консоли
function echo_status_cli($message = "", $breakline = TRUE)
{
static $fgcolors = array(
'black' => '0;30',
'dark gray' => '1;30',
'blue' => '0;34',
'light blue' => '1;34',
'green' => '0;32',
'light green' => '1;32',
'cyan' => '0;36',
@KarelWintersky
KarelWintersky / ffmpeg.md
Created August 21, 2016 18:04 — forked from protrolium/ffmpeg.md
using ffmpeg to extract audio from video files

ffmpeg

Extract Audio

ffmpeg -i video.mp4 -f mp3 -ab 192000 -vn music.mp3

The -i option in the above command is simple: it is the path to the input file. The second option -f mp3 tells ffmpeg that the ouput is in mp3 format. The third option i.e -ab 192000 tells ffmpeg that we want the output to be encoded at 192Kbps and -vn tells ffmpeg that we dont want video. The last param is the name of the output file.


@KarelWintersky
KarelWintersky / mysql.sh
Created September 6, 2016 16:13 — forked from valerio-bozzolan/mysql.sh
Debian GNU/Linux MySQL-MariaDB autologin
#!/bin/bash
########################################
# MySQL | MariaDB autologin
# License: GNU GPL v3+
# Author: Valerio Bozzolan
########################################
file=/etc/mysql/debian.cnf
while [ -z "$user" ] && read ln; do
@KarelWintersky
KarelWintersky / csv2sql-insert.php
Last active September 13, 2016 02:44
CSV to SQL convertor (insert only).
<?php
$content = '';
if ($_POST["ref"] === "csv2sql") {
// prepare data
$table_name = $_POST["table_name"];
$csv_delimeter = @isset($_POST['DELIMETER']) ?: ',';
$csv_enclosure = @isset($_POST['ENCLOSURE']) ?: '"';
$csv_data = $_POST["csv_data"];
$csv_as_array = explode("\n", $csv_data);
@KarelWintersky
KarelWintersky / csv2sql.php
Last active August 19, 2017 16:24
CSV to SQL converter (insert and update)
<?php
/**
* (c) Karel Wintersky, 13 Sept. 2016
*/
$content = '';
if ($_POST["ref"] === "csv2sql") {
$table_name = $_POST["table_name"];
$csv_delimeter = @isset($_POST['DELIMETER']) ?: ',';
$csv_enclosure = @isset($_POST['ENCLOSURE']) ?: '"';
$csv_data = $_POST["csv_data"];
@KarelWintersky
KarelWintersky / television_resolution_standards.md
Created December 17, 2016 15:40 — forked from jonlabelle/television_resolution_standards.md
Digital and analog television standards resolution reference.

Television Standards

Digital and analog television standards resolution reference.

Digital TV Standards

Standard Resolution (dots × lines) DAR (H:V) Pixels
PixelVision 120 × 90 4:3 10,800

Regular Expression Cheatsheet

Anchors

^   Matches at the start of string or start of line if multi-line mode is
	enabled. Many regex implementations have multi-line mode enabled by
	default.

$ Matches at the end of string or end of line if multi-line mode is enabled.
@KarelWintersky
KarelWintersky / meta-tags.md
Last active February 24, 2017 13:33 — forked from lancejpollard/meta-tags.md
Complete List of HTML Meta Tags

Copied from http://code.lancepollard.com/complete-list-of-html-meta-tags/

Basic HTML Meta Tags

<meta name="keywords" content="your, tags"/>
<meta name="description" content="150 words"/>
<meta name="subject" content="your website's subject">
<meta name="copyright"content="company name">
<meta name="language" content="ES">
@KarelWintersky
KarelWintersky / uri.js
Created April 2, 2017 04:17 — forked from jlong/uri.js
URI Parsing with Javascript
var parser = document.createElement('a');
parser.href = "http://example.com:3000/pathname/?search=test#hash";
parser.protocol; // => "http:"
parser.hostname; // => "example.com"
parser.port; // => "3000"
parser.pathname; // => "/pathname/"
parser.search; // => "?search=test"
parser.hash; // => "#hash"
parser.host; // => "example.com:3000"