Skip to content

Instantly share code, notes, and snippets.

View JeremyMorgan's full-sized avatar

Jeremy Morgan JeremyMorgan

View GitHub Profile
@JeremyMorgan
JeremyMorgan / config.xml
Created July 10, 2013 20:49
Config file setting for external MSSQL server
<connectionStrings>
<add name="DefaultConnection" connectionString="Data Source=[SERVER];Initial Catalog=[DATABASE];Persist Security Info=True;User ID=[USERID];Password=[PASSWORD]" providerName="System.Data.SqlClient" />
</connectionStrings>
@JeremyMorgan
JeremyMorgan / threadtest.cs
Last active December 22, 2015 09:38
Parallel Task demonstration - A demonstration of multithreading with the .Net Parallel Task Library
using System;
using System.IO;
using System.Diagnostics;
using System.Threading;
using System.Threading.Tasks;
class stringGen
{
private readonly Random _rng = new Random();
private const string _chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
@JeremyMorgan
JeremyMorgan / quotedexport
Created October 9, 2013 16:42
Quoted Comma Export - Export all fields quoted in MS Excel. Not Written by Me
Sub QuoteCommaExport()
' Dimension all variables.
Dim DestFile As String
Dim FileNum As Integer
Dim ColumnCount As Integer
Dim RowCount As Integer
' Prompt user for destination file name.
DestFile = InputBox("Enter the destination filename" _
& Chr(10) & "(with complete path):", "Quote-Comma Exporter")
@JeremyMorgan
JeremyMorgan / installmaria.sh
Created October 16, 2013 16:18
Install MariaDB on Ubuntu 13.04
sudo apt-get install software-properties-common
sudo apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 0xcbcb082a1bb943db
sudo add-apt-repository 'deb http://ftp.osuosl.org/pub/mariadb/repo/5.5/ubuntu raring main'
sudo apt-get update
sudo apt-get install mariadb-server
sudo /usr/bin/mysql_secure_installation
@JeremyMorgan
JeremyMorgan / installmagento.sh
Last active December 25, 2015 19:49
Single Script to install Magento from a base Ubuntu 13.04 install. Works on Azure VM. Does require minimal interaction.
#!/bin/sh
# These are for creation of the database
DBNAME="yourdbname"
DBUSER="yourdbuser"
DBPASS="yourdbpassword"
# Setup stuff for MariaDB
sudo apt-get install software-properties-common
sudo apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 0xcbcb082a1bb943db
@JeremyMorgan
JeremyMorgan / registrar.php
Created December 20, 2013 21:03
Registrar
$conn = fsockopen ('whois.verisign-grs.com', 43, $errno, $errstr, 1);
fputs($conn, $domain."\r\n");
while(!feof($conn)){
$output .= fgets($conn,128);
$registrar = reset(explode("\n",end(explode('Registrar:',$output))));
}
@JeremyMorgan
JeremyMorgan / AuthTest.cs
Created January 2, 2014 22:20
Command line tool to test Active Directory authentication
using System;
using System.DirectoryServices;
class Auth
{
public static void Main(){
string path= "LDAP://DC=domain,DC=local";
string strAccountId = "[username]";
string strPassword = "[password]";
@JeremyMorgan
JeremyMorgan / ThreadingDemo.cs
Created February 3, 2014 22:33
Threading Demo
using System;
using System.IO;
using System.Diagnostics;
using System.Threading;
using System.Threading.Tasks;
class stringGen
{
private readonly Random _rng = new Random();
private const string _chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
@JeremyMorgan
JeremyMorgan / openmp_mmult.c
Created March 11, 2014 16:56
performs square matrix multiplication using OpenMP. The program generates random matrices of the dimension specified by the user and performs multiplication using a simple three-loop algorithm.
/****************************************************************************************************
openmp_mmult.c performs square matrix multiplication using OpenMP. The program generates random matrices of the dimension specified by the user and performs multiplication using a simple three-loop algorithm. Parallelism is achieved by dividing the first matrix into a group of rows for each thread for multiplication. Each thread then multiplies their group of rows with the entire second matrix, calculating a group of rows of the resultant matrix. Since the threads calculate different portions of the matrix, there was not any need to use locks or other mechanisms to protect shared memory.
The program takes two arguments:
(1) The first is the number of threads to be used. If no arguments are provided, the program assumes 4 threads.
(2) The second is the dimension of the matrices to be multiplied. If only the first argument is provided, the program uses 100x100 matrices.
The program prints the time required f
@JeremyMorgan
JeremyMorgan / index.php
Created March 19, 2014 17:01
Multi Submit Form
<?php
switch($_REQUEST['mode']){
case 'savecontact':
echo "<pre>";
$textinputs = $_REQUEST['textinput'];