Skip to content

Instantly share code, notes, and snippets.

🎸

Jason Ashby snobear

🎸
View GitHub Profile
@snobear
snobear / inject-aws-secrets-to-k8s.sh
Last active May 14, 2020
Inject secrets from AWS Secrets Manager into k8s secrets for a given cluster and namespace
View inject-aws-secrets-to-k8s.sh
#!/bin/bash
# Iterate through list of all secrets in AWS Secrets Manager for this cluster and namespace
# assumptions:
# - AWS secrets must have tag: cluster=$cluster
# - secret names are namespaced like product/service/somename so we can create k8s friendly secrets like $service-$somename. Adjust awk as necessary for your own needs.
export cluster=foocluster
export namespace=some-namespace
export AWS_REGION=us-east-1
export AWS_PROFILE=myprofile
@snobear
snobear / expire-s3-bucket.sh
Last active Oct 31, 2019
Expire all objects in an S3 bucket with a lifecycle rule using aws cli
View expire-s3-bucket.sh
#!/bin/bash
# set an s3 bucket to expire after one day. Faster than waiting to delete all the files.
# check back after a day or so (depending on size of bucket) and delete the bucket from s3
if [ "$#" -lt 2 ]; then
echo "error: run_report expects at least 2 arguments; got $#."
echo "Usage:"
echo " ./$(basename $0) region bucket"
exit 1
fi
@snobear
snobear / install.MD
Last active Jul 2, 2020
Installing Alfresco and Citeck EcoS on Linux
View install.MD

Launch CentOS 7 64-bit instance on AWS - use t2.medium since 2GB of mem is the minimum requirement for Alfresco.

Open port 8080 in AWS security firewall settings.

Update all server packages

# login with centos user
sudo yum update -y
# reboot if kernel is updated
@snobear
snobear / opentok_screenshare.js
Last active Dec 17, 2019
chrome screen share - page js
View opentok_screenshare.js
/*
* Check if user has extension installed and launch
*
*/
function shareScreen() {
// Chrome screen-sharing extension ID
var extensionId = 'dgckdhnehiggafbppghjpnapieoegekl';
// check that the extension is installed by looking for a
@snobear
snobear / cancel-pulp-tasks.sh
Last active Jun 21, 2019
script to cancel all pulp tasks
View cancel-pulp-tasks.sh
#!/bin/bash
#
# Cancel all pulp tasks that are just in a specifiedstate
tmpfile=/tmp/tasks
read -p "Enter task state to kill, e.g. Waiting: " ans
echo ""
if [ "${#ans}" -gt 0 ]
then
@snobear
snobear / views.py
Last active Aug 29, 2015
getstream return enriched as json
View views.py
# this throws: <stream_django.enrich.EnrichedActivity object at 0x7f8ffc86e250> is not JSON serializable
from django.http import HttpResponse, HttpResponseServerError
from stream_django.enrich import Enrich
from stream_django.feed_manager import feed_manager
import json
def enrich_feed(request):
context = {}
try:
# raw feed data
View gist:908fe9c7ac19548d4ae7
root@test01~$ /usr/bin/fpm --rpm-use-file-permissions --debug -n perl-JKL-Authen-Smb --package /home/banjer --workdir /tmp_nfs --no-cpan-test --rpm-auto-add-directories --no-auto-depends --cpan-perl-lib-path /usr/local/perl-5.16.2/lib/site_perl/5.16.2 --cpan-cpanm-bin /usr/local/bin/cpanm -s cpan --description 'Packaged with fpm. To be used exclusively by JKL, Inc.' -t rpm Authen::Smb"
{:level=>:info, :file=>"fpm/command.rb", :method=>"execute", :timestamp=>"2015-02-05T10:47:45. %6N-0500", :message=>"Setting workdir", :line=>"279", :workdir=>"/tmp_nfs"}
{:level=>:debug, :file=>"fpm/command.rb", :method=>"execute", :timestamp=>"2015-02-05T10:47:45. %6N-0500", :message=>"Setting attribute", :line=>"323", :output_type=>"rpm"}
{:level=>:debug, :input_type=>"cpan", :file=>"fpm/command.rb", :method=>"execute", :timestamp=>"2015-02-05T10:47:45. %6N-0500", :message=>"Setting attribute", :line=>"323"}
{:level=>:debug, :file=>"fpm/command.rb", :method=>"execute", :timestamp=>"2015-02-05T10:47:45. %6N-0500",
@snobear
snobear / mco-cheat-sheet
Last active May 16, 2017
MCollective cheat sheet
View mco-cheat-sheet
# MCollective Cheat Sheet
MCollective is a server orchestration tool that is built by Puppet Labs and so is tightly integrated with the puppet infrastructure. Commands a run from the control aka "client" server.
## Finding/listing hosts
List all
```
mco find
@snobear
snobear / clone.py
Last active Apr 6, 2020
Clone VM from template with pyVmomi
View clone.py
#!/usr/bin/env python
"""
NOTE:
This gist has been moved to EZmomi:
https://github.com/snobear/ezmomi
Give it a star or fork. Contributions are more than welcome. I'm hoping it will become an easy cli tool for
common VMware tasks.
@snobear
snobear / gist:5936060
Last active Dec 19, 2015
fpm --debug output of perl module
View gist:5936060
me@myhost:/usr/local> fpm --debug --prefix /usr/local/perl-5.16.2 --cpan-perl-lib-path /usr/local/perl-5.16.2/lib --cpan-cpanm-bin /usr/local/perl-5.16.2/bin/cpanm --no-cpan-test -s cpan -t rpm Net::SNMP
Setting attribute {:output_type=>"rpm", :level=>:debug, :file=>"fpm/command.rb", :line=>"285"}
Setting attribute {:input_type=>"cpan", :level=>:debug, :file=>"fpm/command.rb", :line=>"285"}
Setting attribute {:chdir=>nil, :level=>:debug, :file=>"fpm/command.rb", :line=>"285"}
Setting attribute {:prefix=>"/usr/local/perl-5.16.2", :level=>:debug, :file=>"fpm/command.rb", :line=>"285"}
Setting attribute {:package=>nil, :level=>:debug, :file=>"fpm/command.rb", :line=>"285"}
Setting attribute {:force?=>false, :level=>:debug, :file=>"fpm/command.rb", :line=>"285"}
Setting attribute {:name=>nil, :level=>:debug, :file=>"fpm/command.rb", :line=>"285"}
Setting attribute {:verbose?=>nil, :level=>:debug, :file=>"fpm/command.rb", :line=>"285"}
Setting attribute {:debug?=>true, :level=>:debug, :file=>"fpm/command.rb", :lin
You can’t perform that action at this time.