Skip to content

Instantly share code, notes, and snippets.

View johnduhart's full-sized avatar

John Du Hart johnduhart

View GitHub Profile
@johnduhart
johnduhart / gist:4773120
Created February 12, 2013 20:32
SMTP stream for a blog I'm writing
220 mx.google.com ESMTP o6sm66570567vdd.11 - gsmtp
EHLO John-VM
250-mx.google.com at your service, [129.49.7.198]
250-SIZE 35882577
250-8BITMIME
250-STARTTLS
250-ENHANCEDSTATUSCODES
250 PIPELINING
STARTTLS
220 2.0.0 Ready to start TLS
@johnduhart
johnduhart / Injector.cpp
Created January 2, 2013 14:11
Injector
// Injector.cpp : Defines the entry point for the console application.
//
#include <windows.h>
#include <stdio.h>
#include <tchar.h>
#include <TlHelp32.h>
DWORD GetProcessIdForProgram(PCHAR exeName)
{
@johnduhart
johnduhart / gist:4434830
Last active December 10, 2015 12:29
Hook that replaces all label text with dicks
#include <windows.h>
#include "../mhook/mhook.h"
// Define _DrawText
//typedef int _DrawText(IN HDC hDc, INOUT LPCTSTR )
typedef int (WINAPI* _DrawTextW)(
_In_ HDC hDC,
_Inout_ LPCWSTR lpchText,
_In_ int nCount,
@johnduhart
johnduhart / Program.cs
Created December 20, 2012 19:35
Factorial solver
using System;
namespace Johnduhart.Challenge
{
class Program
{
static void Main(string[] args)
{
int lines = int.Parse(Console.In.ReadLine());
#include "cbase.h"
#include "weapon_propper.h"
// memdbgon must be the last include file in a .cpp file!!!
#include "tier0/memdbgon.h"
#include "in_buttons.h"
#include "props.h"
#define SLOT1_MODEL "models/props_junk/watermelon01.mdl"
#define SLOT2_MODEL "models/props_lab/monitor01a.mdl"
john@kiwi:/var/www/cacti.compwhizii.net/log$ ls -lh
total 15G
-rw-r--r-- 1 www-data john 15G Nov 5 15:13 cacti.log
package me.johnduhart.cards;
import java.util.Random;
import java.util.Scanner;
/**
* Represents a matching card game
*/
public class Game {
private Card[][] cards = new Card[4][4];
PFont font;
void setup() {
size(500, 500);
font = loadFont("Arial-Black-72.vlw");
textFont(font);
}
boolean what = true;
float rot = 0;
@johnduhart
johnduhart / gist:3029541
Created July 1, 2012 20:41
Image fit code
x_pad, y_pad = 0, 0
# Basically what's happening here is I'm trying to get the number of pixels
# needed to pad the image so it can be chopped into equal 256x256 squares.
#
# To do this I first check if the pixel count is already cleanly divisible by
# 256, and then if it's not, I then try to figure out how much more height I
# need to add. I do that by first dividing the pixel count by 256 and then
# adding 1 to it to give me a clean multiple of 256 to work with. Afterwards I
# I multiply that by 256 to get the ideal height, and then subtract that number
{
"name": "InputBox",
"description": "Allow inclusion of predefined HTML forms.",
"descriptionmsg": "inputbox-desc",
"type": "parserhook",
"author": [
"Erik Moeller",
"Leonardo Pimenta",
"Rob Chruch",
"Trevor Parscal",