Skip to content

Instantly share code, notes, and snippets.

function boo()
print "boo"
end
function add(x, y)
return x + y
end
@nramsbottom
nramsbottom / acc97pwd.c
Created February 8, 2017 17:58
Extract Access 97 MDB Password
//
// extracts Access 97 password from an MDB file
//
// Based on information from: https://github.com/brianb/mdbtools/blob/master/HACKING
//
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <memory.h>
@nramsbottom
nramsbottom / rng.c
Created February 1, 2017 00:47
Multiple Random Number Generators
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include "rng.h"
void
rng_restore(struct rng_s *rng) {
@nramsbottom
nramsbottom / IPlugin.cs
Created October 6, 2016 06:57
Simple Pluggable Application
namespace PluggableApplication.Common
{
using System;
public interface IPlugin
{
string Name { get; }
string Description { get; }
string Author { get; }
@nramsbottom
nramsbottom / remove-jpeg-exit.sh
Created August 7, 2016 00:48
Remove JPEG EXIF data
#!/bin/bash
# make sure that the required package is installed
if [ $(dpkg-query -W -f='${Status}' libimage-exiftool-perl 2>/dev/null | grep -c "ok installed") -eq 0 ];
then
sudo apt-get install -y libimage-exiftool-perl
fi
# remove all metadata from JPEG files in the current directory
exiftool -all= *.jpg
public static class MailMessageExtensions
{
/// <summary>
/// Attaches a file to the specified mail message.
/// </summary>
/// <param name="sourceFilename">The filename of the file to attach.</param>
/// <param name="attachmentFilename">The name of the attachment as it will appear in the email.</param>
/// <param name="contentType">The MIME type of the attachment.</param>
public static void AttachFile(this MailMessage message, string sourceFilename, string attachmentFilename, string contentType)
{
char *trim(char *s) {
size_t length = strlen(s);
while (length > 0) {
if (s[0] == ' ')
memmove(s, s + 1, --length);
else if (s[length - 1] == ' ')
s[--length] = '\0';
else
#include <stdio.h>
#include <time.h>
static char dttm[20];
const char *get_utc_date() {
time_t now;
struct tm *utcdate;
time(&now);
utcdate = gmtime(&now);
static char *keyword;
static char *args[10]; // array of pointers to the arguments (stored in command)
int parse_command(char *command, char **keyword, char *args[]) {
char *tmp;
int n;
tmp = strtok(command, " ");
if (tmp != NULL)
*keyword = tmp;
static class RandomExtensions
{
public static bool NextBoolean(this System.Random rng)
{
// 2 because Next returns values between 0 and max - 1
return rng.Next(2) > 0;
}
}