Skip to content

Instantly share code, notes, and snippets.

View vpotap's full-sized avatar

Vladimir Potapov vpotap

View GitHub Profile
@vpotap
vpotap / gist:1db12da473672813b2c4f8b12fa1d843
Created July 21, 2017 14:18 — forked from jonathanmoore/gist:2640302
Get the share counts from various APIs

Share Counts

I have always struggled with getting all the various share buttons from Facebook, Twitter, Google Plus, Pinterest, etc to align correctly and to not look like a tacky explosion of buttons. Seeing a number of sites rolling their own share buttons with counts, for example The Next Web I decided to look into the various APIs on how to simply return the share count.

If you want to roll up all of these into a single jQuery plugin check out Sharrre

Many of these API calls and methods are undocumented, so anticipate that they will change in the future. Also, if you are planning on rolling these out across a site I would recommend creating a simple endpoint that periodically caches results from all of the APIs so that you are not overloading the services will requests.

Twitter

@vpotap
vpotap / mysql57 install.txt
Created July 2, 2017 22:06 — forked from wamith/mysql57 install.txt
Installing mysql 5.7 on centos 6
Installing mysql 5.7 on centos 6
1. download yum repo
wget http://dev.mysql.com/get/mysql57-community-release-el6-7.noarch.rpm
2. install yum repo
yum -y localinstall mysql57-community-release-el6-7.noarch.rpm
3. verify yum repo
yum repolist enabled | grep "mysql.*-community.*"
@vpotap
vpotap / slack_munin.sh
Created June 19, 2017 07:43 — forked from anarchivist/slack_munin.sh
Slack notification script for Munin
#!/bin/bash
# Slack notification script for Munin
# Mark Matienzo (@anarchivist)
#
# To use:
# 1) Create a new incoming webhook for Slack
# 2) Edit the configuration variables that start with "SLACK_" below
# 3) Add the following to your munin configuration:
#
@vpotap
vpotap / fix-homebrew-npm.md
Created June 4, 2017 12:18 — forked from DanHerbert/fix-homebrew-npm.md
Instructions on how to fix npm if you've installed Node through Homebrew on Mac OS X or Linuxbrew

Fixing npm On Mac OS X for Homebrew Users

Installing node through Homebrew can cause problems with npm for globally installed packages. To fix it quickly, use the solution below. An explanation is also included at the end of this document.

Solution

This solution fixes the error caused by trying to run npm update npm -g. Once you're finished, you also won't need to use sudo to install npm modules globally.

Before you start, make a note of any globally installed npm packages. These instructions will have you remove all of those packages. After you're finished you'll need to re-install them.

@vpotap
vpotap / nginx-tuning.md
Created May 29, 2017 20:17 — forked from denji/nginx-tuning.md
NGINX tuning for best performance

Moved to git repository: https://github.com/denji/nginx-tuning

NGINX Tuning For Best Performance

For this configuration you can use web server you like, i decided, because i work mostly with it to use nginx.

Generally, properly configured nginx can handle up to 400K to 500K requests per second (clustered), most what i saw is 50K to 80K (non-clustered) requests per second and 30% CPU load, course, this was 2 x Intel Xeon with HyperThreading enabled, but it can work without problem on slower machines.

You must understand that this config is used in testing environment and not in production so you will need to find a way to implement most of those features best possible for your servers.

@vpotap
vpotap / install-comodo-ssl-cert-for-nginx.rst
Created May 21, 2017 12:08 — forked from bradmontgomery/install-comodo-ssl-cert-for-nginx.rst
Steps to install a Comodo PositiveSSL certificate with Nginx.

Setting up a SSL Cert from Comodo

I use Namecheap.com as a registrar, and they resale SSL Certs from a number of other companies, including Comodo.

These are the steps I went through to set up an SSL cert.

Purchase the cert

@vpotap
vpotap / iterm2-solarized.md
Created April 11, 2017 22:13 — forked from kevin-smets/iterm2-solarized.md
iTerm2 + Oh My Zsh + Solarized color scheme + Meslo powerline font + [Powerlevel9k] - (macOS)

Default

Default

Powerlevel9k

Powerlevel9k

<script type='text/javascript'>
if (is_width_above('l')) {
var ox_u = 'http://advert.rigasvilni.lv/www/delivery/al.php?zoneid=127&layerstyle=introbaner&keywords=' + window.relay_ad_keywords;
if (document.context) ox_u += '&context=' + encodeURIComponent(document.context);
document.write("<scr" + "ipt type='text/javascript' src='" + ox_u + "'></scr" + "ipt>");
}
</script>
<!DOCTYPE html>
<html lang="en">
<head>
<title>Test DFP Ads</title>
<!-- google cdn -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<script>(function (w, d, s, l, i) {
<script type='text/javascript'>
if(is_width_above('l')) {
var ox_u = 'http://advert.rigasvilni.lv/www/delivery/al.php?zoneid=125&layerstyle=introbaner&keywords=' + window.relay_ad_keywords ;
if (document.context) ox_u += '&context=' + escape(document.context);
document.write("<scr"+"ipt type='text/javascript' src='" + ox_u + "'></scr"+"ipt>");
}
</script>