Skip to content

Instantly share code, notes, and snippets.

View cgorshing's full-sized avatar
👋
Hey!

Chad Gorshing cgorshing

👋
Hey!
View GitHub Profile
@cgorshing
cgorshing / gist:3978124
Last active September 1, 2020 03:10
From /var/lib/dpkg/info/gmetad.postinst
#!/bin/sh
set -e
if ! getent group ganglia >/dev/null; then
echo Adding group: ganglia.
groupadd --system ganglia
fi
if ! getent passwd ganglia >/dev/null; then
echo Adding system user: ganglia.
@cgorshing
cgorshing / hadoop-upstart
Created September 19, 2012 19:35
Beginnings of a hadoop upstart script
#http://upstart.ubuntu.com/cookbook/
#http://www.bryanmarty.com/2012/02/setting-nofile-limit-upstart/
description "Hadoop @HADOOP_DAEMON@"
author "Chad Gorshing <[email protected]>"
start on runlevel [2345]
stop on runlevel [!2345]
env LOG_FILE="/var/log/hadoop/@[email protected]"
@cgorshing
cgorshing / gist:3415982
Created August 21, 2012 14:25
Read Fixed Width File w/Excel
'This script was based almost entirely on http://blogs.technet.com/b/heyscriptingguy/archive/2008/04/14/how-can-i-import-a-fixed-width-data-file-into-microsoft-excel.aspx
Const xlFixedWidth = 2
'http://msdn.microsoft.com/en-us/library/office/bb241018(v=office.12).aspx
Const xlDMYFormat = 4 ' DMY date format.
Const xlDYMFormat = 7 ' DYM date format.
Const xlEMDFormat = 10 ' EMD date format.
Const xlGeneralFormat = 1 ' General.
Const xlMDYFormat = 3 ' MDY date format.
@cgorshing
cgorshing / groovy-pom.xml
Created May 16, 2012 14:26
Bare bones Groovy Pom
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.example</groupId>
<artifactId>project-name</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<properties>
Turned this ....
private void BindViews()
{
var associatedTable = new DataTable();
associatedTable.Columns.Add(new DataColumn("TestID", typeof (Int32)));
if (_onlineCourse != null && _onlineCourse.OnlineCourseID > 0)
{
foreach (OnlineCourseTest oct in OnlineCourseTest.GetAllByOnlineCourseID(_onlineCourse.OnlineCourseID))
associatedTable.Rows.Add(new object[] {oct.TestID});
@cgorshing
cgorshing / gist:1100171
Created July 22, 2011 19:09
jQuery Confirm Dialog (noConflict)
jQuery.noConflict();
jQuery(document).ready(function() {
jQuery('#deleteLink').click(function() {
return jQueryConfirm('#deleteLink', '<fmt:message key="buttons.delete.confirm"/>', 'Delete', 'Cancel');
});
});
function jQueryConfirm(id, message, confirmButton, cancelButton) {
var dialog = jQuery('<div></div>');