Skip to content

Instantly share code, notes, and snippets.

View wmelton's full-sized avatar

Wes wmelton

View GitHub Profile
@wmelton
wmelton / proxy.nginx.conf
Created August 30, 2022 10:42 — forked from jujhars13/proxy.nginx.conf
nginx-mysql-proxy
#sudo wget http://nginx.org/download/nginx-1.9.12.tar.gz
#sudo tar -xvzf nginx-1.9.12.tar.gz
#cd nginx-1.9.12
#sudo apt-get install -y build-essential libpcre3 libpcre3-dev zlib1g-dev
#sudo ./configure --with-stream && sudo make && sudo make install
# /usr/local/nginx/conf/nginx.conf - NGINX configuration file
worker_processes 1;
@wmelton
wmelton / minimal-analytics-snippet.js
Created December 16, 2019 22:59 — forked from DavidKuennen/minimal-analytics-snippet.js
Minimal Analytics Snippet
(function (context, trackingId, options) {
const history = context.history;
const doc = document;
const nav = navigator || {};
const storage = localStorage;
const encode = encodeURIComponent;
const pushState = history.pushState;
const typeException = 'exception';
const generateId = () => Math.random().toString(36);
const getId = () => {
@wmelton
wmelton / Spark+ipython_on_MacOS.md
Created March 8, 2017 18:18 — forked from ololobus/Spark+ipython_on_MacOS.md
Apache Spark installation + ipython notebook integration guide for Mac OS X

Apache Spark installation + ipython/jupyter notebook integration guide for Mac OS X

Tested with Apache Spark 2.1.0, Python 2.7.13 and Java 1.8.0_112

For older versions of Spark and ipython, please, see also previous version of text.

Install Java Development Kit

'''This script goes along the blog post
"Building powerful image classification models using very little data"
from blog.keras.io.
It uses data that can be downloaded at:
https://www.kaggle.com/c/dogs-vs-cats/data
In our setup, we:
- created a data/ folder
- created train/ and validation/ subfolders inside data/
@wmelton
wmelton / grunt-sitemap.php
Created December 26, 2015 15:00 — forked from lgladdy/grunt-sitemap.php
Grunt Sitemap Generator plugin for Wordpress
<?php
/**
* Plugin Name: Grunt Sitemap Generator
* Plugin URI: http://www.github.com/lgladdy
* Description: Generate a JSON list of every page on a site so it can be used with grunt and uncss. Create a folder in /wp-content called mu-plugins, and drop this code into that folder, as grunt-sitemap.php
* Author: Liam Gladdy
* Author URI: http://gladdy.co.uk
* Version: 1.0
*/
@wmelton
wmelton / gist:9335c0b82a3cae64a7b9
Last active October 12, 2015 14:54 — 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

@wmelton
wmelton / epsilon-greedy-method.php
Created October 3, 2015 00:51 — forked from lotsofcode/epsilon-greedy-method.php
epsilon-greedy-method.php
<?php
/*
@ref http://stevehanov.ca/blog/index.php?id=132
def choose():
if math.random() < 0.1:
# exploration!
# choose a random lever 10% of the time.
else:
# exploitation!
# for each lever,
from selenium import webdriver
from selenium.common.exceptions import TimeoutException
import selenium.webdriver.support.wait
selenium.webdriver.support.wait.POLL_FREQUENCY = 0.05
import re
import random
import collections
class AdwordsAutomater(object):