This article is now published on my website: Prefer Subshells for Context.
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
package com.thinkminimo.step | |
class StepExample extends Step { | |
get("/") { "Hello World!" } | |
} |
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
/* Python(ish) string formatting: | |
* >>> format('{0}', ['zzz']) | |
* "zzz" | |
* >>> format('{x}', {x: 1}) | |
* "1" | |
*/ | |
var format = (function() { | |
var re = /\{([^}]+)\}/g; | |
return function(s, args) { | |
return s.replace(re, function(_, match){ return args[match]; }); |
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
ಠ_ಠ | |
( ͡° ͜ʖ ͡°) | |
¯\_(ツ)_/¯ | |
(╯°□°)╯︵ ┻━┻ | |
http://www.fileformat.info/convert/text/upside-down.htm | |
WRTTN http://wrttn.me/30dbfd/ | |
Unicode Emoticons |
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
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
""" | |
HTTP server that provides a web interface to run "tail" on a file, | |
like the Unix command. | |
This is a standalone script. No external dependencies required. | |
How to invoke: |
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
# -*- coding: utf-8 -*- | |
import os | |
from flask import Flask | |
from flask_heroku import Heroku | |
from flask_sslify import SSLify | |
from raven.contrib.flask import Sentry | |
from flask.ext.celery import Celery |
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
@split | |
@login_required | |
def hello(): | |
return render_template('hello.html') | |
@hello.for_mimetype("application/json") | |
@login_required | |
def hello(): | |
return jsonify({"hello":"flask"}) |
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
# Basically the nginx configuration I use at konklone.com. | |
# I check it using https://www.ssllabs.com/ssltest/analyze.html?d=konklone.com | |
# | |
# To provide feedback, please tweet at @konklone or email eric@konklone.com. | |
# Comments on gists don't notify the author. | |
# | |
# Thanks to WubTheCaptain (https://wubthecaptain.eu) for his help and ciphersuites. | |
# Thanks to Ilya Grigorik (https://www.igvita.com) for constant inspiration. | |
server { |
This Gist contains instructions to setup Ubuntu server with Nginx, uWSGI & Node.js with that can serve for any Python apps (Django for instance) and will allow it's automatized deployment.
The content is as follows:
01-ubuntu.md
– A basic Ubuntu server setup.02-nginx-uwsgi-nodejs.md
– Nginx, uWSGI and Node.js installation and setup.03-deployment.md
– A server setup for automatized deployment.04-mariadb.md
– Mariadb installation and setup.
When the directory structure of your Node.js application (not library!) has some depth, you end up with a lot of annoying relative paths in your require calls like:
const Article = require('../../../../app/models/article');
Those suck for maintenance and they're ugly.
OlderNewer