Custom recipe to get OS X 10.11 El Capitan running from scratch with useful applications and Node.js Developer environment. I use this gist to keep track of the important software and steps required to have a functioning system after fresh install.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const https = require('https'); | |
const fs = require('fs'); | |
// https://github.com/majodev/google-webfonts-helper/blob/master/server/logic/conf.js | |
const FORMAT_USER_AGENTS = { | |
// see http://www.dvdprojekt.de/category.php?name=Safari for a list of sample user handlers | |
// test generation through running grunt mochaTest:src | |
eot: 'Mozilla/5.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0)', | |
woff: 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:27.0) Gecko/20100101 Firefox/27.0', | |
// must serve complete woff2 file for one variant (no unicode range support yet!) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
###### | |
# Author: Marcello de Sales (marcello.desales@gmail.com) | |
# Description: Create Create Environment Variables in EC2 Hosts from EC2 Host Tags | |
# | |
### Requirements: | |
# * Install jq library (sudo apt-get install -y jq) | |
# * Install the EC2 Instance Metadata Query Tool (http://aws.amazon.com/code/1825) | |
# | |
### Installation: | |
# * Add the Policy EC2:DescribeTags to a User |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import praw | |
from requests.exceptions import ConnectionError, HTTPError, Timeout | |
def failable(f): | |
def wrapped(*args, **kwargs): | |
try: | |
return f(*args, **kwargs) | |
except praw.errors.APIException: | |
full = traceback.format_exc() | |
logging.warning("Reddit API call failed! %s" % full) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sqlalchemy | |
from sqlalchemy.ext.declarative import declarative_base | |
from sqlalchemy import Column, Integer, String, ForeignKey | |
from sqlalchemy.orm import sessionmaker, relationship | |
engine = sqlalchemy.create_engine('sqlite:///:memory:') | |
Base = declarative_base() | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<ul class="list-group"> | |
<li class="list-group-item-cust list-group-item"><span class="list-group-addon glyphicon glyphicon-calendar"></span> | |
8th March 2014</li> | |
<li class="list-group-item-cust list-group-item"><span class="list-group-addon glyphicon glyphicon-time"></span> | |
10:00</li> | |
<li class="list-group-item-cust list-group-item"><span class="list-group-addon glyphicon glyphicon-flag"></span> | |
Location</li> | |
</ul> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//adapted from the LoessInterpolator in org.apache.commons.math | |
function loess_pairs(pairs, bandwidth) | |
{ | |
var xval = pairs.map(function(pair){return pair[0]}); | |
var yval = pairs.map(function(pair){return pair[1]}); | |
console.log(xval); | |
console.log(yval); | |
var res = loess(xval, yval, bandwidth); | |
console.log(res); | |
return xval.map(function(x,i){return [x, res[i]]}); |