Find a unique name based on a prefix for a content in a container
(eg. a file in a directory) adding a digit to the name
Does it in log2(n) + log2(n/2) were n is the number of duplicates
This would be used eg. in a CMS? giving identifiers based on content title, or when shortening file names on a file system, etc.
This is a hack to get around the read-only nature of __closure__ on function objects. Watch your step!
Does not require multiprocessing, easy to hack, maybe not optimal but did the job for a make like tool I wrote.
I'm a hack programmer -- no formal education. So, I don't know if this is technically a "factory", "abstract factory" or something else.
It is a way to generate a class dynamically, perhaps based on run-time...
This is a quick-hack module I wrote up in a couple of hours that allows for a nicer syntax to build up struct-like binary packing and unpacking. The point was to get it to be concise and as C-like as possible. This script requires python3 for it's...
Similar to some other recipes on this site, this script allows you to access results from queries by attribute (eg, row.field_name), by key (eg, row['field_name']) or by Index (eg, row or row[:2], etc.). It is different from other recipes in...
Files existing on damaged media (eg old CD-ROMs) are not completely lost. Often, readers will read sectors unreadable in other readers. The "trick" is to merge the successful reads from several devices.
This useless hack allows normal functions to be attached to a 'ThunkSpace' which causes the function to be lazily evaluated when the thunk is referenced. It is just a experiment using closures and descriptors to try and change python function call...
this is a hack to get the "foo" module that's outside a package whithin a file of the package, when it also contains a module named "foo" (ie relative imports)
This hack allows you to add a cookie/header to a SOAPpy request. It uses a keyword args all-through to pass your own transports down to the SOAPpy core. It uses the ClientCookie module to store the cookies generated and/or to send the cookies.
Password will be generated in the form 'word'+digits+'word' eg.,nice137pace
instead of a difficult-to-remember - K8Yn9muL
Just a little bit of hack: a linear equations solver using eval and built-in complex numbers:
>>> solve("x - 2*x + 5*x - 46*(235-24) = x + 2")
Hack a class's __init__ method without subclassing the class
because a) you can't modify the original class and b) you can't modify other
classes already using the first class. This is a gross hack that should only
be used to work...
A hack to quickly replace multiple
characters/strings in a string with
characters from another string.
Users can use this script and modify their TinyMCE editor to support CSS classes and ids in their RTE editor.
A bar will be added to...
When a user enters an n x n matrix eg. A=[1 1 1; 3 1 -1; 2 1 -1] the function computes the corresponding cofactors.
ARCGRIDWRITE converts data in a matlab grid (as produced by eg. meshgrid and griddata) into a text file in Arc ASCII Grid Format. The file can also be automatically converted to raster on PC's with ARCINFO installed.
EXAMPLE - create a...
This is really a small hack that I wanted to share just to inspire more people to make interactive Matlab graphics. Use it as is or use the code as a template to do more advanced stuff.
Here is how it works (for a 2-D patch):
EG-Attachments add a new shortcode attachements. This shortcode can be used with many options. But you don't need to know all of these options, because the plugin is "TinyMCE integrated" : from the post editor, just click on the...
The standard Archives widget doesn't accept a lot of parameters. You can just specify
* a title,
* if you want to display posts count or not.
With the EG-Archives widget, you can choose
* the title,