These are great help in choosing an open source license:
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 | |
"""Command line script to convert a file, usually an image, into a data URI | |
for use on the web.""" | |
import base64 | |
import mimetypes | |
import os | |
import sys | |
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
/** | |
* Usage: node sockolepsy.js <listen> <forward> <delay> | |
* | |
* Creates a generic TCP proxy that can introduce a controllable degree of | |
* delay per packet. | |
* | |
* Params: | |
* listen - the port to listen on. | |
* forward - the port to foward to. | |
* delay - the amount of delay to introduce, in ms. |
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 main | |
import ( | |
"fmt" | |
"math" | |
) | |
const Psi = -1.0 / math.Phi | |
var Sqrt5 = math.Pow(5.0, 0.5) |
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
import argparse | |
import random | |
__all__ = ['d4', 'd6', 'd8', 'd10', 'd12', 'd20', 'd100'] | |
class D(): | |
"""A die. |
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
"""Generate random gemstones for D&D 5e | |
It always bothered me that the tables in the DMG won't let you randomly | |
generate a diamond worth 50gp, or 300gp, or 500gp, when these are all common | |
spell components. | |
This script generates random gemstones and values. It considers that you might | |
have a small diamond worth 50gp, but probably not a giant azurite worth 5000gp. | |
First, we get a base and a multiplier. A base could be e.g. 10, 100, 1000. A |
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
from django import forms | |
from myapp.models import Whatzit | |
class WhatzitForm(forms.ModelForm): | |
class Meta(object): | |
model = Whatzit | |
fields = ('foo', 'bar', 'baz') |
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
#!/bin/sh | |
# Import a (g|b)zipped SQL dump into a specified database through pipeviewer. | |
if [ $# -lt 2 ]; then | |
echo "USAGE: $0 <filename> <database>" | |
exit 1 | |
fi | |
EXT=${1/*./} |
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 ex | |
import ( | |
"fmt" | |
"testing" | |
) | |
func Multiplier(in int) int { | |
return in * 2 | |
} |
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
from django.core.cache import cache | |
from django.db import models | |
EMPTY = '-' # Not "None" | |
class MyModel(models.Model): | |
@classmethod | |
def _cache_key(cls, key): | |
return 'mymodel:{}'.format(key) | |
NewerOlder