Models | Examples |
---|---|
Display ads | Yahoo! |
Search ads |
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
First, install nginx for mac with "brew install nginx". | |
Then follow homebrew's instructions to know where the config file is. | |
1. To use https you will need a self-signed certificate: https://devcenter.heroku.com/articles/ssl-certificate-self | |
2. Copy it somewhere (use full path in the example below for server.* files) | |
3. sudo nginx -s reload | |
4. Access https://localhost/ | |
Edit /usr/local/etc/nginx/nginx.conf: |
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
"""Decorator to quickly add statsd (graphite) instrumentation to Celery | |
task functions. | |
With some slight modification, this could be used to instrument just | |
about any (non-celery) function and be made abstract enough to customize | |
metric names, etc. | |
Stats reported include number of times the task was accepted by a worker | |
(`started`), the number of successes, and the number of times the task | |
raised an exception. In addition, it also reports how long the task took |
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 http://www.aishack.in/2010/07/transparent-image-overlays-in-opencv/ | |
# Note: This code assumes a PNG with a Color->Transparency, with black as the alpha color | |
from cv2 import * | |
src = cv.LoadImage("image.jpg") # Load a source image | |
overlay = cv.LoadImage("ghost.png") # Load an image to overlay | |
posx = 170 # Define a point (posx, posy) on the source | |
posy = 100 # image where the overlay will be placed | |
S = (0.5, 0.5, 0.5, 0.5) # Define blending coefficients S and D |
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
git ls-files -z | xargs -0n1 git blame -w | perl -n -e '/^.*\((.*?)\s*[\d]{4}/; print $1,"\n"' | sort -f | uniq -c | sort -n |
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
class $ | |
constructor: (query) -> | |
return document.querySelector(query) | |
@find: (parent, query) -> | |
parent.querySelector(query) | |
@findAll: (parent, query) -> | |
parent.querySelectorAll(query) |
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
#!/bin/sh | |
echo Install all AppStore Apps at first! | |
# no solution to automate AppStore installs | |
read -p "Press any key to continue... " -n1 -s | |
echo '\n' | |
echo Install and Set San Francisco as System Font | |
ruby -e "$(curl -fsSL https://raw.github.com/wellsriley/YosemiteSanFranciscoFont/master/install)" | |
echo Install Homebrew, Postgres, wget and cask | |
ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)" |
When hosting our web applications, we often have one public IP
address (i.e., an IP address visible to the outside world)
using which we want to host multiple web apps. For example, one
may wants to host three different web apps respectively for
example1.com
, example2.com
, and example1.com/images
on
the same machine using a single IP address.
How can we do that? Well, the good news is Internet browsers
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
#![feature(macro_rules)] | |
/// MIT license etc. etc. | |
/// | |
/// Experimenting with Python-like list comprehensions. | |
/// | |
/// An attempt to explore the possibility space for ergonomic improvements | |
/// in Rust that can come post v1.0. Notice that there are not type declerations. | |
/// Aside from the "c!" macro invocation, Rust allows for an exact copy of the | |
/// Python comprehension syntax. |
OlderNewer