Skip to content

Instantly share code, notes, and snippets.

View ThomasLocke's full-sized avatar

Thomas Løcke ThomasLocke

View GitHub Profile
with Ada.Text_IO; use Ada.Text_IO;
procedure HelloWorld is
HW : constant String := "Hello, world!";
begin
Put_Line (HW);
@ThomasLocke
ThomasLocke / 0001-Added-support-for-external-log-handlers.patch
Created November 8, 2011 18:45
Added support for external log handlers to AWS
From 0834478f52d58f60d702a636df7b5db2807e9fd7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Thomas=20L=C3=B8cke?= <[email protected]>
Date: Tue, 8 Nov 2011 16:47:34 +0100
Subject: [PATCH] Added support for external log handlers.
The primary goal is to be able to let something like syslog handle the AWS log
data, but it can also be used for adding log data to a database or what else
you can come up with.
The important thing is to be able to relieve AWS from it's log writing duties.
@ThomasLocke
ThomasLocke / gist:1392293
Created November 24, 2011 21:06
C wrapper used by GNATCOLL.Traces.Syslog
/* Wrapper for syslog (needed by gnatcoll-traces-syslog.adb) */
#include <syslog.h>
void
syslog_wrapper(int priority, const char *log_message)
{
syslog(priority, "%s", log_message);
}
@ThomasLocke
ThomasLocke / gist:1392295
Created November 24, 2011 21:07
Patch for gnatcoll-traces-syslog.adb that fix a segfault
--- gnatlib/src/syslog/gnatcoll-traces-syslog.adb 2011-11-24 21:42:54.680002883 +0100
+++ gnatlib_new/src/syslog/gnatcoll-traces-syslog.adb 2011-11-24 12:10:24.080001517 +0100
@@ -80,8 +80,6 @@
-- we need to be able to combine levels and facilities in the call
-- to syslog...
- Percent_S : constant String := "%s" & ASCII.NUL;
-
type Syslog_Stream_Record is new Trace_Stream_Record with record
Buffer : Unbounded_String;
@ThomasLocke
ThomasLocke / gist:1596992
Created January 11, 2012 21:55
AWS.Cookie patch suggestion
From 4e5765f68f37b2f770804fa394117d0e62f9bc9d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Thomas=20L=C3=B8cke?= <[email protected]>
Date: Wed, 11 Jan 2012 17:08:52 +0100
Subject: [PATCH] Both of these searched the cookie strings in a very weak and
error prone manner. This has been updated to instead use
some of the available AWS tools so it's now much more
reliable.
Also did some minor tweaks to the Get functions that convert string values to
Integer and Float.
@ThomasLocke
ThomasLocke / gist:1657269
Created January 22, 2012 14:46
Patch for AWS.LDAP that fixes bug where CONSTRAINT_ERROR is raised instead of LDAP_ERROR.
From a3a1d6c6c6b00c4386710f59a2939b84a40455f0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Thomas=20L=C3=B8cke?= <[email protected]>
Date: Sun, 22 Jan 2012 15:34:29 +0100
Subject: [PATCH] Fix constraint error when bind fails due to bad server.
Instead of getting a useless CONSTRAINT_ERROR exception, we now get a proper
LDAP_ERROR exception with the message "Can't contact LDAP server".
---
src/ldap/aws-ldap-client.adb | 21 ++++++++++++++++++---
src/ldap/aws-ldap-thin.ads | 4 +++-
@ThomasLocke
ThomasLocke / gist:1669552
Created January 24, 2012 10:39
LDAP server JSON
{
"servers": [
{
"host": "alpha",
"password": "secret",
"base_dn": "dc=example,dc=com",
"user_dn": "cn=Directory Manager",
"active": "true"
},
{
@ThomasLocke
ThomasLocke / gist:1747012
Created February 5, 2012 18:21
xmonad.hs
import XMonad
import XMonad.Actions.CycleWS -- cycle thru WS', toggle last WS
import XMonad.Hooks.DynamicLog -- statusbar
import XMonad.Hooks.ManageDocks -- dock/tray mgmt
import XMonad.Util.EZConfig -- append key/mouse bindings
import XMonad.Util.Run(spawnPipe) -- spawnPipe and hPutStrLn
import System.IO
myLogHook dest = dynamicLogWithPP defaultPP { ppOutput = hPutStrLn dest
,ppVisible = wrap "(" ")"
@ThomasLocke
ThomasLocke / gist:1752268
Created February 6, 2012 14:02
Patch for AWS.Utils.IS_Number - adding support for negative integers.
From f566fc2ed1a8073d3384b197322d6ed49372e584 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Thomas=20L=C3=B8cke?= <[email protected]>
Date: Mon, 6 Feb 2012 14:45:08 +0100
Subject: [PATCH] Added support for negative numbers to AWS.Utils.Is_Number
---
src/core/aws-utils.adb | 11 ++++++++++-
src/core/aws-utils.ads | 7 +++++--
2 files changed, 15 insertions(+), 3 deletions(-)
@ThomasLocke
ThomasLocke / gist:2421241
Created April 19, 2012 14:18
SQL_Select hell...
Query := SQL_Select
(Fields =>
Organization.Org_Id &
Organization.Org_Name &
Organization.Sip_Uri &
Contactentity.Ce_Id &
Contactentity.Ce_Name &
Contactentity.Isperson &
Tag.Tag_Id &
Tag.Tag_Name,