Skip to content

Instantly share code, notes, and snippets.

/**
* @file Defines Person class
* @version 1.0
* @author Kolby Heacock <kolby@fasterdevops.com>
* @copyright Kolby Heacock 2017
*/
/**
* Representation of a person
* @class
/**
* fizzbuzz in javascript
* @return {string} - output of fizzbuzz coding challenge
*/
function fizzbuzz() {
let output = ''; // initialize return string
for (tmp=1; tmp<=100; tmp++) { // iterate from 1 to 100
if ((tmp % 15) === 0) { // if divisible by 3 and 5
output += 'fizzbuzz'; // add 'fizzbuzz'
} else if ((tmp % 3) === 0) { // if divisible by just 3
>>> out_files = []
>>> for dirpath, subidrs, files in os.walk('/home/kolby/Desktop'):
... for item in files:
... print dirpath + item
...
/home/kolby/Desktoplabsim1.3_kolby_heacock.pdf
/home/kolby/Desktopsteam.desktop
/home/kolby/Desktoplabsim1.2_kolby_heacock.pdf
#!/bin/sh
# padding output using printf
# reference: https://stackoverflow.com/questions/4409399/padding-characters-in-printf#4410103
pad=$(printf '%0.1s' "-"{1..60})
padlength=40
string2='bbbbbbb'
for string1 in a aa aaaa aaaaaaaa; do
printf '%s' "$string1"
printf '%*.*s' 0 $((padlength - ${#string1} - ${#string2} )) "$pad"
<?php
// Database Creds
$DB_NAME = "<database goes here>";
$DB_USER = "<username goes here>";
$DB_PASS = "<password goes here>";
$DB_HOST = "localhost";
// Get list of tables
$get_tables = "mysql "
#!/bin/sh
# tail_logs.sh
tail_logs() {
# arguments: IP addresses to search for in logs.
files='/usr/local/apache/access_log
/usr/local/apache/error_log
/var/log/nginx/access.log
/var/log/nginx/error.log'
#!/bin/sh
# list primary domains of all
# cPanel backups in the current directory.
for file in $(\ls backup-*); do
tar --occurrence=1 \
--to-stdout \
--extract \
--verbose \
--gzip \
next feature:
- import statement
- store and retrieve hashmaps
- variable handling (list of dictionaries)
technical features:
- function statement
- argument parsing
- commands:
- print statement
/**
* Large numbers example using built-in data types
*
* Author:
* Kolby H. <kolby@fasterdevops.com>
*
* Published:
* November 24, 2017
*
* Usage:
#!/usr/bin/env python
'''
Inspired by https://xkcd.com/1930/
'''
from random import randint
class CalendarFact:
def __init__(self):
self.date = ['The Fall Equinox',