Skip to content

Instantly share code, notes, and snippets.

@Keith-S-Thompson
Keith-S-Thompson / trivial.c
Created April 30, 2013 20:39
Trivial FILE example
#include <stdio.h>
int main(void) {
FILE *f;
}
@Keith-S-Thompson
Keith-S-Thompson / clc.txt
Created March 26, 2013 19:15
Google Groups quoting ruins comp.lang.c article
From: Myth__Buster <raghavanil4m@gmail.com>
Subject: Re: Macro for setting MSB - Intended to work on both Little and Big-endian machines
Newsgroups: comp.lang.c
Date: Tue, 26 Mar 2013 11:07:21 -0700 (PDT)
On Tuesday, March 26, 2013 11:36:34 AM UTC-4, Keith Thompson wrote:
> Myth__Buster <raghavanil4m@gmail.com> writes:
>
> > *was at the LS-bit of LS-byte like on little-endian machine . . .
>
@Keith-S-Thompson
Keith-S-Thompson / urandom_test.c
Created February 4, 2013 02:38
Generate random numbers from /dev/urandom
#include <stdio.h>
#include <stdlib.h>
#include <limits.h>
#define MAX 36
#define URANDOM_DEVICE "/dev/urandom"
static FILE *urandom;
/*
#include <stdio.h>
int main(void) {
char c[] = "abcd";
c[0] = 'E';
c[1] = 'F';
c[2] = 'G';
c[3] = 'H';
puts(c);
return 0;
}
@Keith-S-Thompson
Keith-S-Thompson / foo.adb
Created December 13, 2012 19:00
Demo for http://stackoverflow.com/q/13851524/827263 "How to assign all elements but one in ada?"
with Ada.Text_IO; use Ada.Text_IO;
with Ada.Integer_Text_IO; use Ada.Integer_Text_IO;
procedure Foo is
Element_To_Ignore : Integer := 3;
type Array_Of_Integer is array(Positive Range <>) of Integer;
A : Array_Of_Integer := (5,3,2,6);
B : Array_Of_Integer
:= A(A'First .. Element_To_Ignore-1) &
A(Element_To_Ignore+1 .. A'Last);
@Keith-S-Thompson
Keith-S-Thompson / README.md
Created December 3, 2012 20:17
OpenSSL SHA1 demo

In response to this question:

This works correctly for me on Ubuntu, and produces the same output each time I run it.

Compile with:

gcc c.c -lssl -lcrypto -o c

Run with:

@Keith-S-Thompson
Keith-S-Thompson / .gitignore
Created November 8, 2012 22:29
gnatmake on Ubuntu
hello
hello.ali
hello.o