Scheme: Graph lines of code in Subversion


Warning: preg_replace_callback() [function.preg-replace-callback]: Unknown modifier 'c' in /usr/local/www/sites/jigcode.com/wp-content/plugins/wp-syntax/geshi/geshi.php on line 3324

Warning: preg_replace_callback() [function.preg-replace-callback]: Unknown modifier 'c' in /usr/local/www/sites/jigcode.com/wp-content/plugins/wp-syntax/geshi/geshi.php on line 3324

Warning: preg_replace_callback() [function.preg-replace-callback]: Unknown modifier 'c' in /usr/local/www/sites/jigcode.com/wp-content/plugins/wp-syntax/geshi/geshi.php on line 3324

Warning: preg_replace_callback() [function.preg-replace-callback]: Unknown modifier 'c' in /usr/local/www/sites/jigcode.com/wp-content/plugins/wp-syntax/geshi/geshi.php on line 3324

Warning: preg_replace_callback() [function.preg-replace-callback]: Unknown modifier 'c' in /usr/local/www/sites/jigcode.com/wp-content/plugins/wp-syntax/geshi/geshi.php on line 3324

Warning: preg_replace_callback() [function.preg-replace-callback]: Unknown modifier 'c' in /usr/local/www/sites/jigcode.com/wp-content/plugins/wp-syntax/geshi/geshi.php on line 3324

Warning: preg_replace_callback() [function.preg-replace-callback]: Unknown modifier 'c' in /usr/local/www/sites/jigcode.com/wp-content/plugins/wp-syntax/geshi/geshi.php on line 3324

Warning: preg_replace_callback() [function.preg-replace-callback]: Unknown modifier 'c' in /usr/local/www/sites/jigcode.com/wp-content/plugins/wp-syntax/geshi/geshi.php on line 3324

Warning: preg_replace_callback() [function.preg-replace-callback]: Unknown modifier 'c' in /usr/local/www/sites/jigcode.com/wp-content/plugins/wp-syntax/geshi/geshi.php on line 3324

Warning: preg_replace_callback() [function.preg-replace-callback]: Unknown modifier 'c' in /usr/local/www/sites/jigcode.com/wp-content/plugins/wp-syntax/geshi/geshi.php on line 3324

Warning: preg_replace_callback() [function.preg-replace-callback]: Unknown modifier 'c' in /usr/local/www/sites/jigcode.com/wp-content/plugins/wp-syntax/geshi/geshi.php on line 3324

Warning: preg_replace_callback() [function.preg-replace-callback]: Unknown modifier 'c' in /usr/local/www/sites/jigcode.com/wp-content/plugins/wp-syntax/geshi/geshi.php on line 3324

Warning: preg_replace_callback() [function.preg-replace-callback]: Unknown modifier 'c' in /usr/local/www/sites/jigcode.com/wp-content/plugins/wp-syntax/geshi/geshi.php on line 3324

Warning: preg_replace_callback() [function.preg-replace-callback]: Unknown modifier 'c' in /usr/local/www/sites/jigcode.com/wp-content/plugins/wp-syntax/geshi/geshi.php on line 3324

Warning: preg_replace_callback() [function.preg-replace-callback]: Unknown modifier 'c' in /usr/local/www/sites/jigcode.com/wp-content/plugins/wp-syntax/geshi/geshi.php on line 3324

Warning: preg_replace_callback() [function.preg-replace-callback]: Unknown modifier 'c' in /usr/local/www/sites/jigcode.com/wp-content/plugins/wp-syntax/geshi/geshi.php on line 3324

Warning: preg_replace_callback() [function.preg-replace-callback]: Unknown modifier 'c' in /usr/local/www/sites/jigcode.com/wp-content/plugins/wp-syntax/geshi/geshi.php on line 3324

Warning: preg_replace_callback() [function.preg-replace-callback]: Unknown modifier 'c' in /usr/local/www/sites/jigcode.com/wp-content/plugins/wp-syntax/geshi/geshi.php on line 3324

Warning: preg_replace_callback() [function.preg-replace-callback]: Unknown modifier 'c' in /usr/local/www/sites/jigcode.com/wp-content/plugins/wp-syntax/geshi/geshi.php on line 3324

Warning: preg_replace_callback() [function.preg-replace-callback]: Unknown modifier 'c' in /usr/local/www/sites/jigcode.com/wp-content/plugins/wp-syntax/geshi/geshi.php on line 3324

