Skip to content

Instantly share code, notes, and snippets.

@valentineus
valentineus / shell.sh
Created Jun 1, 2020
Convert video file to audio file
View shell.sh
ffmpeg -i filename.ogg -vn -c:a libopus -ar 16k -ac 1 -b:a 16k -vbr on -compression_level 10 new_filename.ogg
View split-string.ts
type SplitString = (value: string, length: number) => string[];
export const splitString: SplitString = (value: string, length: number): string[] => {
const chunks: string[] = [];
for (let index: number = 0; index < value.length; index += length) {
const chunk: string = value.slice(index, index + length);
chunks.push(chunk);
}
View gist:60eb7344346fe46a42d718f368c72181
{% autoescape false %}
{{ contents }}
{{ footer }}
{% endautoescape %}
@valentineus
valentineus / file-converter.js
Last active Oct 2, 2019
An example of recording and converting to mp3 to ElectronJS.
View file-converter.js
import ffmpeg from 'fluent-ffmpeg';
import { settings } from '../../../../system';
export default (incomingPatchFile, outgoingPatchFile) => {
const ffmpegPath = settings.get('system.ffmpeg.path', '');
ffmpeg.setFfmpegPath(ffmpegPath);
return new Promise((resolve, reject) => {
View script.js
"use strict";
function create(total) {
var result = [];
for (var i = 0; i < total; i++) {
result.push(i + 1);
}
return result;
@valentineus
valentineus / bootstrap.php
Created Mar 3, 2019
An example of integration Slim Framework into 1C-Bitrix.
View bootstrap.php
<?php
# local/php_interface/bootstrap.php
declare(strict_types = 1);
define('NOT_CHECK_PERMISSIONS', true);
define('NO_AGENT_CHECK', true);
$_SERVER['DOCUMENT_ROOT'] = dirname(__DIR__, 2);
@valentineus
valentineus / start-sync.sh
Created Jan 9, 2019
Synchronization of backup copies of repositories with code.
View start-sync.sh
#!/bin/bash
# Author: Valentin Popov
# Email: info@valentineus.link
# Date: 2018-11-13
# Usage: /bin/bash start-sync.sh /path/to/input
# Description: Starting repository synchronization.
# Updating the Environment
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
export PATH="$PATH:/usr/local/scripts"
@valentineus
valentineus / image_optimizer.sh
Last active Sep 10, 2018
Optimizing images for Google PageSpeed.
View image_optimizer.sh
#!/bin/bash
# Author: Valentin Popov
# Email: info@valentineus.link
# Date: 2018-09-10
# Usage: /bin/bash image_optimizer.sh /path/to/input
# Description: Optimizing images for Google PageSpeed.
# Updating the Environment
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
export PATH="$PATH:/usr/local/scripts"
@valentineus
valentineus / 99recommended
Created Jun 1, 2018
Disabling recommended packages on systems GNU/Debian and Ubuntu.
View 99recommended
# /etc/apt/apt.conf.d/99recommended
# Disable recommended packages
APT::AutoRemove::RecommendsImportant "false";
APT::AutoRemove::SuggestsImportant "false";
APT::Get::Install-Recommends "false";
APT::Get::Install-Suggests "false";
APT::Install-Recommends "false";
APT::Install-Suggests "false";
View index.html
<!doctype html>
<html lang="en">
<head>
<title>Hello, world!</title>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!-- Bootstrap CSS -->
You can’t perform that action at this time.