Skip to content

Instantly share code, notes, and snippets.

View 1stvamp's full-sized avatar
:shipit:

Wes Mason 1stvamp

:shipit:
View GitHub Profile
vagrant@honshuu-wes:/honshuu/honshuu-alerts$ python bootstrap.py
Downloading http://pypi.python.org/packages/source/d/distribute/distribute-0.6.44.tar.gz
Extracting in /tmp/tmpC6z9Dx
Now working in /tmp/tmpC6z9Dx/distribute-0.6.44
Building a Distribute egg in /tmp/tmpaKU6cw
/tmp/tmpaKU6cw/distribute-0.6.44-py2.7.egg
Picked version "1.7.1" from config file
No local packages or download links found for zc.buildout==1.7.1
error: Could not find suitable distribution for Requirement.parse('zc.buildout==1.7.1')
An error occurred when trying to install zc.buildout. Look above this message for any errors that were output by easy_install.
easy_install jinja2==2.6
Searching for jinja2==2.6
Reading http://pypi.python.org/simple/jinja2/
No local packages or download links found for jinja2==2.6
Best match: None
Traceback (most recent call last):
File "/Users/wes/.virtualenvs/test/bin/easy_install", line 8, in <module>
load_entry_point('setuptools==0.6c11', 'console_scripts', 'easy_install')()
File "/Users/wes/.virtualenvs/test/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg/setuptools/command/easy_install.py", line 1712, in main
File "/Users/wes/.virtualenvs/test/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg/setuptools/command/easy_install.py", line 1700, in with_ei_usage
@1stvamp
1stvamp / phpweekly_feb21_giveaway.php
Created February 21, 2013 09:27
February 21st PHP Weekly giveaway script
<?php
$sd_subscribers = file(dirname(__FILE__) . '/sd.txt');
$sd_winner = $sd_subscribers[array_rand($sd_subscribers)];
$dc4d_subscribers = file(dirname(__FILE__) . '/dc4d.txt');
$dc4d_winner = $dc4d_subscribers[array_rand($dc4d_subscribers)];
echo "SD winner:\n";
@1stvamp
1stvamp / bootstrap.py
Last active December 12, 2015 10:49
zc.buildout 1.x bootstrap that uses the version of zc.buildout from your buildout.cfg, if set
##############################################################################
#
# Copyright (c) 2006 Zope Foundation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
@1stvamp
1stvamp / phpweekly_feb7_giveaway.php
Created February 6, 2013 23:52
PHP script to randomly pick winners of PHP Weekly issue #8 giveaway
<?php
$header = null;
$subscribers = array();
$handle = fopen(dirname(__FILE__).'/members_PHP_Weekly_Feb_6_2013.csv', 'r');
// fgetcsv is a bit naff, luckily I was able to massage this CSV into an easily parsable format
while (($line = fgetcsv($handle, 1000, ",")) !== false) {
if ($header === null) {
$header = $line;
} else {
@1stvamp
1stvamp / githubtoken.py
Last active December 12, 2015 03:18
A simple script to generate and return a GitHub OAuth token for a user using the authorizations API, requires python-requests
#!/usr/bin/env python
import sys
import json
import requests
from getpass import getpass
try:
username = sys.argv[1]
except:
print "Gimme a username: "
@1stvamp
1stvamp / gplus_unf.css
Last active October 13, 2015 13:27
User stylesheet to make Google+ UI usable again by removing excess dross
div.Nj.mu.a-f-e.bR > div.ZNa.aS
{
display: none;
}
div[componentid="13"], div[componentid="4"], div[componentid="14"], div[componentid="34"], div[componentid="33"], div[componentid="56"], div[componentid="6"], div[componentid="5"], div[componentid="7"], div[componentid="76"],
div[componentid="81"]
{
display: none;
}
@1stvamp
1stvamp / composer-bootstrap.php
Created November 12, 2012 00:58
Composer bootstrap script using local Composer web installer
#!/usr/bin/env php
<?php
/**
* Composer bootstrap script using local Composer web installer
*
* Copyright (c) 2012, Boxed Ice Limited
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@1stvamp
1stvamp / __.py
Created October 25, 2012 21:18
Some gentle experimentation with the __ "private" property name mangling in python
python
Python 2.7.1 (r271:86832, Jul 31 2011, 19:30:53)
[GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> class test(object):
... def __blah(self):
... print 'blah'
... def meh(self):
... self.__blah()
...
@1stvamp
1stvamp / dynamic_getters.js
Created October 11, 2012 23:16
Define object getters from an array
var properties = ['users', 'servers', 'monkeys'];
var container = {};
function generate_getter(property) {
return function() {
return 'I am ' + property;
};
}
for(i in properties) {