Skip to content

Instantly share code, notes, and snippets.

@dogmgeen
dogmgeen / README.md
Created January 28, 2018 15:13
Tutorial on improving your VM

How to ssh into your VM using PuTTY

Now that you have a virtual machine running Xubuntu 17.10, it's useful to learn how to update software and install new software packages. This tutorial will be an applied example of how to do so. We'll go over how to configure your VM to permit a connection to it through PuTTY.

@dogmgeen
dogmgeen / playlistDuration.sh
Last active October 28, 2015 16:32
Determine the duration of all audio files in the local directory
shopt -s nullglob
let playlist_duration_ms=0
for song_file in *.{mp3,ogg,m4a,flac,wav}; do
playlist_duration_ms=$(expr $playlist_duration_ms + $(mediainfo --Inform="Audio;%Duration%" "$song_file"))
done
let playlist_duration_secs=$(expr $playlist_duration_ms / 1000)
let playlist_duration_mins=$(expr $playlist_duration_ms / 60000)
let playlist_duration_remaining_secs=$(expr $playlist_duration_secs - $(expr $playlist_duration_mins \* 60))
echo $playlist_duration_mins minutes, $playlist_duration_remaining_secs seconds
shopt -u nullglob
@dogmgeen
dogmgeen / configuration.conf
Created August 11, 2015 13:46
ONE simulator configuration file for two classes of nodes: mobile, limited comm. range nodes; and stationary, interconnected nodes.
#
# Default settings for the simulation
#
## Scenario settings
Scenario.name = default_scenario
Scenario.simulateConnections = true
Scenario.updateInterval = 0.1
# 43200s == 12h
Scenario.endTime = 43200
@dogmgeen
dogmgeen / binarystate.py
Last active August 29, 2015 14:10
Simple script that will display a message when a button is pressed on the Raspberry Pi.
# Doug McGeehan (djmvfb@mst.edu)
# Bouncing-eliminating BinaryState object.
import time
class BinaryState:
"""Prevent bouncing of the signal when the button is pressed."""
def __init__(self, initial_state=0):
@dogmgeen
dogmgeen / bullionScanNMerge.sh
Last active August 29, 2015 14:10
Merge two images, corresponding to the front and back images of a coin, into one based on a common prefix filename.
# Doug McGeehan (djmvfb@mst.edu)
#
# This script expects raw scanned images to be named in the following format:
# ${prefix}_f.tiff for obverse scans, and
# ${prefix}_b.tiff for reverse scans.
# We need both of these files to perform the final merging. When you perform
# the scan, make sure to keep the ingots in approximately the same location
# on the scanner.
#
# First, you need multicrop. Download it from here:
@dogmgeen
dogmgeen / kic_filename_padder.py
Last active August 29, 2015 14:08
Rename your KIC Bookeye 4 + ScanTailor files so they adhere to Lexicographical order.
# The KIC Bookeye 4 stupidly outputs files in the following format:
#
# KIC Image.png
# KIC Image 1.png
# KIC Image 2.png
# ...
# KIC Image 9.png
# KIC Image 10.png
# KIC Image 11.png
# ...
class MobileHost(Phone):
def __init__(self, *args, **kwargs):
Phone.__init__(self, *args, **kwargs)
self.counter = 0
self.Flag = False
self.tokenMH = False
def request(self):
self.counter += 1 # NOT sure what we are doing with this
from bintrees import rbtree
single_rotator = rbtree.jsw_single
def augmented_rotator(root, direction):
new_root = single_rotator(root, direction)
new_root.size = root.size
root.size = 1 + (0 if root.left is None else root.left.size)\
+ (0 if root.right is None else root.right.size)
return new_root
import sys
import os
import csv
import collections
keys = [
"Timestamp",
"State",
"Company Name",
<?php
if (!isset($_POST["submit"]))
{
?>
<html>
<body>
<form method="post" action="<?php echo $PHP_SELF; ?>">
<table width="500px">