Skip to content

Instantly share code, notes, and snippets.

View Enelar's full-sized avatar
💭
https://www.linkedin.com/in/offenso

Kirill Berezin Enelar

💭
https://www.linkedin.com/in/offenso
View GitHub Profile
@Enelar
Enelar / compile-php-thread-safe-and-pthreads.sh
Created September 12, 2016 14:22 — forked from Divi/compile-php-thread-safe-and-pthreads.sh
Compile PHP Thread Safe & pthreads extension
#!/usr/bin/env bash
# PARAMETERS
# ----------
# PHP
# ---
PHP_TIMEZONE="UTC"
PHP_DIRECTORY="/etc/php5ts"
@Enelar
Enelar / add-rbd-to-kvm.sh
Last active August 13, 2023 02:14
Add rbd pool to kvm
#!/bin/bash
# ChatGPT from https://blog.modest-destiny.com/posts/kvm-libvirt-add-ceph-rbd-pool/
# Allows adding multiple pools and use shared secret between them
# Define variables
VIRT_SCRT_PATH="/tmp/libvirt-secret.xml"
VIRT_POOL_PATH="/tmp/libvirt-rbd-pool.xml"
# Get script arguments
@Enelar
Enelar / to_promise.js
Created April 13, 2020 10:58
Quick to promise method
to_direct_promise(functor, ...args) {
return this.to_promise(functor, ...args, undefined);
}
to_promise(functor, ...args) {
const options = args.pop();
let resolve;
let reject;
const result = new Promise((res, cat) => {
resolve = res;
@Enelar
Enelar / minterpolate.sh
Last active November 26, 2020 22:00
minterpolate ffmpeg
ffmpeg -i input.mp4 -movflags +faststart -filter_complex "[0:v]minterpolate='fps=60:mi_mode=mci:me_mode=bidir:mc_mode=obmc:me=ds:vsbmc=1'" -preset ultrafast output.mp4
@Enelar
Enelar / squid_cache.conf
Created July 5, 2015 23:48
Force cache cdn squid (32GB of cache)
#
# Recommended minimum configuration:
#
# Example rule allowing access from your local networks.
# Adapt to list your (internal) IP networks from where browsing
# should be allowed
acl localnet src 10.0.0.0/8 # RFC1918 possible internal network
acl localnet src 172.16.0.0/12 # RFC1918 possible internal network
acl localnet src 192.168.0.0/16 # RFC1918 possible internal network
@Enelar
Enelar / shallow.compress.sh
Last active October 9, 2018 06:02
Shallow compress everything fastest possible way
nice -n 5 find * -maxdepth 0 -type d | parallel -j 1 "tar -cf {}.tar {} && pixz -9 {}.tar {}.txz && rm {}.tar"
@Enelar
Enelar / ffmpeg_hvec_vaapi.sh
Last active July 22, 2018 04:03
ffmpeg compress crf20
ffmpeg -vaapi_device /dev/dri/renderD128 -i input.mp4 -vf 'format=nv12,hwupload' -c:v hevc_vaapi output.mkv
#make sure that hvec profile is listed in vaapi command output
@Enelar
Enelar / 20-graphics.conf
Created May 6, 2018 19:42
Arch flicker free ffmpeg screen capture
#etc/X11/xorg.conf.d/20-graphics.conf
Section "Device"
Identifier "Intel Graphics"
Driver "modesetting"
Option "AccelMethod" "glamor"
EndSection
@Enelar
Enelar / find_exceptions.sh
Created April 12, 2018 23:43
Find any catch block without _logger
rgrep -zoP "catch(?:.*){\n(?:.*\n){0,10}?(?:.*?(_logger)?.*\n)(?:.*\n){0,10}?.*}\n" | grep -aEvz "(.*.php).*(_logger).*?\n" | grep -aPo "(.*php)"
# catch (\Exception $e) {
# $this->_logger->critical($e);
# $message = __('An exception occurred while saving the address');
# $response = ['error' => 'true', 'message' => $message];
# }
@Enelar
Enelar / original_code.js
Created March 13, 2018 08:59
Is this so hard????
function initializeResizeEvents() {
jQuery('#select_size').on("change", function(event) {
var data = jQuery("#select_size option:selected").attr('resize-data');
window.productPrice.resize = '';
if (typeof(data) != 'undefined') {
if (data == 'custom') {} else {
data = eval('(' + data + ')');
window.productHeight = data.height;
window.productWidth = data.width;
}