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/local/bin/python | |
"""Replacement for htpasswd""" | |
# Original author: Eli Carter | |
import os | |
import sys | |
import random | |
from optparse import OptionParser | |
# We need a crypt module, but Windows doesn't have one by default. Try to find |
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
var BOTTOM_PADDING = 25; | |
// calculate the bounding box for the image | |
var containerNode = Y.one('#containerId'); | |
// viewport height | |
var windowHeight = Y.one('body').get('winHeight'); | |
// grab the box's width based on it's container | |
var boxWidth = parseInt(mediaPlayerNode.get('offsetWidth')) - 15; // 15px?? |
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
sudo sed -i "s/archive\.ubuntu/mirrors.digitalocean/g" /etc/apt/sources.list |
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
"""Examples of how to implement inheritance with Django models. | |
Idea here is DRY (don't repeat yourself). If models are similar, let them | |
share functionality to the extent that its ancestrty makes sense. | |
It's important to note is that because of the "abstract = True", Django knows | |
not to create tables for those models, and instead only creates tables for | |
those models that implement those abstract base classes. | |
It can also be noted that instead of having one gigantic, monolithic models.py |
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
# this defines a role "role-name" in the account where this TF will be applied | |
resource "aws_iam_role" "role_name" { | |
name = "role-name" | |
description = "Allows role-name to do things in account" | |
assume_role_policy = "${data.aws_iam_policy_document.my_role.json}" | |
} | |
# this says that any one in a separate account with ID 123456789012 can assume the "role-name" role | |
data "aws_iam_policy_document" "role_name" { | |
statement { |
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 -m smtpd -n -c DebuggingServer localhost:1025 |
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 re | |
def convert_1252_codes(text): | |
"""Convert windows-1252 characters to appropriate html entities. | |
@param str String to filter | |
@type string/unicode | |
@return unicode version of filtered string | |
Adapted from: http://effbot.org/zone/unicode-gremlins.htm |
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
// run at: https://play.golang.org/p/bhgYlgGbdHz | |
package main | |
import ( | |
"fmt" | |
) | |
func main() { | |
total := 22 | |
batch := 3 |
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
# Compiled source # | |
################### | |
*.com | |
*.class | |
*.dll | |
*.exe | |
*.o | |
*.so | |
*.pyc |
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
foo := a.o b.o c.o | |
bar := $(foo:%.o=%) | |
.PHONY: test | |
test: | |
echo $(bar) |