Skip to content

Instantly share code, notes, and snippets.

View jhyland87's full-sized avatar

J jhyland87

View GitHub Profile
#! /usr/local/bin/awk -f
# echo -e "Jane Doe\n123 Main Street\nAnywhere, SE 12345-6789\n\nJohn Smith\n456 Tree-lined Avenue\nSmallville, MW 98765-4321" | ./include-test.awk
#@include "/Users/jhyland/Documents/scripts/awk/utils.awk"
function resetVhost() {
vhost["server_name"] = ""
vhost["document_root"] = ""
vhost["error_log"] = ""
vhost["access_log"] = ""
vhost["cfg_file"] = ""
#!/usr/local/bin/awk -f
# Todo:
# skip empty rows
# Look for duplicate pids
# Validate data types in columns:
# - pid (int)
# - ppid (int)
# - uid (int)
# - ruid (int)
@jhyland87
jhyland87 / ps-totaler.awk
Created October 11, 2017 19:10
Awk script to total the data returned from ps
#!/usr/bin/awk -f
# Examples
# $ ps -o pid,user,cpu,%cpu,%mem,nswap,sess,tty | ./ps_total.awk
# Count : 58
# USER : 0
# CPU : 0
# %CPU : 1.8
# %MEM : 2.5
# NSWAP : 0
@jhyland87
jhyland87 / Stat_Widgets.html
Created September 19, 2017 18:40
Example output of <Stat/> component
<div class="row">
<div class="col-md-3 col-sm-6">
<div class="widget widget-stats bg-blue-grey">
<div class="stats-icon stats-icon-lg"><i class="fa fa-fw fa-globe"></i></div>
<div class="stats-title">Todays Visits</div>
<div class="stats-number">123</div>
<div class="stats-progress progress">
<div class="progress-bar" style="width: 70.1%;"></div>
</div>
<div class="stats-desc">Better than last week (70.1%)</div>
@jhyland87
jhyland87 / App.jsx
Last active September 19, 2017 18:41
Example ReactJS app using some custom components
'use strict'
import React, { Component } from 'react'
import PageLoader from './PageLoader'
import IconFactory from './IconFactory'
import Tree from 'react-ui-tree'
//import Panel from './Panel'
import Header from './Header'
import Sidebar from './Sidebar'
import TreeView from './TreeView'
@jhyland87
jhyland87 / Widgets.jsx
Last active September 19, 2017 18:37
ReactJS Widget Component
'use strict'
import React, { Component } from 'react'
import _ from 'lodash'
import ReactBootstrap, {
Button, ButtonGroup, DropdownButton, ButtonToolbar, OverlayTrigger, Tooltip, Popover,
MenuItem, Nav, NavItem, Breadcrumb, PageHeader, Table, Panel,
ListGroup, ListGroupItem, Jumbotron, Grid, Row, Col, Alert, Glyphicon,
} from 'react-bootstrap'
import PropTypes from 'prop-types'
var _ = require('lodash')
var expect = require('chai').expect
var Account = require('../models/Account')
describe('Account model', function() {
describe('schema item', function() {
// Account.username
describe('"username"', function() {
'use strict'
var _ = require('lodash')
var expect = require('chai').expect
var Account = require('../models/Account')
var testData = {
// Default data for test account
testAccount: {
'use strict'
const Mongoose = require( 'mongoose' )
const _ = require( 'lodash' )
const _internal = {
states: {
// List of valid Mongoose states
readyStates: [
'disconnected', // readyState: 0
'use strict'
//const _ = require( 'lodash' )
const _ = require('../mongoose-mixins')
const Async = require( 'async' )
const Util = require( 'util' )
const Path = require( 'path' )
const Mongoose = require( 'mongoose' )
const Promise = require( 'bluebird' )