Using Requests and Beautiful Soup, with the most recent Beautiful Soup 4 docs.
Install our tools (preferably in a new virtualenv):
pip install beautifulsoup4
from django.core.files.temp import NamedTemporaryFile | |
def save_image_from_url(self): | |
""" | |
Save remote images from url to image field. | |
Requires python-requests | |
""" | |
r = requests.get(self.image_url) | |
if r.status_code == 200: |
Language.create!(name: 'English (US)', code: 'en', locale: 'en-US') if Language.count == 0 | |
if Administrator.count == 0 | |
admin = Administrator.new( | |
first_name: 'Super', | |
last_name: 'Admin', | |
email: '[email protected]', | |
password: 'adminpass', | |
password_confirmation: 'adminpass' | |
) |
Using Requests and Beautiful Soup, with the most recent Beautiful Soup 4 docs.
Install our tools (preferably in a new virtualenv):
pip install beautifulsoup4
Dear soon-to-be-former user, | |
We've got some fantastic news! Well, it's great news for us anyway. You, on | |
the other hand, are fucked. | |
We've just been acquired by: | |
<?php | |
// This script generates x number of random email addresses | |
// and outputs them to a CSV file. | |
// Modified version of http://www.laughing-buddha.net/php/email | |
// Number of emails you'd like to generate | |
$count = 13575; | |
// Open the file we're outputing to. (This file should exist before you run the script.) | |
$fp = fopen('emails.csv', 'w'); |
#!/usr/bin/ruby | |
# This script installs to /usr/local only. To install elsewhere you can just | |
# untar https://github.com/mxcl/homebrew/tarball/master anywhere you like. | |
#the first thing it does is define a bunch of methods to make things easier further on. | |
#That makes for sorta uncomfortable reading, since sometimes you can see *what* it's doing, | |
#but not *why* it's doing it. If you're mystified as to the purpose of something, go look | |
#at how it's used and see if that illuminates matters. | |
#Terminals use numbered control codes to indicate colors. It is inconvenient to try |
# Pow | |
alias startpow='curl get.pow.cx | sh' | |
alias stoppow='curl get.pow.cx/uninstall.sh | sh' |
source ~/.rprompt.bash | |
export RPROMPT='$(date)' |
@mixin ie6 { * html & { @content } } | |
#logo { | |
background-image: url("/images/logo.png"); | |
@include ie6 { background-image: url("/images/logo.gif"); } | |
} |
#!/usr/bin/env ruby | |
# Usage: gitio URL [CODE] | |
# | |
# Turns a github.com URL | |
# into a git.io URL | |
# | |
# Copies the git.io URL to your clipboard. | |
url = ARGV[0] | |
code = ARGV[1] |