Skip to content

Instantly share code, notes, and snippets.

View SergeyKozlov's full-sized avatar

Sergey Kozlov SergeyKozlov

View GitHub Profile
# Shell Script
# Compiles specified nginx version with google SPDY module
# Author: Deepak Kumar
# Twitter: @deepak_kumar
# November 19th, 2013
# Nginx modules included here are as per my need. Feel free modify/add/remove. Cheers!
#!/bin/sh
@SergeyKozlov
SergeyKozlov / site.conf
Created October 6, 2015 08:34 — forked from Kozlov-V/site.conf
Nginx configuration for best security and modest performance. Full info on https://terrty.net/2014/ssl-tls-in-nginx/
# read more at https://terrty.net/2014/ssl-tls-in-nginx/
# latest version on https://gist.github.com/paskal/628882bee1948ef126dd/126e4d1daeb5244aacbbd847c5247c2e293f6adf
# security test score: https://www.ssllabs.com/ssltest/analyze.html?d=terrty.net
# your nginx version might not have all directives included, test this configuration before using in production against your nginx:
# $ nginx -c /etc/nginx/nginx.conf -t
server {
# public key, contains your public key and class 1 certificate, to create:
# (example for startssl)
# $ (cat example.com.pem & wget -O - https://www.startssl.com/certs/class1/sha2/pem/sub.class1.server.sha2.ca.pem) | tee -a /etc/nginx/ssl/domain.pem > /dev/null
@SergeyKozlov
SergeyKozlov / full-ffmpeg.sh
Created October 14, 2015 08:18
Install full ffmpeg in debian wheezy (with aac(m4a) and x264 support)
# Add multimedia source
echo "deb http://www.deb-multimedia.org wheezy main non-free" >> /etc/apt/sources.list
echo "deb-src http://www.deb-multimedia.org wheezy main non-free" >> /etc/apt/sources.list
apt-get update
apt-get install deb-multimedia-keyring # if this aborts, try again
apt-get update
# Go to local source directory
cd /usr/local/src
@SergeyKozlov
SergeyKozlov / nginx.conf
Created October 27, 2015 13:49 — 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
@SergeyKozlov
SergeyKozlov / convert-UNIX-timestamp.js
Created December 29, 2015 13:27 — forked from kmaida/convert-UNIX-timestamp.js
Convert a UNIX timestamp to user's local time via JavaScript
function convertTimestamp(timestamp) {
var d = new Date(timestamp * 1000), // Convert the passed timestamp to milliseconds
yyyy = d.getFullYear(),
mm = ('0' + (d.getMonth() + 1)).slice(-2), // Months are zero based. Add leading 0.
dd = ('0' + d.getDate()).slice(-2), // Add leading 0.
hh = d.getHours(),
h = hh,
min = ('0' + d.getMinutes()).slice(-2), // Add leading 0.
ampm = 'AM',
time;
@SergeyKozlov
SergeyKozlov / install_ffmpeg_ubuntu.sh
Created February 18, 2016 11:00 — forked from xdamman/install_ffmpeg_ubuntu.sh
Install latest ffmpeg on ubuntu 12.04 or 14.04
#!/bin/bash
# Bash script to install latest version of ffmpeg and its dependencies on Ubuntu 12.04 or 14.04
# Inspired from https://gist.github.com/faleev/3435377
# Remove any existing packages:
sudo apt-get -y remove ffmpeg x264 libav-tools libvpx-dev libx264-dev
# Get the dependencies (Ubuntu Server or headless users):
sudo apt-get update
@SergeyKozlov
SergeyKozlov / countdown.js
Created April 8, 2016 20:42 — forked from adhithyan15/countdown.js
A simple countdown timer in Javascript
/********************************************************************************************************************
Countdown.js is a simple script to add a countdown timer
for your website. Currently it can only do full minutes
and partial minutes aren't supported. This script is a fork of http://jsfiddle.net/HRrYG/ with some
added extensions. Since the original code that I forked was released under Creative Commons by SA license,
I have to release this code under the same license. You can view a live demo of this code at http://jsfiddle.net/JmrQE/2/.
********************************************************************************************************************/
function countdown(minutes) {
var seconds = 60;
var mins = minutes
@SergeyKozlov
SergeyKozlov / contact.html
Created August 4, 2016 19:45 — forked from ajtroxell/contact.html
Build a simple PHP, jQuery, and AJAX Powered Contact Form, from: http://ajtroxell.com/build-a-simple-php-jquery-and-ajax-powered-contact-form/
<form id="contact" name="contact" method="post">
<fieldset>
<label for="name" id="name">Name<span class="required">*</span></label>
<input type="text" name="name" id="name" size="30" value="" required/>
<label for="email" id="email">Email<span class="required">*</span></label>
<input type="text" name="email" id="email" size="30" value="" required/>
<label for="phone" id="phone">Phone</label>
<input type="text" name="phone" id="phone" size="30" value="" />
<script src="https://apis.google.com/js/client.js?onload=gapiLoad"></script>
<script>
function gapiLoad() {
gapi.client.setApiKey('YOUR_API_KEY'); // app api-wide client api key
getGoogleContactEmails(function(result){
console.log(result);
});
}
@SergeyKozlov
SergeyKozlov / couchbase_export_views.php
Created August 23, 2017 09:29 — forked from lord-otori/couchbase_export_views.php
A script to export all views in a Couchbase server to files.
<?php
/*
* @author: Juan S. Simon
* @copyright: none, just please don't try to sell it, they'll laugh at you...
*
*/
if (php_sapi_name() != 'cli') {
exit("No web access allowed!" . PHP_EOL);
}