Skip to content

Instantly share code, notes, and snippets.

# Output of Terraform for informational purpose for a bug report. Otherwise useless.
azurerm_storage_account.monitoring: Creating...
azurerm_storage_account.monitoring: Still creating... [10s elapsed]
azurerm_storage_account.monitoring: Still creating... [20s elapsed]
< snip >
azurerm_storage_account.monitoring: Still creating... [9m48s elapsed]
azurerm_storage_account.monitoring: Still creating... [9m58s elapsed]
azurerm_storage_account.monitoring: Creation complete after 10m7s [id=/subscriptions/<redacted>/resourceGroups/u<redacted>n/providers/Microsoft.Storage/storageAccounts/<redacted>]
azurerm_storage_share.mpowcoremon_fileshare: Creating...
azurerm_storage_container.monitoring: Creating...
@k7faq
k7faq / sync_gitlab_by_memship.sh
Created March 7, 2019 16:29
Sync GitLab Repos (filtered by membership)
#!/usr/bin/env bash
# Documentation
# https://docs.gitlab.com/ce/api/projects.html#list-projects
#
# What does this script do?
# This script will clone ( or pull existing ) ALL of the repos you have access to in GitLab.
# This script does not pull other peoples/entities repos.
#
# INSTRUCTIONS FOR USE
@k7faq
k7faq / gist:754cc3875a78bd15e78786c27b1060cb
Created January 6, 2019 23:40
List / Clone all repos in a users GitHub Account
# Tested on MacBook Pro - Mac OS Mohave 10.14.2
# List all repos in a users GitHub Account
curl -si https://api.github.com/users/terraform-aws-modules/repos | grep ssh_url | cut -d '"' -f4
# Clone all repos in a users GitHub Account
curl -si https://api.github.com/users/## GITHUB USER ##/repos | grep ssh_url | cut -d '"' -f4 | xargs -I{} git clone {}
# Mixed list of array(list) and integer
mixed=[ 'a', [1],2,[3], ['B'] ]
# function to extract value(s) from a list which may contain lists of integers
def flattenMixedList( mixed ):
for item in mixed:
if isinstance(item, list):
for thisItem in item: yield thisItem
else:
yield item
@k7faq
k7faq / gist:a2b5b0182c7043a60dd95e130b3a2ae9
Created November 21, 2018 14:57
Create Ansible Playbook and Role directory structure
mkdir group_vars host_vars plugins library roles/role{1..3}/{tasks,templates,handlers,files,vars,defaults,meta} -p
Alias
.bashrc
alias messagelog = “tail -f /var/log/messages”
export MYNAME =”Steven”
environment variables
$ export CUSTOM_LOG=”/custom/log/” ← to set a variable from command line
$ echo $CUSTOM_LOG ← to obtain settings
$ echo “MY log message” > $CUSTOM_LOG/mylog.txt ← place content in file
$ unset CUSTOM_LOG
CLI Nav Keys
Ctrl+A – begin of line
Ctrl+E – End of line
Ctrl+K – remove all chars after cursor
Ctrl+L – delete text except current line
Ctrl+U – delete text before cursor
Ctrl+W – removes last word in string at cursor
Ctrl+T – switches two letters at cursor with one before
Ctrl+F – move forward one char at a time
Ctrl+B – move back one char at a time
Screen
Ctrl+a c – Create new Screeen
Ctrl+a 0-9 – Switch between screens
Ctrl+a n – Switch to next screen
Ctrl+a k – Kill current screen
Ctrl+a A – Set a title
Ctrl+a d – Detach
Ctrl+a ? – Help
Which and Whereis locate man pages and locations of binary files for a specific program.
$ which pwd
$ whereis pwd
Locate uses database that needs updated (by cron)
$ locate pwd
$ updatedb ← updates locate database
$ locate kernel | grep /usr ← find “kernel” in path or file name within the /usr folder
Find
# architecture
lscpu
# release
# RHEL, CentOS
cat /etc/redhat-release
# Ubuntu
cat /etc/issue
lsb_release -a