Skip to content

Instantly share code, notes, and snippets.

@Keith-S-Thompson
Keith-S-Thompson / foo.txt
Created December 15, 2011 21:52
Just a gist
This is foo.txt.
I'm just trying out this "gist" thing.
Hey, and I can edit it!
@Keith-S-Thompson
Keith-S-Thompson / c.c
Created February 7, 2012 01:48
offsetof() example
/*
* Reference: http://stackoverflow.com/questions/9169453/gcc-4-4-3-offsetof-constant-expression-bug-how-should-i-work-around-this
* Should compile and execute without error or warning with:
* gcc c.c -pedantic -std=c89 -o c && ./c
* or
* gcc c.c -pedantic -std=c99 -o c && ./c
*/
#include <stddef.h>
#include <stdlib.h>
@Keith-S-Thompson
Keith-S-Thompson / hash_slice.pl
Created February 22, 2012 21:01
Hash slice problem
#!/usr/bin/perl
use strict;
use warnings;
foreach my $var (qw(REQUEST_METHOD PATH_INFO CONTENT_LENGTH CONTENT_TYPE)) {
$ENV{$var} = $var;
}
# my ($req_method,$path_info,$content_length,$content_type)
@Keith-S-Thompson
Keith-S-Thompson / README.md
Created February 27, 2012 22:28
san.rr.com e-mail security issue

I recently set up my e-mail account (username.deleted@san.rr.com) using Mozilla Thunderbird on Windows 7.

Thunderbird initialized the configuration settings automatically, then showed a warning about the lack of encryption on both pop-server.san.rr.com and smtp-server.san.rr.com.

It won't let me copy-and-paste the text, so here's a screenshot (see below).

Is there some way to enable encryption for incoming and outgoing e-mail on my san.rr.com account?

Also, would you consider supporting the IMAP protocol in addition to the POP protocol?

@Keith-S-Thompson
Keith-S-Thompson / README.md
Created February 29, 2012 04:42
timewarnercable.com web page display
@Keith-S-Thompson
Keith-S-Thompson / Makefile
Created March 3, 2012 21:31
ncurses test in response to a question on stackoverflow.com
CPP = g++
CPPFLAGS = -c -Wall -g
LINK = g++
LDFLAGS_LINUX = -lpthread -lncurses
LDFLAGS = $(LDFLAGS_LINUX)
.SUFFIXES:
.SUFFIXES: .o .cpp
.cpp.o:
@Keith-S-Thompson
Keith-S-Thompson / README.md
Created March 10, 2012 00:14
Ada multiple elaboration of non-generic package

This small test program is linked from a comment on this question on stackoverflow.com.

The program should compile and link without error, but dies with a segmentation fault if you try to run it.

Compile with

gcc -c dlsym_test.c

If you want to try running it (it will crash):

@Keith-S-Thompson
Keith-S-Thompson / demo.c
Created April 7, 2012 03:38
Invalid pointer demo
int main(void) {
int *ptr;
{
int obj;
ptr = &obj;
/* ptr is valid */
}
/* ptr is now invalid */
return 0;
}
@Keith-S-Thompson
Keith-S-Thompson / atof_demo.c
Created July 11, 2012 03:10
Small atof demo
#include <stdio.h>
#include <stdlib.h>
int main(void)
{
const char *arg = "10.0";
double d = atof(arg);
printf("d = %f\n", d);
return 0;
}