Warning: preg_replace_callback() [function.preg-replace-callback]: Unknown modifier 'c' in /usr/local/www/sites/jigcode.com/wp-content/plugins/wp-syntax/geshi/geshi.php on line 3324

Warning: preg_replace_callback() [function.preg-replace-callback]: Unknown modifier 'c' in /usr/local/www/sites/jigcode.com/wp-content/plugins/wp-syntax/geshi/geshi.php on line 3324

Warning: preg_replace_callback() [function.preg-replace-callback]: Unknown modifier 'c' in /usr/local/www/sites/jigcode.com/wp-content/plugins/wp-syntax/geshi/geshi.php on line 3324

Warning: preg_replace_callback() [function.preg-replace-callback]: Unknown modifier 'c' in /usr/local/www/sites/jigcode.com/wp-content/plugins/wp-syntax/geshi/geshi.php on line 3324

Warning: preg_replace_callback() [function.preg-replace-callback]: Unknown modifier 'c' in /usr/local/www/sites/jigcode.com/wp-content/plugins/wp-syntax/geshi/geshi.php on line 3324

Warning: preg_replace_callback() [function.preg-replace-callback]: Unknown modifier 'c' in /usr/local/www/sites/jigcode.com/wp-content/plugins/wp-syntax/geshi/geshi.php on line 3324

This checks out every tenth version from SVN and produces a data file which can easily be used as input to gnuplot. You can see the final graph.

"^[ \t][ \t]*void\\s+test[A-Za-z_0-9]*\\s*\\(\\s*\\)""h""Test_""cpp""h""hpp""cxx""hxx""report.txt""svn up -r ~a""."".svn""boost""WindowsSDK""XML""OPENSSL""Release""cxxtest""\\""\\""\\""\\""\\""\\""~a ~a ~a ~a"
Posted on June 11, 2009 at 8:38 am by Jason Felice · Permalink · One Comment
In: Jigs · Tagged with: , , , ,

Scheme: Save preprocessor output for all compiled files


Warning: preg_replace_callback() [function.preg-replace-callback]: Unknown modifier 'c' in /usr/local/www/sites/jigcode.com/wp-content/plugins/wp-syntax/geshi/geshi.php on line 3324

Warning: preg_replace_callback() [function.preg-replace-callback]: Unknown modifier 'c' in /usr/local/www/sites/jigcode.com/wp-content/plugins/wp-syntax/geshi/geshi.php on line 3324

Warning: preg_replace_callback() [function.preg-replace-callback]: Unknown modifier 'c' in /usr/local/www/sites/jigcode.com/wp-content/plugins/wp-syntax/geshi/geshi.php on line 3324

Warning: preg_replace_callback() [function.preg-replace-callback]: Unknown modifier 'c' in /usr/local/www/sites/jigcode.com/wp-content/plugins/wp-syntax/geshi/geshi.php on line 3324

Warning: preg_replace_callback() [function.preg-replace-callback]: Unknown modifier 'c' in /usr/local/www/sites/jigcode.com/wp-content/plugins/wp-syntax/geshi/geshi.php on line 3324

Warning: preg_replace_callback() [function.preg-replace-callback]: Unknown modifier 'c' in /usr/local/www/sites/jigcode.com/wp-content/plugins/wp-syntax/geshi/geshi.php on line 3324

Warning: preg_replace_callback() [function.preg-replace-callback]: Unknown modifier 'c' in /usr/local/www/sites/jigcode.com/wp-content/plugins/wp-syntax/geshi/geshi.php on line 3324

Warning: preg_replace_callback() [function.preg-replace-callback]: Unknown modifier 'c' in /usr/local/www/sites/jigcode.com/wp-content/plugins/wp-syntax/geshi/geshi.php on line 3324

Warning: preg_replace_callback() [function.preg-replace-callback]: Unknown modifier 'c' in /usr/local/www/sites/jigcode.com/wp-content/plugins/wp-syntax/geshi/geshi.php on line 3324

Warning: preg_replace_callback() [function.preg-replace-callback]: Unknown modifier 'c' in /usr/local/www/sites/jigcode.com/wp-content/plugins/wp-syntax/geshi/geshi.php on line 3324

Warning: preg_replace_callback() [function.preg-replace-callback]: Unknown modifier 'c' in /usr/local/www/sites/jigcode.com/wp-content/plugins/wp-syntax/geshi/geshi.php on line 3324

Warning: preg_replace_callback() [function.preg-replace-callback]: Unknown modifier 'c' in /usr/local/www/sites/jigcode.com/wp-content/plugins/wp-syntax/geshi/geshi.php on line 3324

