Skip to content

Instantly share code, notes, and snippets.

@GreenRecycleBin
GreenRecycleBin / default.pa
Created July 15, 2016 01:11
PulseAudio configuration to automatically switch to a new connected output
### Put this in ~/.config/pulse/default.pa
### Include the system-wide configurations
.include /etc/pulse/default.pa
### Automatically switch to newly-connected devices
load-module module-switch-on-connect
#ifndef CVGABOR_H
#define CVGABOR_H
#include "/usr/local/Cellar/opencv/2.3.1a/include/opencv2/opencv.hpp"
class CvGabor
{
public:
~CvGabor();
@GreenRecycleBin
GreenRecycleBin / cvgabor.h
Created October 11, 2011 06:16
Ugly cvgabor
/***************************************************************************
* Copyright (C) 2006 by Mian Zhou *
* M.Zhou@reading.ac.uk *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
uint16_t udp_checksum(struct udphdr *p_udp_header, size_t len, uint32_t src_addr, uint32_t dest_addr)
{
const uint16_t *buf = (const uint16_t*)p_udp_header;
uint16_t *ip_src = (void*)&src_addr, *ip_dst = (void*)&dest_addr;
uint32_t sum;
size_t length = len;
// Calculate the sum
sum = 0;
while (len > 1)
uint16_t ip_checksum(struct ip *p_ip_header, size_t len)
{
register int sum = 0;
uint16_t *ptr = (unsigned short*)p_ip_header;
while (len > 1){
sum += *ptr++;
len -= 2;
}
@GreenRecycleBin
GreenRecycleBin / v1.0
Created August 12, 2011 17:43
Firefox (debug version) compilation guide
Guide to prepare your development environment for CP3108B - Mozilla Project
1. IRC setup
+ IRC is our main communication channel. It's very much similar to chatrooms in other IMs. The easiest way to start is using Mibbit (chat.mibbit.com) - an IRC web client.
- Click on "Server"
- Type in "irc.mozilla.org:+6697"
- Pick a nickname
- Type in "#nus" in "Channel" field
- Connect
+ You can come back later and create an account to save your settings. There are also other native IRC clients. For Windows user, try Pidgin. For Mac user, Adium is your friend.