Skip to content

Instantly share code, notes, and snippets.

@blackxored
blackxored / gist:705364
Created November 18, 2010 18:11
Import CSV users into redmine
# csv_import_users.rake
# Bulk user provisioning for Redmine using CSV file
# Copyright (C) 2010 - Adrian Perez <adrianperez.deb@gmail.com>
# Licensed under GPL 3.
require 'csv'
namespace :redmine do
task :csv_import_users => :environment do
@first_row = true
@zacharydenton
zacharydenton / models.py
Created February 18, 2011 02:27
Geodesic Distance Between Points in GeoDjango
from itertools import tee, izip
from django.contrib.gis.db import models
from django.contrib.gis.measure import Distance
from geopy.distance import distance as geopy_distance
def pairwise(iterable):
"s -> (s0,s1), (s1,s2), (s2, s3), ..."
a, b = tee(iterable)
@natritmeyer
natritmeyer / Program.cs
Created May 11, 2011 18:10
A tiny c# app that operates the Open File dialog using White. Useful if you're testing a WPF app with bewildr (http://www.bewildr.info) but the app you're testing uses the old Win32 dialog boxes. The compiled exe takes one arg; the value you want typed in
/*
Create a console app, add references to the various white libraries and use the following as a template for operating the Open Dialog window
Get the white binaries from here: http://white.codeplex.com/
*/
using System.Collections.Generic;
using System.Linq;
using System.Windows.Automation;
using White.Core;
using White.Core.UIItems;
@rcravens
rcravens / msbuilder.py
Created July 19, 2011 19:06
Python Script to Automate MSBuild Tasks
# Generic build script that builds, tests, and creates nuget packages.
#
# INSTRUCTIONS:
# Update the following project paths:
# proj Path to the project file (.csproj)
# test Path to the test project (.csproj)
# nuspec Path to the package definition for NuGet.
#
# delete any of the lines if not applicable
#
@tomster
tomster / .gitconfig
Created September 25, 2011 11:48
An example git configuration including convenience aliases, some saner default behavior, a neat shell prompt and tab completion that can display the name of the tracking remote
# ~/.gitconfig
[branch]
autosetupmerge = true
[push]
default = current
[core]
excludesfile = .gitignore
@alexras
alexras / ssh-agent-snippets.sh
Created October 17, 2011 00:14
Bash snippets to automatically start and stop an ssh-agent process on login and logout
#!/bin/bash
## in .bash_profile
SSHAGENT=`which ssh-agent`
SSHAGENTARGS="-s"
if [ -z "$SSH_AUTH_SOCK" -a -x "$SSHAGENT" ]; then
eval `$SSHAGENT $SSHAGENTARGS`
trap "kill $SSH_AGENT_PID" 0
fi
@maraujop
maraujop / date.html
Last active October 9, 2021 19:56
Datepicker template for django-crispy-forms
{% load crispy_forms_field %}
<div id="div_{{ field.auto_id }}" class="control-group{% if form_show_errors and field.errors %} error{% endif %} {% if field.field.widget.attrs.class %} {{ field.field.widget.attrs.class }}{% endif %}">
{% if field.label %}
<label for="{{ field.id_for_label }}" class="control-label {% if field.field.required %}requiredField{% endif %}">
{{ field.label|safe }}{% if field.field.required %}<span class="asteriskField">*</span>{% endif %}
</label>
{% endif %}
@subelsky
subelsky / casperjs_example.js
Created August 8, 2012 18:51
Webscraping with CasperJS, PhantomJS, jQuery, and XPath
var system = require('system');
if (system.args.length < 5) {
console.info("You need to pass in account name, username, password, and path to casperJS as arguments to this code.");
phantom.exit();
}
var account = system.args[1];
var username = system.args[2];
var password = system.args[3];
@ndarville
ndarville / secret-key-gen.py
Created August 24, 2012 17:01
Generating a properly secure SECRET_KEY in Django
"""
Two things are wrong with Django's default `SECRET_KEY` system:
1. It is not random but pseudo-random
2. It saves and displays the SECRET_KEY in `settings.py`
This snippet
1. uses `SystemRandom()` instead to generate a random key
2. saves a local `secret.txt`
@erickr
erickr / Redmine_Qlikview_0.01
Created February 5, 2013 21:08
Loading a redmine database into qlikview. First draft, let me know if you have improvements. :)
///$tab Redmine
SET ThousandSep=' ';
SET DecimalSep=',';
SET MoneyThousandSep='.';
SET MoneyDecimalSep=',';
SET MoneyFormat='#.##0,00 kr;-#.##0,00 kr';
SET TimeFormat='hh:mm:ss';
SET DateFormat='YYYY-MM-DD';
SET TimestampFormat='YYYY-MM-DD hh:mm:ss[.fff]';
SET MonthNames='jan;feb;mar;apr;maj;jun;jul;aug;sep;okt;nov;dec';