Warning: preg_replace_callback() [function.preg-replace-callback]: Unknown modifier 'c' in /usr/local/www/sites/jigcode.com/wp-content/plugins/wp-syntax/geshi/geshi.php on line 3324

Warning: preg_replace_callback() [function.preg-replace-callback]: Unknown modifier 'c' in /usr/local/www/sites/jigcode.com/wp-content/plugins/wp-syntax/geshi/geshi.php on line 3324

Warning: preg_replace_callback() [function.preg-replace-callback]: Unknown modifier 'c' in /usr/local/www/sites/jigcode.com/wp-content/plugins/wp-syntax/geshi/geshi.php on line 3324

Warning: preg_replace_callback() [function.preg-replace-callback]: Unknown modifier 'c' in /usr/local/www/sites/jigcode.com/wp-content/plugins/wp-syntax/geshi/geshi.php on line 3324

Warning: preg_replace_callback() [function.preg-replace-callback]: Unknown modifier 'c' in /usr/local/www/sites/jigcode.com/wp-content/plugins/wp-syntax/geshi/geshi.php on line 3324

This is a wrapper for the MSVC compiler (cl.exe) to generate a .i file as well as a .obj. Compiled with Bigloo.

""" \"""\""; Run cl.exe to compile
"cl"; Run cl.exe to produce preprocessed .i
"cl /P"; /P puts the file in the current directory, so we need to move it to the
; same directory the object would have been in.  Get the target directory from
; the /Fo option and the source name from the .(c|cpp).
"/Fo""cpp""c""cxx"".i"".i"
Posted on June 7, 2009 at 10:11 am by Jason Felice · Permalink · Comments Closed
In: Jigs · Tagged with: , , , ,

Python: List files older than or newer than a specific date and time

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import os, sys
from datetime import date, timedelta, datetime
from time import localtime
import re
 
files = os.listdir('c:/windows/system32/')
 
files = [ f for f in files if re.search('.dll$', f, re.I)]
 
files.sort()
 
d = datetime.now() - timedelta(days=30)
d = d.timetuple()
 
oldfiles = 0
newfiles = 0
for file in files:
    filetimesecs = os.path.getmtime('c:/windows/system32/' + file)
    filetime = localtime(filetimesecs)
 
#       print "*******************************"
#       print file
#       print filetime
#       print "*******************************"
 
if filetime < d:
    oldfiles += 1
if filetime > d:
    newfiles += 1
 
print "Old Files: %s" % oldfiles
print "New Files: %s" % newfiles
Posted on June 7, 2009 at 10:03 am by David Andrzejewski · Permalink · Comments Closed
In: Jigs · Tagged with: , , ,

Welcome!

Welcome to Jigcode.com! My name is David Andrzejewski. My colleague Jason Felice and I decided to start this site during a quick afternoon coffee break at work. Well, it wasn’t really at work – we simultaneously decided that we just had to get out of the office.

While on the way back from our coffee excursion, we began talking about throwaway code, and how our temp directories are filled with lots of random files, like foo.c, q.py, blargo.bat, and so-forth that do one shot things like “replace the letter ‘L’ at the end of even numbered lines.”  We discussed how we usually clean out our temp directories every once in a while, and always end up deleting code that might end up being useful in the future.

We started talking about committing our throwaway code into SVN, and perhaps organizing it a bit to keep it in our back pocket in case we need it again. Then Jason said it: Let’s start a website to collect it. I thought it was a fantastic idea, and here we are!

We started thinking about names for the website. Jason remembered a quote from The Pragmatic Programmer:

When woodworkers are faced with the task of producing the same thing over and over, they cheat. They build themselves a jig or template. If they get the jig right once, they can reproduce a piece of work time after time. The jig takes away complexity and reduces the chances of making mistakes, leaving the craftsman free to concentrate on quality.

We’re actually co-opting this from The Pragmatic Programmer and repurposing it just a little bit (around the edges) for this site.

They were referring to writing code that writes code, but those dusty brain cells of Jason’s responsible for remembering that context failed him during that discussion.

WordNet offers up this definition:

A device that holds a piece of machine work and guides the tools operating on it

Well, that’s much closer to what we were thinking.  Weird searches and replaces, things that update ini files, code frobbing, getting file versions, batch version  controlled file renames, dead code finding hacks and the like.

So please, enjoy the site – and feel free to send us your own jig code – we’d love to see it! And who knows. You could help some other programmer out in the process.

Posted on June 7, 2009 at 9:57 am by David Andrzejewski · Permalink · Comments Closed
In: Meta