Skip to content

Instantly share code, notes, and snippets.

@ArtemGr
ArtemGr / SCGI.java
Last active March 28, 2020 23:54
Java SCGI connector
/*
Copyright (c) 2008 ArtemGr
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
@ArtemGr
ArtemGr / gist:45741
Created January 11, 2009 18:08
Moving to FreeBSD 7.1 using Pover Recovery at server4you.de
We couldn’t find that file to show.
@ArtemGr
ArtemGr / gist:51009
Created January 23, 2009 12:55
Enable optional transparency in PlotKit
[artemgr@pcbsd /tmp/plotkit-patches]$ git diff
diff --git a/PlotKit/SweetCanvas.js b/PlotKit/SweetCanvas.js
index dcfdfc5..39cbf2c 100644
--- a/PlotKit/SweetCanvas.js
+++ b/PlotKit/SweetCanvas.js
@@ -195,6 +195,10 @@ PlotKit.SweetCanvasRenderer.prototype._renderLineChart = function() {
// faux shadow for firefox
if (this.options.shouldFill) {
+ // Transparent fill.
@ArtemGr
ArtemGr / openid_store.py
Created March 5, 2009 09:57
memcache openid store
"""Store implementation for the openidenabled.com python library, using the GAE's memcache."""
from openid.store.interface import OpenIDStore
from openid.store import nonce
import string, logging
import google.appengine.api.memcache
memcache = google.appengine.api.memcache.Client()
class MemcacheStore(OpenIDStore):
"""Implements http://openidenabled.com/files/python-openid/docs/2.2.1/openid.store.interface.OpenIDStore-class.html"""
@ArtemGr
ArtemGr / comment.touchpad.in.xorg.conf.hs
Created March 11, 2009 21:35
Automatically comment out the touchpad in the xorg.conf if there is an external mouse attached.
#!/usr/local/bin/runhaskell
-- Compile with: ghc --make -O2 -optl-s -odir /tmp -hidir /tmp mouse.hs
import Data.List
import Debug.Trace
import Control.Monad
import System.Directory; import System.Environment; import System.IO
{- If there is a USB mouse present in the system, then comment out the touchpad
mouse in "xorg.conf", otherwise uncomment it.
Note: moused should be disabled (in rc.conf and devd.conf) to free the
@ArtemGr
ArtemGr / NotEmptyQuery.scala
Created March 12, 2009 15:14
Lucene matching non-empty fields.
import org.apache.lucene.search._, org.apache.lucene.document._, org.apache.lucene.index._
class NotEmptyQuery (emptyTerm: Term) extends MultiTermQuery {
override def toString (field: String) = "NotEmptyQuery(" + (if ((field ne null) && field.length != 0) field else emptyTerm.field) + ")"
override def getEnum (reader: IndexReader) = new FilteredTermEnum {
setEnum (reader.terms (emptyTerm)) // Position at the start of the field terms.
var theEnd = false
override def termCompare (term: Term): Boolean =
if (term.field == emptyTerm.field && term.text != emptyTerm.text) true else {theEnd = true; false}
override def difference (): Float = 1
@ArtemGr
ArtemGr / Program.fs
Created March 24, 2009 14:14
Simple ".NET compact framework" application for Windows Mobile
#light
open System
open System.Drawing
open System.Windows.Forms
let main =
let form = new Form (Text = "Current time", Visible = true)
let addButton text x y fnc =
let but = new Button (Text = text) in but.Location <- new Point (x, y); but.Click.Add (fnc); form.Controls.Add (but); but
let ofs = 2
@ArtemGr
ArtemGr / clean.javap
Created April 9, 2009 19:14
NUCENHANCER-34
Compiled from "main.scala"
public class fastcms.scalaAPI.Persistent extends java.lang.Object implements scala.ScalaObject{
private java.lang.String value;
private java.lang.String name;
public fastcms.scalaAPI.Persistent();
Code:
0: aload_0
1: aconst_null
@ArtemGr
ArtemGr / NUCENHANCER-34.patch
Created April 13, 2009 13:38
NUCENHANCER-34 patch
Index: src/java/org/datanucleus/enhancer/asm/JdoMethodAdapter.java
===================================================================
--- src/java/org/datanucleus/enhancer/asm/JdoMethodAdapter.java (revision 5997)
+++ src/java/org/datanucleus/enhancer/asm/JdoMethodAdapter.java (working copy)
@@ -80,20 +80,28 @@
if (enhancer.isPersistenceCapable(ownerName))
{
AbstractClassMetaData cmd = null;
+ boolean fieldInThisClass;
if (enhancer.getClassMetaData().getFullClassName().equals(ownerName))
@ArtemGr
ArtemGr / Derby stack trace.
Created April 14, 2009 14:25
Derby getIndexInfo SQLException
java.sql.SQLException: Column 'PARAM1' already exists.
at org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(Unknown Source)
at org.apache.derby.impl.jdbc.Util.generateCsSQLException(Unknown Source)
at org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(Unknown Source)
at org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(Unknown Source)
at org.apache.derby.impl.jdbc.EmbedConnection.handleException(Unknown Source)
at org.apache.derby.impl.jdbc.ConnectionChild.handleException(Unknown Source)
at org.apache.derby.impl.jdbc.EmbedPreparedStatement.<init>(Unknown Source)
at org.apache.derby.impl.jdbc.EmbedPreparedStatement20.<init>(Unknown Source)
at org.apache.derby.impl.jdbc.EmbedPreparedStatement30.<init>(Unknown Source)