Skip to content

Instantly share code, notes, and snippets.

View mepcotterell's full-sized avatar
💭
I may be slow to respond.

Michael Cotterell mepcotterell

💭
I may be slow to respond.
View GitHub Profile
@mepcotterell
mepcotterell / examples.md
Last active December 12, 2015 02:59
Some C++ utility functions...

Assume the following:

include "range.h"

using namespace mepcotterell;

Then you can do cool stuff like this:

@mepcotterell
mepcotterell / .gitignore
Last active December 13, 2015 17:18
Fun with Polymorphism
*.class
*~
\#*\#
semantic.cache
@mepcotterell
mepcotterell / README.md
Last active July 14, 2020 17:28
Fun with tcpdump and hexdump...

Fun with tcpdump and hexdump

Here is some information that I've found/discovered from playing around with packets. The following is presented in an adhoc tutorial style. Hopepully you find it interesting.

tcpdump

Something that I found useful was the ability to actually capture the raw UDP packet using tcpdump utility. In the following example, we'll capture a DNS query packet and save it to a file.

Open up two terminal windows. In one window, type the following:

#!/usr/bin/env python3
'''
subnet -- phatty tools for dealing with subnets
@author: Michael E. Cotterell <[email protected]>
'''
import struct
import sys
@mepcotterell
mepcotterell / Form.java
Last active December 14, 2015 07:28
Swing examples from class.
import java.awt.Dimension;
import java.awt.GridLayout;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;
public class Form {
@mepcotterell
mepcotterell / Driver.java
Last active December 14, 2015 14:38
Java Swing Starter Kit (sbt)
import java.awt.Dimension;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.UIManager;
public class Driver {
public static void createAndShowGUI() {
@mepcotterell
mepcotterell / Multinomial.scala
Last active December 15, 2015 01:19
Linear-Time Multinomial Coeffiecients
object Combinatorics {
/** Computes the multinomial coefficient (n; k_1, .., k_m)
* where n = the sum of k_1, .., k_m.
*
* This is a variadic convenience function that allows
* someone to invoke <code>multi</code> without using an
* array. Note, however, that the variadic parameter is
* transformed into an array when this version of
* <code>multi</code> is invoked.
/* Copyright (c) 2013 Michael E. Cotterell
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
@mepcotterell
mepcotterell / LICENSE
Last active August 19, 2023 16:44
Simple Python Plugin Manager
The MIT License (MIT)
Copyright (c) 2013 Michael E. Cotterell
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
@mepcotterell
mepcotterell / NikeGitHub.md
Last active January 2, 2016 03:39
Nike and GitHub Handout

Everyone in the class needs to complete the following steps, individually. You can skip sections that you have already completed. You need to have a GitHub and Nike account in order to complete these steps.

Gather Information

Throughout the tutorial, I will make use of variables. Please gather the following information:

  • ${actualName}: Your full name, capitalized correctly.
  • ${gitHubEmail}: The email address you used to register your GitHub account.
  • ${gitHubPassword}: The password for your GitHub account.