This file contains 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
def normalize(obj, dict_key=None, regx="text"): | |
""" This function cleans and normalize a given string. It performs three | |
main operations: Sets to lower case, strips any trailing whitespace and | |
finally substracts any character that isn't allowed in the string type | |
regex, the character is replaced with an empty string. | |
:param obj: this object can be 'str' or 'dict' instance type. | |
:type obj:str It performs a directly normalization | |
:type obj:dict It expects a key ( from 'dict_key' arg ) string | |
to extract the string to be normalize, otherwise returns None. |
This file contains 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/bash | |
# | |
# Change file or dir permissions mode and, sets SELinux 'httpd_sys_script_exec_t' file context. | |
# Permissions mode: (u:7) (g:5) (o:5) | |
# (u) the user who owns it | |
# (g) other users in the file's group | |
# (o) other users not in the file's group | |
# | |
# Usage: fix_perms {grp-name} {directory|filename} |
This file contains 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
/** | |
* Logging Functions Toolkit. | |
* | |
* Logs with a prefixed message, if console.log isn't available, none op is performed | |
* @param {object} arguments | |
*/ | |
function log(){ | |
if ( window.console && console.log ) | |
console.log.apply( this, prefixedArray( arguments ) ); | |
} |
This file contains 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 bash | |
set -o errexit | |
set -o errtrace | |
usage() { | |
printf "\ | |
macOS socketfilterfw decorator. | |
firewall [-command] [args] |
This file contains 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
import json | |
import pprint | |
import sys | |
if sys.argv[1] is None: | |
print "JSON source not defined" | |
exit() | |
# e.g. _data/source-tree-templates.json |
This file contains 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
========================================== | |
CURL COMMAND | |
========================================== | |
Format curl [options] [URL...] | |
Quick Ref: | |
curl -X POST http://example.com/ <= Method option and URL (Options come before or after URL) | |
-H "Authorization: <data>" <= Add HTTP Header (like Authorization) |
This file contains 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
from pprint import pprint | |
import json | |
import sys | |
import os | |
DATA_TYPES = { | |
"S": lambda x: str(x), | |
"B": lambda x: bool(x), | |
"N": lambda x: str(x), |
This file contains 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 bash | |
set -o errexit | |
_FILES_RULES=('.DS_Store' 'node_modules ' '.jekyll-cache' '.sass-cache' '.venv' 'venv') | |
_USAGE="$(printf """ | |
Git .gitignore file helper tool. | |
Usage: ignore (filepath) ([OPTIONS]) |
This file contains 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 bash | |
# Generate password hash | |
# | |
genpwd(){ | |
echo $(tr -dc A-Za-z0-9_ < /dev/urandom | head -c 20 | xargs) | |
} | |
# Check internet connection | |
# |
This file contains 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
# Site | |
title: "you site title" | |
email: webmaster@yoursite.com | |
description: >- # this means to ignore newlines until "baseurl:" | |
Your site description | |
# Env: localhost | |
url: "http://localhost/" # the base hostname & protocol | |
baseurl: "/cc" # the subpath, e.g. /parefix | |
port: 5000 |
OlderNewer