Skip to content

Instantly share code, notes, and snippets.

View KarelWintersky's full-sized avatar

Karel Wintersky KarelWintersky

View GitHub Profile
@KarelWintersky
KarelWintersky / csv_to_array.php
Created October 11, 2015 21:08 — forked from jaywilliams/csv_to_array.php
Convert a comma separated file into an associated array.
/**
* Convert a comma separated file into an associated array.
* The first row must contain the array keys.
* Return something like this:
* Array
(
[0] => Array
(
[name] => Lorem
[number] => 11
@KarelWintersky
KarelWintersky / auntAsya.php
Created October 11, 2015 21:13 — forked from M1zh0rY/auntAsya.php
Тетя ася
<?php
/**
* @name Aunt Asya has arrived =)
* @author M1zh0rY
* @category js clear script
* Infected Script:
* JS/Agent.* (all, ESET)
* JS/Kryptik.LP (ESET)
* Trojan:JS/BlacoleRef.BC (MCE)
* @license GNU
@KarelWintersky
KarelWintersky / !Как установить сфинкс.md
Created April 10, 2016 03:13 — forked from codedokode/!Как установить сфинкс.md
Как установить и настроить сфинкс.

Как установить и настроить сфинкс.

Скачиваем сфинкс (берем версию с MySQL и со стеммингом на 15 языков Win32 binaries w/MySQL+PgSQL+libstemmer+id64 support соответствующую битности твоей ОС), распаковываем например в d:\temp\s\

На этом установка sphinx завершена. В дебиане просто делаем sudo apt-get install sphinxsearch.

Создаем таблицы:

CREATE TABLE news 

(id INT(10) AUTO_INCREMENT PRIMARY KEY, topic INT(10) NOT NULL, header VARCHAR(200) NOT NULL,

@KarelWintersky
KarelWintersky / Russian Plural Form in PHP
Last active August 15, 2016 05:20 — forked from fomigo/gist:2382775
Russian Plural Form in PHP
<?php
/*
echo plural_form(42, array('арбуз', 'арбуза', 'арбузов'));
*/
function plural_form($n, $forms) {
return $n%10==1&&$n%100!=11?$forms[0]:($n%10>=2&&$n%10<=4&&($n%100<10||$n%100>=20)?$forms[1]:$forms[2]);
}
@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

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"
@KarelWintersky
KarelWintersky / bench.php
Last active June 11, 2017 12:07
PHP Benchmark Performance Script v1.0.6
#!/usr/bin/php
<?php
/*
##########################################################################
# PHP Benchmark Performance Script #
# © 2010 Code24 BV #
# #
# Author : Alessandro Torrisi #
# Author : Sergey Dryabzhinsky #
# Company : Code24 BV, The Netherlands #