git clone https://gist.github.com/6780d7cc0cabb1b4d6c8.git
$ npm install # maybe npm start will take care of it but just in case
$ npm start && open out.png
> offscreen-sample@1.0.0 start /Users/bsergean/src/offscreen_sample
| *.tar.gz | |
| .sentinel.* |
| """ | |
| Experimental wrapper to use Chimera's Python directly from console. | |
| You can `import chimera` with no errors! | |
| Usage | |
| ===== | |
| 1. Alias your /path/to/chimera/bin/python binary to something more user-friendly, like `chimerapy`. | |
| 2. Download these two files and put them together | |
| 3. Run `chimerapy -i chimera_cli.py`. (Tip: Realias `chimerapy` to this command). |
| #!/usr/bin/env python | |
| import json | |
| import os | |
| import requests | |
| def main(): | |
| module = AnsibleModule( | |
| argument_spec=dict( | |
| cert_path=dict(required=True), |
| # This is just a cheat sheet: | |
| # On production | |
| sudo -u postgres pg_dump database | gzip -9 > database.sql.gz | |
| # On local | |
| scp -C production:~/database.sql.gz | |
| dropdb database && createdb database | |
| gunzip < database.sql.gz | psql database |
| function mapValues(obj, fn) { | |
| return Object.keys(obj).reduce((result, key) => { | |
| result[key] = fn(obj[key], key); | |
| return result; | |
| }, {}); | |
| } | |
| function pick(obj, fn) { | |
| return Object.keys(obj).reduce((result, key) => { | |
| if (fn(obj[key])) { |
| /** | |
| * Produces a function which uses template strings to do simple interpolation from objects. | |
| * | |
| * Usage: | |
| * var makeMeKing = generateTemplateString('${name} is now the king of ${country}!'); | |
| * | |
| * console.log(makeMeKing({ name: 'Bryan', country: 'Scotland'})); | |
| * // Logs 'Bryan is now the king of Scotland!' | |
| */ | |
| var generateTemplateString = (function(){ |
Use these rapid keyboard shortcuts to control the GitHub Atom text editor on macOS.
| import express from "express"; | |
| /** | |
| * Takes a route handling function and returns a function | |
| * that wraps it after first checking that the strings in | |
| * `reserved` are not part of `req.body`. Used for ensuring | |
| * create and update requests do not overwrite server-generated | |
| * values. | |
| */ | |
| function checkReservedParams(routeHandler, ...reserved) { |
| // | |
| // README: | |
| // - Listens for PUSH events | |
| // - Fetches the ref pushed via the given remote | |
| // - Sets the repositories HEAD to latest ref | |
| // - Checks out the new HEAD (--force) | |
| // - Install dependencies from package.json | |
| // - Calls `npm run reload` (My app uses this) | |
| // - Calls `nginx -s reload` (My app also uses this) | |
| // |