Skip to content

Instantly share code, notes, and snippets.

View mvaled's full-sized avatar
🏠
Working

Manuel Vázquez Acosta mvaled

🏠
Working
  • Merchise Autrement
  • Cuba
  • X @mvaled
View GitHub Profile
#!/usr/bin/env ruby
# -*- coding: utf-8 -*-
# put in /etc/munin/plugins and restart munin-node
# by Dan Manges,
# http://www.dcmanges.com/blog/rails-application-visualization-with-munin
# NOTE: you might need to add munin to allow passwordless sudo for
# passenger-memory-stats
@mvaled
mvaled / gist:720753
Created November 29, 2010 22:22
Generates Wordpress.com's HTML from reStructuredText
#! /usr/bin/env python
# -*- encoding: utf-8 -*-
#
# Generate an HTML Snippet for WordPress Blogs from reStructuredText.
#
# This is a modification of the standard HTML writer that leaves out
# the header, the body tag, and several CSS classes that have no use
# in wordpress. What is left is an incomplete HTML document suitable
# for pasting into the WordPress online editor.
#
@mvaled
mvaled / ClaseX.php
Created December 16, 2010 16:25
A basic PHP IoC implementation.
<?php
class ClaseX {
private static $info;
public static function RegistrarInformacion($info) {
echo "Me estan poniendo informacion $info \n";
self::$info = $info;
}
}
@mvaled
mvaled / redis_pubsub_demo.rb
Created July 2, 2011 22:28 — forked from pietern/redis_pubsub_demo.rb
Simple demo to showcase Redis PubSub with EventMachine (modified to work with latests Cramp)
# Author: Pieter Noordhuis
# Modified (very lightly) by Manuel Vázquez Acosta in order to make it work with Cramp after commit https://github.com/lifo/cramp/commit/968e9030f253f74c94562555f3244aad4fe03e89
# Description: Simple demo to showcase Redis PubSub with EventMachine
#
# Update 7 Oct 2010:
# - This example does *not* appear to work with Chrome >=6.0. Apparently,
# the WebSocket protocol implementation in the cramp gem does not work
# well with Chrome's (newer) WebSocket implementation.
#
#
@mvaled
mvaled / module.rb
Created October 4, 2011 03:09
Ejemplo de módulos en Ruby. Ver post: http://manuelonsoftware.wordpress.com/?p=225
#!/usr/bin/env ruby
# -*- encoding: utf-8 -*-
# Mostly stealed from ActiveSupport
class Module
# Encapsulates the common pattern of:
#
# alias_method :foo_without_feature, :foo
# alias_method :foo, :foo_with_feature
#
@mvaled
mvaled / gitprompt.py
Created May 17, 2012 14:47
Simple file to be placed in IPython's conf dir to allow prompts to include the git branch and status.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# gitprompt.py
#
# Copyright 2012 Manuel Vázquez Acosta <mva DOT led AT google-mail-address-here.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
@mvaled
mvaled / renames_files.py
Created September 11, 2012 19:32
Normalizes files titles in a Plone instance
import transaction, pdb
from zope.interface import implementedBy
from zope.component import getUtility, queryUtility, queryAdapter
from Zope2 import debug
from Acquisition import aq_inner, aq_parent, aq_chain
from zope.app.component.hooks import setSite, getSiteManager
from Testing.makerequest import makerequest
from AccessControl.SecurityManagement import newSecurityManager, getSecurityManager
@mvaled
mvaled / is_this_a_bug.html
Created September 24, 2012 17:01
Fragment interaction with CSS.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>FF 15.0.1 Bug?</title>
<meta name="description" content="Shows a bug if FF 15.0.1" />
<meta name="author" content="Manuel Vazquez Acosta" />
<meta name="viewport" content="width=device-width; initial-scale=1.0" />
@mvaled
mvaled / UsbSnoop.log
Created November 26, 2012 04:07
SniffUSB log
[7 ms] UsbSnoop - FilterAddDevice(dc50b748) : DriverObject 8512c5a8, pdo 866bd2d0
[11 ms] UsbSnoop - FilterDispatchPnp(dc50b45c) : IRP_MJ_PNP (IRP_MN_QUERY_LEGACY_BUS_INFORMATION)
[11 ms] UsbSnoop - FdoHookDispatchPnp(dc50b45c) : IRP_MJ_PNP (IRP_MN_QUERY_LEGACY_BUS_INFORMATION)
[12 ms] UsbSnoop - FilterDispatchPnp(dc50b45c) : IRP_MJ_PNP (IRP_MN_QUERY_RESOURCE_REQUIREMENTS)
[12 ms] UsbSnoop - FdoHookDispatchPnp(dc50b45c) : IRP_MJ_PNP (IRP_MN_QUERY_RESOURCE_REQUIREMENTS)
[12 ms] UsbSnoop - FilterDispatchPnp(dc50b45c) : IRP_MJ_PNP (IRP_MN_FILTER_RESOURCE_REQUIREMENTS)
[12 ms] UsbSnoop - FdoHookDispatchPnp(dc50b45c) : IRP_MJ_PNP (IRP_MN_FILTER_RESOURCE_REQUIREMENTS)
[12 ms] UsbSnoop - FilterDispatchPnp(dc50b45c) : IRP_MJ_PNP (IRP_MN_START_DEVICE)
[12 ms] UsbSnoop - FdoHookDispatchPnp(dc50b45c) : IRP_MJ_PNP (IRP_MN_START_DEVICE)
[406 ms] UsbSnoop - FilterDispatchPnp(dc50b45c) : IRP_MJ_PNP (IRP_MN_QUERY_INTERFACE)
@mvaled
mvaled / fanstatic-core.patch
Created April 15, 2013 20:15
Possible fix (rather hackish)
diff -r 68d58cdd5004 fanstatic/core.py
--- a/fanstatic/core.py Wed Mar 27 07:16:35 2013 -0400
+++ b/fanstatic/core.py Mon Apr 15 16:12:43 2013 -0400
@@ -1063,12 +1063,17 @@
def consolidate(resources):
# keep track of rollups: rollup key -> set of resource keys
potential_rollups = {}
+ used_rollups_depends = {} # resource key -> rollup
for resource in resources:
for rollup in resource.rollups: