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
| get_latest_release() { | |
| curl --silent "https://api.github.com/repos/$1/releases/latest" | # Get latest release from GitHub api | |
| grep '"tag_name":' | # Get tag line | |
| sed -E 's/.*"([^"]+)".*/\1/' # Pluck JSON value | |
| } | |
| # Usage | |
| # $ get_latest_release "creationix/nvm" | |
| # v0.31.4 |
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/bash | |
| # For example: switch-tty.sh `pidof vi` `tty` | |
| target=$1 | |
| dest=$2 | |
| if [ -z "$target" -o -z "$dest" ]; then | |
| echo "usage: $0 pid target" | |
| exit 1 | |
| fi |
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 | |
| # /etc/NetworkManager/dispatcher.d/pre-up.d/randomize-mac-addresses | |
| # Configure every saved WiFi connection in NetworkManager with a spoofed MAC | |
| # address, seeded from the UUID of the connection and the date eg: | |
| # 'c31bbcc4-d6ad-11e7-9a5a-e7e1491a7e20-2017-11-20' | |
| # This makes your MAC impossible(?) to track across WiFi providers, and | |
| # for one provider to track across days. |
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
| FIELDS = ['cmd', 'command', 'start', 'end', 'delta', 'msg', 'stdout', 'stderr'] | |
| def human_log(res): | |
| if type(res) == type(dict()): | |
| for field in FIELDS: | |
| if field in res.keys(): | |
| # use default encoding, check out sys.setdefaultencoding | |
| print u'\n{0}:\n{1}'.format(field, res[field]) | |
| # or use specific encoding, e.g. utf-8 |
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
| --- | |
| # ^^^ YAML documents must begin with the document separator "---" | |
| # | |
| #### Example docblock, I like to put a descriptive comment at the top of my | |
| #### playbooks. | |
| # | |
| # Overview: Playbook to bootstrap a new host for configuration management. | |
| # Applies to: production | |
| # Description: | |
| # Ensures that a host is configured for management with Ansible. |
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
| --- | |
| - hosts: all | |
| sudo: yes | |
| tasks: | |
| - name: Update packages list | |
| apt: update_cache=yes | |
| when: ansible_os_family == 'Debian' | |
| - name: List packages to upgrade (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
| #!/bin/bash | |
| JAILS=`fail2ban-client status | grep "Jail list" | sed -E 's/^[^:]+:[ \t]+//' | sed 's/,//g'` | |
| for JAIL in $JAILS | |
| do | |
| fail2ban-client status $JAIL | |
| done |
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
| # Mandatory Files: copied from Centos7 ISO installer (minimal/full dvd) | |
| # | |
| # $ROOT/cdroot/.discinfo | |
| # $ROOT/cdroot/LiveOS/squashfs.img | |
| # $ROOT/cdroot/isolinux/boot.cat | |
| # $ROOT/cdroot/isolinux/initrd.img | |
| # $ROOT/cdroot/isolinux/isolinux.bin | |
| # $ROOT/cdroot/isolinux/vmlinuz | |
| # |
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/bash | |
| # bash-autopatch.sh | |
| # A shell script that fully automates the "manual" patching of GNU Bash, using source and all known official patches. | |
| # Contributed by Mike Marino, based on Steve Jenkins' manual Bash patching and compiling procedure at: | |
| # http://stevejenkins.com/blog/2014/09/how-to-manually-update-bash-to-patch-shellshock-bug-on-older-fedora-based-systems/ | |
| # This script is a "continuation" of Steve Cook's bash-multipath.sh at: https://gist.github.com/stevejenkins/3d64d3543060c1bcac92 | |
| # Version 1.0 - October 10, 2014 |
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
| ############################################################################### | |
| # The MIT License | |
| # | |
| # Copyright 2012-2014 Jakub Jirutka <jakub@jirutka.cz>. | |
| # | |
| # Permission is hereby granted, free of charge, to any person obtaining a copy | |
| # of this software and associated documentation files (the "Software"), to deal | |
| # in the Software without restriction, including without limitation the rights | |
| # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
| # copies of the Software, and to permit persons to whom the Software is |