Skip to content

Instantly share code, notes, and snippets.

@dawn360
dawn360 / install_mysql.sh
Created December 2, 2015 21:54 — forked from rrosiek/install_mysql.sh
Vagrant provision script for php, Apache, MySQL, phpMyAdmin, Laravel, and javascript helpers. Outputs nearly everything to /dev/null since "quiet" on most commands is still noisy.
#! /usr/bin/env bash
# Variables
APPENV=local
DBHOST=localhost
DBNAME=dbname
DBUSER=dbuser
DBPASSWD=test123
echo -e "\n--- Mkay, installing now... ---\n"
https://www.digitalocean.com/community/tutorials/how-to-install-ruby-on-rails-on-ubuntu-12-04-lts-precise-pangolin-with-rvm
#Install rbenv and dependencies
sudo apt-get update
sudo apt-add-repository -y ppa:chris-lea/node.js
sudo apt-get install python-software-properties
sudo apt-get -y update
sudo apt-get -y install curl git-core nodejs
#Ubuntu 14.04
apt-get install python-dev libmysqlclient-dev
pip install MySQL-python
## php5-dev
sudo apt-get install php5-dev
#update pecl
sudo apt-get install php-pear
#install igbinary
sudo pecl install igbinary
#Install PHP Redis extension
sudo apt-get install ruby-dev
Still not working? Try the following after installing ruby-dev:
sudo apt-get install make
sudo gem install daemons
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv EA312927
Ubuntu 14.04
echo "deb http://repo.mongodb.org/apt/ubuntu trusty/mongodb-org/3.2 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.2.list
##Remove existing mongo
sudo service mongod stop
sudo apt-get purge mongodb-org*
@dawn360
dawn360 / Example log
Created February 12, 2016 16:09 — forked from dspezia/Example log
Assessing pending activity of a Redis server
> ~/tcp_redis_monitor.py 6379
Timestamp Nb TX bytes RX bytes TX RMA RX RMA
1333983822.943 1 0 0 0.000 0.000
1333983823.193 1 0 0 0.000 0.000
1333983824.194 1 0 0 0.000 0.000
1333983825.195 1 0 0 0.000 0.000
1333983826.196 1 0 0 0.000 0.000
@dawn360
dawn360 / gist:a7b1689c4706f0042972b913dd6bbd43
Created August 31, 2016 19:34 — 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

# Make the Box as Small as possible
sudo apt-get clean
sudo dd if=/dev/zero of=/EMPTY bs=1M
sudo rm -f /EMPTY
cat /dev/null > ~/.bash_history && history -c && exit
vagrant package --output mynew.box
# Add the Box into Your Vagrant Install
vagrant box add mynewbox mynew.box
Use the NodeSource PPA. For details look at the installation instructions. First, choose the Node.js version you need and add the sources for it:
# for Node.js v4
curl -sL https://deb.nodesource.com/setup_4.x | sudo -E bash -
# OR for Node.js v5
curl -sL https://deb.nodesource.com/setup_5.x | sudo -E bash -
# OR for Node.js v6
curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash -
Then install the Node.js package.