Skip to content

Instantly share code, notes, and snippets.

@bjorn2404
bjorn2404 / wp_kses_post_tags.php
Last active April 22, 2024 15:08
WordPress allow iFrames with wp_kses_post filter
<?php
/**
* Add iFrame to allowed wp_kses_post tags
*
* @param array $tags Allowed tags, attributes, and/or entities.
* @param string $context Context to judge allowed tags by. Allowed values are 'post'.
*
* @return array
*/
@hollodotme
hollodotme / Install-nginx-with-http2-support.md
Created April 9, 2016 17:07
Install nginx with http2 support on ubuntu 14.04 LTS (Trusty)

How to install nginx (>= 1.9.5) with http2 support on Ubuntu 14.04 LTS (Trusty)

IMPORTANT: Backup your nginx site configs (usually under /etc/nginx/sites-available)!

Remove old nginx

Remove old nginx incl. nginx-common:

apt-get autoremove --purge nginx nginx-common
@mingfang
mingfang / convert id_rsa to pem
Last active March 3, 2024 08:46
Convert id_rsa to pem file
openssl rsa -in ~/.ssh/id_rsa -outform pem > id_rsa.pem
chmod 600 id_rsa.pem
@simlegate
simlegate / custom-error-page
Created October 31, 2014 05:35
Nginx return custom json
error_page 400 404 405 =200 @40*_json;
location @40*_json {
default_type application/json;
return 200 '{"code":"1", "message": "Not Found"}';
}
error_page 500 502 503 504 =200 @50*_json;
location @50*_json {
@flandr
flandr / urllib2_tls.py
Created October 16, 2014 15:22
Forcing TLS in Python's urllib2
# Python 2.6's urllib2 does not allow you to select the TLS dialect,
# and by default uses a SSLv23 compatibility negotiation implementation.
# Besides being vulnerable to POODLE, the OSX implementation doesn't
# work correctly, failing to connect to servers that respond only to
# TLS1.0+. These classes help set up TLS support for urllib2.
class TLS1Connection(httplib.HTTPSConnection):
"""Like HTTPSConnection but more specific"""
def __init__(self, host, **kwargs):
httplib.HTTPSConnection.__init__(self, host, **kwargs)
@sergejmueller
sergejmueller / nginx.conf
Last active May 10, 2018 18:16
OCSP stapling PEM file for RapidSSL certificates used on Nginx. Details: https://plus.google.com/+SergejMüller/posts/Vq1Hf1AZ2vY
...
ssl_stapling on;
ssl_stapling_verify on;
ssl_trusted_certificate /usr/share/ssl/cert/rapidssl.pem;
@olasd
olasd / stream_to_youtube.sh
Created March 28, 2014 19:58
Stream video to youtube via ffmpeg
#! /bin/bash
#
# Diffusion youtube avec ffmpeg
# Configurer youtube avec une résolution 720p. La vidéo n'est pas scalée.
VBR="2500k" # Bitrate de la vidéo en sortie
FPS="30" # FPS de la vidéo en sortie
QUAL="medium" # Preset de qualité FFMPEG
YOUTUBE_URL="rtmp://a.rtmp.youtube.com/live2" # URL de base RTMP youtube
@nrk
nrk / command.txt
Created April 2, 2012 19:19
Using ffprobe to get info from a file in a nice JSON format
ffprobe -v quiet -print_format json -show_format -show_streams "lolwut.mp4" > "lolwut.mp4.json"