This is a work in progress. Check back frequently.
| library(httr) | |
| library(jsonlite) | |
| # 1. Find OAuth settings for google: | |
| # https://developers.google.com/accounts/docs/OAuth2InstalledApp | |
| oauth_endpoints("google") | |
| # 2. Register an application at https://cloud.google.com/console#/project | |
| # Replace key and secret below. | |
| myapp <- oauth_app("google", |
A curated list of AWS resources to prepare for the AWS Certifications
A curated list of awesome AWS resources you need to prepare for the all 5 AWS Certifications. This gist will include: open source repos, blogs & blogposts, ebooks, PDF, whitepapers, video courses, free lecture, slides, sample test and many other resources.
| // Since `overlapArea` function is monotonic increasing, we can perform a | |
| // simple bisection search to find the distance that leads to an overlap | |
| // area within epsilon of the desired overlap. | |
| function distanceForOverlapArea(r1, r2, desiredOverlap) { | |
| // Ensure r1 <= r2 | |
| if (r1 > r2) { | |
| var temp = r2; | |
| r2 = r1; | |
| r1 = temp; | |
| } |
| // curl -X POST -H "Content-Type: application/octet-stream" --data-binary '@filename' http://127.0.0.1:5050/upload | |
| package main | |
| import ( | |
| "fmt" | |
| "io" | |
| "net/http" | |
| "os" | |
| "time" |
| /* global localStorage */ | |
| import {observable, autorunAsync} from 'mobx' | |
| import _ from 'lodash' | |
| function storedObservable (key, defaultValue, debounce) { | |
| let fromStorage = localStorage.getItem(key) | |
| const defaultClone = _.cloneDeep(defaultValue) // we don't want to modify the given object, because userscript might want to use the original object to reset the state back to default values some time later | |
| if (fromStorage) { | |
| _.merge(defaultClone, JSON.parse(fromStorage)) | |
| } |
####Rets Rabbit http://www.retsrabbit.com
Rets Rabbit removes the nightmare of importing thousands of real estate listings and photos from RETS or ListHub and gives you an easy to use import and Web API server so you can focus on building your listing search powered website or app.
| # https://www.topbug.net/blog/2013/04/14/install-and-use-gnu-command-line-tools-in-mac-os-x/ | |
| brew install coreutils | |
| brew install binutils | |
| brew install diffutils | |
| brew install ed --with-default-names | |
| brew install findutils --with-default-names | |
| brew install gawk | |
| brew install gnu-indent --with-default-names | |
| brew install gnu-sed --with-default-names |
| const cors = require('cors')({origin: true}); | |
| exports.sample = functions.https.onRequest((req, res) => { | |
| cors(req, res, () => { | |
| res.send('Passed.'); | |
| }); | |
| }); |
The following are examples of the four types rate limiters discussed in the accompanying blog post. In the examples below I've used pseudocode-like Ruby, so if you're unfamiliar with Ruby you should be able to easily translate this approach to other languages. Complete examples in Ruby are also provided later in this gist.
In most cases you'll want all these examples to be classes, but I've used simple functions here to keep the code samples brief.
This uses a basic token bucket algorithm and relies on the fact that Redis scripts execute atomically. No other operations can run between fetching the count and writing the new count.
