bazel query 'rdeps(..., //vistar/geo/qtdb:go_default_library)' --output package
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.
import { h, Component } from 'preact'; | |
/** Creates a new store, which is a tiny evented state container. | |
* @example | |
* let store = createStore(); | |
* store.subscribe( state => console.log(state) ); | |
* store.setState({ a: 'b' }); // logs { a: 'b' } | |
* store.setState({ c: 'd' }); // logs { c: 'd' } | |
*/ |
services: | |
myservice: | |
volumes: npm-cache:/root/.npm | |
command: npm run install-start | |
volumes: | |
npm-cache: | |
external: false |
adb: implement "adb reverse <local> <remote>" | |
This implements the logical opposite of 'adb forward', i.e. | |
the ability to reverse network connections from the device | |
to the host. | |
This feature is very useful for testing various programs | |
running on an Android device without root or poking at the | |
host's routing table. | |
Options and parameters are exactly the same as those for |
"use strict" | |
const fs = require("fs") | |
const path = require("path") | |
const transformer = require("react-native/packager/transformer") | |
/* | |
1. put this file at your react native project workspace root, | |
2. then run command: | |
`react-native start --transformer ./transformer.js` |
brew install ImageMagick
ffmpeg -ss 14:55 -i video.mkv -t 5 -s 480x270 -f image2 %04d.png
- -ss 14:55 gives the timestamp where I want FFmpeg to start, as a duration string.
- -t 5 says how much I want FFmpeg to decode, using the same duration syntax as for -ss.
- -s 480x270 tells FFmpeg to resize the video output to 480 by 270 pixels.
- -f image2 selects the output format, a series of still images — make sure there are leading zeros in filename.
Git for Windows comes bundled with the "Git Bash" terminal which is incredibly handy for unix-like commands on a windows machine. It is missing a few standard linux utilities, but it is easy to add ones that have a windows binary available.
The basic idea is that C:\Program Files\Git\mingw64\
is your /
directory according to Git Bash (note: depending on how you installed it, the directory might be different. from the start menu, right click on the Git Bash icon and open file location. It might be something like C:\Users\name\AppData\Local\Programs\Git
, the mingw64
in this directory is your root. Find it by using pwd -W
).
If you go to that directory, you will find the typical linux root folder structure (bin
, etc
, lib
and so on).
If you are missing a utility, such as wget, track down a binary for windows and copy the files to the corresponding directories. Sometimes the windows binary have funny prefixes, so
// connect() is a function that injects Redux-related props into your component. | |
// You can inject data and callbacks that change that data by dispatching actions. | |
function connect(mapStateToProps, mapDispatchToProps) { | |
// It lets us inject component as the last step so people can use it as a decorator. | |
// Generally you don't need to worry about it. | |
return function (WrappedComponent) { | |
// It returns a component | |
return class extends React.Component { | |
render() { | |
return ( |
Charles Proxy Map Remote over HTTP or HTTPS
The Map Remote tool changes the request location, per the configured mappings, so that the response is transparently served from the new location as if that was the original request.
Using this feature for http
resources does't require anything else apart from just configuring your Map Remote entry.
Always make sure you are clearing your cache before you test. Even if Charles is configured properly you might not see the changes unless the browser gets the resource again from the server and not for its local cache.