Skip to content

Instantly share code, notes, and snippets.

George Lesica glesica

Block or report user

Report or block glesica

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@glesica
glesica / gist:1028630
Created Jun 16, 2011
Install virtualenvwrapper - .bashrc
View gist:1028630
# setup virtualenvwrapper
export WORKON_HOME=~/.envs
mkdir -p $WORKON_HOME
source /usr/local/bin/virtualenvwrapper.sh
View gist:1036971
* POST - create a new log item with the POSTed data. The response
will include a status_code, status_message and the ID of the
newly created log item (if one was successfully created).
Request must contain a valid bot key along with enough information
to construct a valid log item.
* DELETE - delete the given log item. Must include the item ID number
or enough information to uniquely identify the item (see GET
below).
@glesica
glesica / hn.py
Created Jun 21, 2011
hacker news phenny module
View hn.py
'''
Phenny module to make Phenny fetch the highest scoring HN article and post
it for discussion.
'''
import os, urllib, json
from datetime import datetime as dt
LOG_PATH = '.'
View gist:1103181
# Generated by iptables-save v1.4.4 on Fri Jun 18 01:22:38 2010
*filter
# WHAT THE FUCK DO THE NEXT THREE LINES DO?
:INPUT DROP [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [27:2732]
-A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
-A INPUT -i lo -j ACCEPT
View gist:1299668
// Mutifunctional method to get and set values to a collection
// The value/s can optionally be executed if it's a function
access: function( elems, key, value, exec, fn, pass ) {
var length = elems.length;
// Setting many attributes
if ( typeof key === "object" ) {
for ( var k in key ) {
jQuery.access( elems, k, key[k], exec, fn, value );
}
View gist:1299685
attr: function( elem, name, value, pass ) {
var nType = elem.nodeType;
// don't get/set attributes on text, comment and attribute nodes
if ( !elem || nType === 3 || nType === 8 || nType === 2 ) {
return undefined;
}
if ( pass && name in jQuery.attrFn ) {
return jQuery( elem )[ name ]( value );
View gist:1306216
var forward = function($c) {
var t = window.setTimeout(function() {
if ($c.data('running')) {
goForward.call($c);
}
forward($c);
}, settings.delay);
}
forward($container);
@glesica
glesica / software.vbs
Created Nov 4, 2011
A VBScript to enumerate applications installed on a machine and output a tab-delimited CSV file, one for each machine. The idea is for this to be slightly less awful than all the similar scripts out there on the webz.
View software.vbs
'*******************************************************************************
' software.vbs
' Create a list of software installed on one or more
' machines in TSV format.
'
' Usage: cscript.exe software.vbs [/path:<path>] [machine names]
'
' If <path> is given, the script will attempt to store logs
' in that location. It is treated as a relative path and must
' end in a backslash.
View gist:1356974
mysql> SELECT c.computer_name, a.application_name, a.application_version, i.audit_date FROM installations i INNER JOIN computers c ON i.computer_id=c.computer_id INNER JOIN applications a ON i.application_id=a.application_id WHERE c.computer_name="computer01" ORDER BY c.computer_name, a.application_name, i.audit_date;
+---------------+-----------------------+---------------------+------------+
| computer_name | application_name | application_version | audit_date |
+---------------+-----------------------+---------------------+------------+
| computer01 | Adobe Acrobat Reader | 8.1.4 | 2011-11-09 |
| computer01 | Adobe Acrobat Reader | 8.1.4 | 2011-11-10 |
| computer01 | Microsoft Office 2007 | 12.0.1 | 2011-11-09 |
| computer01 | Microsoft Office 2007 | 12.0.1 | 2011-11-10 |
| computer01 | Mozilla Firefox | 5.0 | 2011-11-09 |
| computer01 | Mozilla Firefox | 7.0 | 2011-11-10 |
View gist:1358942
def post(self, computer_name):
computer = self._get_computer(computer_name)
data = json.loads(self.request.body)
for application in data['applications']:
result = self.database.query(
'''
INSERT INTO applications (
application_name,
You can’t perform that action at this time.