Skip to content

Instantly share code, notes, and snippets.

@profitcore
profitcore / nginx.conf
Created March 27, 2019 10:25 — forked from plentz/nginx.conf
Best nginx configuration for improved security(and performance). Complete blog post here http://tautt.com/best-nginx-configuration-for-security/
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
@profitcore
profitcore / functions.php
Created February 15, 2017 19:08
Disable wordpress rest api
function disable_json_api () {
// Filters for WP-API version 1.x
add_filter('json_enabled', '__return_false');
add_filter('json_jsonp_enabled', '__return_false');
// Filters for WP-API version 2.x
add_filter('rest_enabled', '__return_false');
add_filter('rest_jsonp_enabled', '__return_false');
}
@profitcore
profitcore / ffmpeg_web_video.sh
Created January 29, 2017 10:55
Конвертация видео с помощью ffmpeg для публикации на сайте
#https://trac.ffmpeg.org/wiki/Encode/H.264
ffmpeg -i input.mp4 \
-strict experimental \
-preset slow \
-threads 2 \
-c:v libx264 -crf 22 \
-c:a aac -b:a 256k \
-r 25 \
output.mp4
<?php
$file='/tmp/parser_status.lock';
if(!flock($lock_file = fopen($file, 'w'), LOCK_EX | LOCK_NB))
die("Already runninng\n");
@profitcore
profitcore / example.com.conf
Created February 19, 2016 10:49 — forked from a-vasyliev/example.com.conf
Nginx: proxy cache without utm_* parameters (remove query parameter, remove utm tags nginx)
server {
listen 443;
server_name example.com;
error_log /var/log/nginx/example_com_error.log warn;
ssl on;
ssl_certificate /etc/nginx/ssl/your.crt; #certificate chains
ssl_certificate_key /etc/nginx/ssl/your.key; #private key
@profitcore
profitcore / get_selected_html.html
Created January 17, 2016 19:07
Get selected html via JS
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>The serialized HTML of a selection in Mozilla and IE</title>
<script type="text/javascript">
function getHTMLOfSelection () {
var range;
if (document.selection && document.selection.createRange) {