Skip to content

Instantly share code, notes, and snippets.

#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);
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
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)
{
@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
@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 / 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 / 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>
function boo()
print "boo"
end
function add(x, y)
return x + y
end
@nramsbottom
nramsbottom / ApplicationContext.cs
Created May 10, 2017 00:02
EFCoreApp1 - Simple Entity Framework Core App
using Microsoft.EntityFrameworkCore;
namespace EFCoreApp1
{
class ApplicationContext : DbContext
{
public ApplicationContext() { }
public ApplicationContext(DbContextOptions<ApplicationContext> options) : base(options)
{
}
@nramsbottom
nramsbottom / bubble_sort.c
Created May 28, 2017 12:07
Simple Bubble Sort
#include <stdio.h>
void show(int arr[], int count) {
for (int n = 0; n < count - 1; n++)
printf("%d ", arr[n]);
printf("\n");
}
void bubble_sort(int arr[], int count) {