See how a minor change to your commit message style can make you a better programmer.
Format: <type>(<scope>): <subject>
<scope>
is optional
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
""" | |
longqi 20/Jan/16 22:42 | |
""" | |
""" | |
default.txt | |
""" | |
""" |
[ | |
{ | |
owner: 'bcoe', | |
repo: 'top-npm-users', | |
description: ':star: Generate a list of top npm users by based on monthly downloads.', | |
language: 'JavaScript', | |
isFork: false, | |
stargazers: 27, | |
watchers: 27 | |
} |
#!/bin/bash | |
USER=${1:-sebble} | |
STARS=$(curl -sI https://api.github.com/users/$USER/starred?per_page=1|egrep '^Link'|egrep -o 'page=[0-9]+'|tail -1|cut -c6-) | |
PAGES=$((658/100+1)) | |
echo You have $STARS starred repositories. | |
echo |
A lot of people run into the problem of running Let's Encrypt's CertBot Tool and an NGINX on the same container host. A big part of this has to do with CertBot needing either port 80 or 443 open for the tool to work as intended. This tends to conflict with NGINX as most people usually use port 80 (HTTP) or 443 (HTTPS) for their reverse proxy. Section 1 outlines how to configure NGINX to get this to work, and Section 2 is the Docker command to run CertBot.
I use Docker Compose (docker-compose) for my NGINX server. My docker-compose.yml file looks something like this:
This is a compiled list of falsehoods programmers tend to believe about working with time.
Don't re-invent a date time library yourself. If you think you understand everything about time, you're probably doing it wrong.
import requests | |
LOGIN_URL = "http://mydjangosite.com/accounts/login/" | |
ENDPOINT_URL = 'http://mydjangosite.com/myendpoint/' | |
''' | |
Create a session. | |
A session will automatically store the cookies that Django | |
sends back to you, like the csrf token and a the session id. You | |
could do it without the session, but then you'd have to save off the |
#!/usr/bin/env python | |
# Concept taken from http://code.activestate.com/recipes/527747-invert-css-hex-colors/ | |
# Modified to take the css filename as an argument and also handle rgb() and rgba() values | |
# | |
# To run: | |
# python ./colour-inverter.py <path/to/file.css> | |
import os | |
import re |
# Credit for this: Nicholas Swift | |
# as found at https://medium.com/@nicholas.w.swift/easy-a-star-pathfinding-7e6689c7f7b2 | |
from warnings import warn | |
import heapq | |
class Node: | |
""" | |
A node class for A* Pathfinding | |
""" |