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
from requests.adapters import HTTPAdapter | |
from requests.packages.urllib3.poolmanager import PoolManager | |
class SSLAdapter(HTTPAdapter): | |
"""A HTTPS Transport Adapter that uses an arbitrary SSL version.""" | |
def __init__(self, ssl_version=None, **kwargs): | |
self.ssl_version = ssl_version | |
super(SSLAdapter, self).__init__(**kwargs) |
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 bash | |
# Only tested on Mac OSX 10.10 | |
if [ -d ~/.chef_pp ]; then | |
echo "Changing to Pre-Production Chef Environment." | |
mv ~/.chef ~/.chef_sandbox | |
mv ~/.berkshelf ~/.berkshelf_sandbox | |
mv ~/.chef_pp ~/.chef | |
mv ~/.berkshelf_pp ~/.berkshelf |
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
# Convert all flac files in all subdirs to mp3 with ffmpeg | |
find . -type f -name "*.flac" -print0 | while read -d $'\0' a; do | |
< /dev/null ffmpeg -i "$a" -qscale:a 0 "${a[@]/%flac/mp3}" | |
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
# Apply the Local Configuration Manager for DSC. | |
# DSC by default runs a consistancy check once every 15 minutes. | |
# We disable this because it causes collisions with chef-client runs. | |
powershell_script 'apply_lcm' do | |
code <<-EOH | |
configuration LCM | |
{ | |
LocalConfigurationManager | |
{ | |
ConfigurationMode = "ApplyOnly" |
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
# Recurse into all subdirectories of the working directory. | |
# Converts all flac into mp3 using ffmpeg | |
find . -type f -name "*.flac" -print0 | while read -d $'\0' a; do < /dev/null ffmpeg -i "$a" -qscale:a 0 "${a[@]/%flac/mp3}" | |
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
# Execute this script in order to upgrade all the windows nodes in your fleet of servers to the desired version of chef-client. | |
# This script will requires the ChefDK to be installed and configured on your Windows machine. | |
$windows_nodes = knife search node 'platform:windows' -i | |
invoke-command -ComputerName $windows_nodes -filepath C:\Users\MyUser\invoke_upgrade.ps1 -Credential domain\user | |
Read-Host -Prompt “Upgrade complete. Press Enter to exit.” |
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
def virtual_disk_for(vm, options) | |
if options[:datastore].to_s.empty? | |
raise ":datastore must be specified when adding a disk to a cloned vm" | |
end | |
idx = vm.disks.count | |
RbVmomi::VIM::VirtualDeviceConfigSpec( | |
:operation => :add, | |
:fileOperation => :create, | |
:device => RbVmomi::VIM.VirtualDisk( | |
:key => idx, |
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
($PhysicalPath, "c:\inetpub\wwwroot" -ne $null)[0] # null coalescing | |
# Based on the order of operations, this works in following order: | |
# The , operator creates an array of values to be tested. | |
# The -ne operator filters out any items from the array that match the specified value--in this case, null. The result is an array of non-null values in the same order as the array created in Step 1. | |
# [0] is used to select the first element of the filtered array. | |
# Simplifying that: |
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
ffmpeg -i input_file.mp4 -vf scale=320:-1:flags=lanczos,fps=30 frames/ffout%03d.png | |
convert -loop 0 frames/ffout*.png output_file.gif |
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 | |
# See: https://github.com/sferik/t on installation instructions | |
spammer_list=$(t search all SEARCH_QUERY | awk '/YOUR REGEX HERE, MATCH TWEET TEXT/{print x};{x=$0}') | |
for spammer in $spammer_list; do | |
#echo $spammer # test first before reporting everyone in the world | |
t report_spam $spammer | |
done |