Skip to content

Instantly share code, notes, and snippets.

Node *reverse(Node *p)
{
Node *oldnext, *newnext;
while(p)
{
oldnext = p->next;
p->next = newnext;
newnext = p;
p = oldnext;
}
SELECT s.title AS title,
concat(u.forename, ' ', u.surname) AS name,
from_unixtime(ss.start_time, '%d/%m/%Y') AS sessiondate,
if( v.id IS NULL , ss.venue, v.title ) AS venue,
if(b.status NOT IN ('attended'),'No', 'Yes') AS attended
FROM `sessions` s
JOIN scheduled_sessions ss ON ss.session_id=s.id
JOIN session_bookings b ON b.session_id=ss.id
JOIN users u ON u.id=b.delegate_id
LEFT JOIN venues v ON v.id=ss.venue_id
@Two9A
Two9A / Makefile
Created February 12, 2011 12:39
Anagram hashtable...
CC = g++ -c
LD = g++
anagram: anagram.o hash.o qsort.o strlist.o
$(LD) -o $@ $^
%.o: %.cpp %.c %.h
$(CC) -o $@ $<
clean:
package com.imrannazar.anpr;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.content.pm.ActivityInfo;
import android.graphics.PixelFormat;
import android.hardware.Camera;
import android.hardware.Camera.Parameters;
import android.os.Bundle;
@Two9A
Two9A / Tomcat log
Created June 16, 2011 08:05
CAS startup error
INFO: Undeploying context [/cas]
Jun 16, 2011 8:57:31 AM org.apache.catalina.startup.HostConfig deployWAR
INFO: Deploying web application archive cas.war
Jun 16, 2011 8:57:32 AM org.apache.catalina.startup.TldConfig tldScanJar
SEVERE: Exception processing TLD META-INF/c-1_0-rt.tld in JAR at resource path /opt/jasperserver-pro-3.5.1/apache-tomcat/webapps/cas/WEB-INF/lib/
standard-1.1.2.jar in context /cas
java.lang.NullPointerException
at org.apache.xerces.impl.dtd.models.DFAContentModel.buildDFA(DFAContentModel.java:538)
at org.apache.xerces.impl.dtd.models.DFAContentModel.<init>(DFAContentModel.java:253)
at org.apache.xerces.impl.dtd.DTDGrammar.createChildModel(DTDGrammar.java:2279)
@Two9A
Two9A / src-global.h
Created June 25, 2011 11:46
Qt compile issues...
QT += network xml
QT -= gui
TARGET = QtCoreLib
TEMPLATE = lib
DEFINES += QTCORELIB_LIBRARY
INCLUDEPATH += src/logger \
src
@Two9A
Two9A / starfield.html
Created April 19, 2015 16:45
The simplest star field you'll ever find
<title>Starfield</title>
<script>
addEventListener('load', function() {
var stars = [];
var ctx = field.getContext('2d');
var gen = function(z) {
return {
x: 0 | (Math.random() * 800 - 400),
y: 0 | (Math.random() * 600 - 300),
z: z || (0 | Math.random() * 15)
@Two9A
Two9A / decronym.php
Last active April 9, 2024 23:25
Decronym: A simple Reddit bot
<?php
/**
* Dirty, dirty Reddit bot: Decronym
*/
class Reddit {
const USERNAME = 'Decronym';
const PASSWORD = '***';
const CLIENTID = '***';
const SECRET = '***';
<?php
require_once 'html5/html5.inc.php';
class dAmn_IRC {
const DEBUG = 1;
const IRC_HOST = 'localhost';
const IRC_PORT = 8193;
const DAMN_HOST = 'chat.deviantart.com';
const DAMN_PORT = 3900;
@Two9A
Two9A / boot.asm
Created October 31, 2015 18:27
ph34rOS! I never got very far with this...
;--------------------------------------------------------------------------
; ph34rOS - Testing boot sector version 0.0.1h
; Changes from 0.0.1g - Removed Alias descriptor (No use for it)
; - Moved Stage2 load point to 7E00
; - Assuming 386+ (It's a reasonable assumption)
; - Optimised debugging messages (I was bored)
; - Removed GetKey (No need, no need at all)
; - Moved procs into main code (no CALLs!)
;--------------------------------------------------------------------------