This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const { map, filter, reduce } = require('lodash'); | |
// array from 0 to 9 | |
const data = [0,1,2,3,4,5,6,7,8,9]; | |
// helper functions | |
const doubled = val => val * 2; | |
const isEven = val => val % 2; | |
const isOverTen = val => val >= 10; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export PS4='+(${BASH_SOURCE}:${LINENO}): ${FUNCNAME[0]:+${FUNCNAME[0]}() [${PIPESTATUS[*]}] }' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# function: file_perms_eq | |
# description: checks first option (filename) to see if the file perms equals the second option (permissions) | |
# usage example: | |
# $ if file_perms_eq mail 700 | |
# > then echo 'good' | |
# > fi | |
file_perms_eq() { (( $(stat -c "%a" $1) == $2 ));} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<body> | |
<head> | |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> | |
<link href="https://fonts.googleapis.com/css?family=Lato" rel="stylesheet"> | |
<style> | |
h1,h2,h3,h4,h5,h6,p,label,input {font-family: 'Lato', sans-serif;} | |
body {padding: 2rem;} | |
</style> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
def main(): | |
''' | |
This is the Python equivalent to the following C code: | |
int n; | |
printf("Enter a Number"); | |
scanf("&d",n); | |
if(n==1) | |
printf("true"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
''' | |
Inspired by https://xkcd.com/1930/ | |
''' | |
from random import randint | |
class CalendarFact: | |
def __init__(self): | |
self.date = ['The Fall Equinox', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Large numbers example using built-in data types | |
* | |
* Author: | |
* Kolby H. <[email protected]> | |
* | |
* Published: | |
* November 24, 2017 | |
* | |
* Usage: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
next feature: | |
- import statement | |
- store and retrieve hashmaps | |
- variable handling (list of dictionaries) | |
technical features: | |
- function statement | |
- argument parsing | |
- commands: | |
- print statement |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 \ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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' |