Skip to content

Instantly share code, notes, and snippets.

View irvingpop's full-sized avatar

Irving Popovetsky irvingpop

View GitHub Profile
@irvingpop
irvingpop / slack-channel-joiner.py
Created March 19, 2024 17:00
Join an app, bot or any named user to all private channels in a Slack team
import requests
# Your LEGACY Slack API token
SLACK_API_TOKEN = "xoxp-my-slack-legacy-token"
def get_channel_list():
"""
Retrieves a list of available channels using the Slack API.
"""
url = "https://slack.com/api/conversations.list"
@irvingpop
irvingpop / hny-column-cleanup.py
Last active July 7, 2022 18:27
Honeycomb column deletion tools
#!/usr/bin/env python3
# usage: hny-column-cleanup.py [-h] -k API_KEY -d DATASET [-m {hidden,spammy}]
# Honeycomb Dataset Column Cleanup tool
# arguments:
# -h, --help show this help message and exit
# -k API_KEY, --api-key API_KEY
# Honeycomb API key
# -d DATASET, --dataset DATASET
# Honeycomb Dataset
@irvingpop
irvingpop / how_big_is_my_node.md
Last active September 26, 2018 18:26
How big is my Chef node object?

first, enter chef-shell:

$ chef-shell
loading configuration: none (standalone session)
Session type: standalone
Loading.........done.

This is the chef-shell.
 Chef Version: 14.3.37
@irvingpop
irvingpop / okta-aws.plugin.zsh
Created September 17, 2018 20:32
okta_aws plugin for oh-my-zsh
# shellcheck disable=SC2148
# shellcheck disable=SC2034
# okta-aws plugin for oh-my-zsh
# for use with the bullet-train oh-my-zsh theme: https://github.com/caiogondim/bullet-train.zsh
# (although this could be easily changed)
# Irving Popovetsky <irving@chef.io>
# default profile is used if you don't set one using AWS_PROFILE, which is recommended
OKTA_AWS_DEFAULT_PROFILE="chef-engineering"
@irvingpop
irvingpop / Install-DockerOnWS2016ByDSC.ps1
Created August 10, 2018 21:16 — forked from PlagueHO/Install-DockerOnWS2016ByDSC.ps1
Install Docker on Windows Server 2016 RTM using DSC
Configuration ContainerHostDsc
{
# Set up general parameters used to determine paths where Docker will
# be installed to and downloaded from.
$ProgramFiles = $ENV:ProgramFiles
$DockerPath = Join-Path -Path $ProgramFiles -ChildPath 'Docker'
$DockerZipFileName = 'docker.zip'
$DockerZipPath = Join-Path -Path $ProgramFiles -ChildPath $DockerZipFilename
$DockerUri = 'https://download.docker.com/components/engine/windows-server/cs-1.12/docker.zip'
@irvingpop
irvingpop / travis.yml
Last active May 8, 2018 04:19
Example Travis config to build, smoketest and publish a hab package as a docker container
sudo: required
dist: trusty
services: docker
language: bash
install:
- 'curl https://raw.githubusercontent.com/habitat-sh/habitat/master/components/hab/install.sh | sudo bash'
branches:
only:
@irvingpop
irvingpop / README.md
Last active October 25, 2021 10:59
Chef Server Report: Script to list all nodes in all orgs, grouped by org, then environment, then chef client version.

Example output:

root@chef:~# ./chef_server_nodes_report.rb -h
Usage: chef_server_nodes_report.rb [options]
    -g, --group-by TYPE              Group results by: ["version", "org", "environment", "check_in_month", "check_in_date", "platform_family", "platform_version", "platform", "os"]

root@chef:~# ./chef_server_nodes_report.rb --group-by version
loading config from /etc/opscode
{
@irvingpop
irvingpop / launch_ec2_windows_spot.sh
Last active June 18, 2018 18:47
Quickly launch and preconfigure a Windows 2016 dev machine in AWS with spot pricing, from your mac
#!/bin/bash -ex
# Quickly launch and preconfigure a Windows 1803 dev machine in AWS with spot pricing, from your mac
usage='
launch_ec2_windows_spot.sh --username irving --password Cod3Can! --ssh-key irving --subnet subnet-7fd06308 --security-group-id sg-8a0f82f5
NOTE: Due to a weird assumption in the UserData script, the password must be exactly 8 characters long and meet complexity requirements
NOTE2: Create a SECURITY_GROUP_ID that allows port 3389 from your IP address
NOTE3: Install Microsoft Remote Desktop 10 from the app store ( https://itunes.apple.com/us/app/microsoft-remote-desktop-10/id1295203466?mt=12 )
'
@irvingpop
irvingpop / .gitignore
Last active January 30, 2023 22:31
Launch EC2 spot instances with tags, like a boss
MY_INSTANCEID
MY_SERVER
user-data.txt
.zshrc
.gitconfig
.ssh
.byobu
.oh-my-zsh
@irvingpop
irvingpop / ssh_key.tf
Last active April 8, 2024 07:18
Terraform external data source example - dynamic SSH key generation
# ssh key generator data source expects the below 3 inputs, and produces 3 outputs for use:
# "${data.external.ssh_key_generator.result.public_key}" (contents)
# "${data.external.ssh_key_generator.result.private_key}" (contents)
# "${data.external.ssh_key_generator.result.private_key_file}" (path)
data "external" "ssh_key_generator" {
program = ["bash", "${path.root}/../ssh_key_generator.sh"]
query = {
customer_name = "${var.customer_name}"
customer_group = "${var.customer_group}"