Skip to content

Instantly share code, notes, and snippets.

@leomelzer
leomelzer / howto.md
Created October 24, 2012 22:29
Installing ImageMagick & Ghostscript on Ubuntu
  1. You have Ghostscript installed, right? Otherwise sudo apt-get install ghostscript
  2. This is important and installs the headers (iapi.h etc) which are required but don't come with the default Ghostscript package: sudo apt-get install libgs-dev
  3. I also needed sudo apt-get install gs-esp
  4. For me the pre compiled version of ImageMagick never accepted Ghostscript, so let's remove it: sudo apt-get --purge remove imagemagick
  5. Get the source of ImageMagick, untar it, cd ImageMagick-xx
  6. ./configure --with-gslib=yes [and what else you need]
  7. Confirm in the output near the bottom gslib yes yes and not gslib yes no
  8. make
  9. make install
  10. Run convert -list configure | grep DELEGATES => DELEGATES bzlib djvu freetype gs jpeg jng jp2 lcms png tiff x11 xml zlib
@mbostock
mbostock / .block
Last active July 15, 2026 02:09
Calendar View
license: gpl-3.0
height: 2910
border: no
redirect: https://observablehq.com/@d3/d3-calendar-view
@xfenix
xfenix / multiselect.py
Created December 3, 2012 09:10
Usage of FilteredSelectMultiple in custom models
from django.contrib.admin.widgets import FilteredSelectMultiple
from django import forms
def widget(model_reference, field, title, titlew):
class WidgetForm(forms.ModelForm):
vars()[field] = forms.ModelMultipleChoiceField(queryset=model_reference.objects.all(),
label=(title),
widget=FilteredSelectMultiple(
(titlew),
False,
@cbrake
cbrake / 99-usb-serial.rules
Created December 19, 2012 14:47
USB Serial udev rules
# /etc/udev/rules.d/99-usb-serial.rules
# udevadm info --attribute-walk -n /dev/ttyUSB0 |grep serial (can be used to get serial number)
# udevadm control --reload-rules (reload rules)
# udevadm trigger (re-add all devices)
# see https://wiki.archlinux.org/index.php/Bus_pirate
# for some reason, ATTRS{bInterfaceNumber}=="00" is not working, hence the use of ENV{}
# single USB/serial adapters
SUBSYSTEM=="tty", ATTRS{serial}=="A900TUKZ", SYMLINK+="ttyUSB_bub_1"
SUBSYSTEM=="tty", ATTRS{serial}=="A700fdWb", SYMLINK+="ttyUSB_bub_2"
@Natim
Natim / ini2json.py
Created January 11, 2013 10:21
Convert an ini configuration file into a json file
# -*- coding: utf-8 -*-
import json
import sys
from ConfigParser import (ConfigParser, MissingSectionHeaderError,
ParsingError, DEFAULTSECT)
class StrictConfigParser(ConfigParser):
def _read(self, fp, fpname):
@joshdholtz
joshdholtz / SomeFragment.java
Last active July 2, 2026 18:27
Android Google Maps V2 - MapView in XML
public class SomeFragment extends Fragment {
MapView mapView;
GoogleMap map;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.some_layout, container, false);
@adam-singer
adam-singer / mapreduce.dart
Created January 22, 2013 02:25
Map reduce example in dart
String sortedKey(List couple) {
couple.sort();
return Strings.concatAll(couple);
}
List mapper(Map m) {
var res = [];
for (var person in m.keys) {
var friends = m[person];
@kzim44
kzim44 / editExistingPdf.py
Created February 24, 2013 07:29
Edit an existing PDF using Python
from pyPdf import PdfFileWriter, PdfFileReader
import StringIO
from reportlab.pdfgen import canvas
from reportlab.lib.pagesizes import letter
packet = StringIO.StringIO()
# create a new PDF with Reportlab
can = canvas.Canvas(packet, pagesize=letter)
can.drawString(100,100, "Hello world")
can.save()
@rowlandwatkins
rowlandwatkins / WiX service installation
Created March 14, 2013 13:39
WiX Service Installation
http://plainoldstan.blogspot.hk/2010/11/wix-installing-and-uninstalling-windows.html:
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="9c78f041-c29e-4d80-8d23-e4839e74038c" Name="StansApp"
Language="1033" Version="1.0.0.0"
Manufacturer="Standa" UpgradeCode="b1adfc21-927f-470a-ac87-a5019c84a253">
<Package InstallerVersion="200" Compressed="yes" />
<Media Id="1" Cabinet="media1.cab" EmbedCab="yes" />
<Directory Id="TARGETDIR" Name="SourceDir">
@stucka
stucka / gist:5342652
Last active October 16, 2018 09:05
Tabula installation instructions for Ubuntu 12.04. Tabula turns PDFs into CSVs! http://source.mozillaopennews.org/en-US/articles/introducing-tabula/
Yeah, this all got outmoded when serious dependency problems with Tabula were removed.
No need to use this. Get Tabula directly. http://tabula.nerdpower.org/