Skip to content

Instantly share code, notes, and snippets.

@plucena24
plucena24 / gns3_config_generator.py
Last active November 26, 2018 13:27
Automatically generate and apply basic IP addressing config for a GNS3 dynamips topology.
'''
GNS3_auto_ip_script
author: [email protected]
Automatically generate and apply basic IP addressing config for a GNS3 dynamips topology.
Example: a network consisting of R1---R2---R3.
Using the script, the links will be numbered as:
@nicoddemus
nicoddemus / cx_freeze_and_distutils.md
Created May 19, 2015 17:45
Problem trying to freeze an executable which imports distutils modules (directly or indirectly)

cxFreeze and distutils

Problem

When trying to freeze a script which imports any distutils module (for example, distutils.dist), the script fails at runtime with an exception like this:

>   from distutils import dist, sysconfig
E   ImportError: cannot import name dist
@PatrickTulskie
PatrickTulskie / resque_retry.rb
Created July 25, 2011 19:15 — forked from clemens/resque_retry.rb
Retry failed Resque jobs in Ruby
# inspired by http://ariejan.net/2010/08/23/resque-how-to-requeue-failed-jobs
# retry all failed Resque jobs except the ones that have already been retried
# This is, for instance, useful if you have already retried some jobs via the web interface.
Resque::Failure.count.times do |i|
Resque::Failure.requeue(i) unless Resque::Failure.all(i, 1)['retried_at'].present?
end
# retry all :)
Resque::Failure.count.times do |i|
@jayjanssen
jayjanssen / semaphore.js
Created May 27, 2011 18:30
Node.js semaphores
var Semaphore = function(callback, context) {
this.semaphore = 0;
this.callback = callback;
this.context = context || this;
};
Semaphore.prototype.increment = function() {
this.semaphore++;
};
@simon-engledew
simon-engledew / run script for resque w. monit
Created February 16, 2010 12:59
A script to run Resque as a daemon.
#!/usr/bin/env ruby
if GC.respond_to?(:copy_on_write_friendly=); GC.copy_on_write_friendly = true; end
def pidfile
@pidfile ||= File.expand_path(File.join('..', '..', 'tmp', 'pids', 'consumer.pid'), __FILE__)
end
case ARGV.first
when 'start' then