Skip to content

Instantly share code, notes, and snippets.

@kjenney
kjenney / slackapp.py
Last active February 12, 2024 14:54
Slack App with Socket Mode Sending Interactive Messages and Client Sending Non-Interactive Messages
import requests
import logging
from threading import Thread
from slack_bolt import App
from slack_bolt.adapter.socket_mode import SocketModeHandler
import os
import threading
import time
logging.basicConfig(level=logging.DEBUG)
@kjenney
kjenney / gist:cef4c2346afff05b3b2d4a96f5a4e37a
Created February 11, 2024 17:23
pytrends_top_search_list.py
from pytrends.request import TrendReq
pytrends = TrendReq(hl='en-US', tz=360)
trending = pytrends.trending_searches(pn='united_states')
trending_list = trending[0].tolist()
print(trending_list)
@kjenney
kjenney / app-config.yaml
Created October 10, 2023 23:22
Using Self-hosted Github instance with Backstage Scaffolder
app:
title: Test
baseUrl: http://localhost:3000
organization:
name: Test
backend:
# Used for enabling authentication, secret is shared by all backend plugins
# See https://backstage.io/docs/auth/service-to-service-auth for
@kjenney
kjenney / send_to_api_arduino_uno_wifi_v2
Created July 29, 2023 01:21
send_to_api_arduino_uno_wifi_v2
/*
This example puts data to a secure API endpoint
*/
#include <SPI.h>
#include <WiFiNINA.h>
#include "arduino_secrets.h"
@kjenney
kjenney / gist:4cfcc44482e1720d4e96340e8cb1d7d5
Created July 7, 2022 17:41
Redshift FIPS US-GOV-WEST-1 Failing
\
2022/07/07 17:37:37 [INFO] Terraform version: 0.13.7
2022/07/07 17:37:37 [INFO] Go runtime version: go1.14.7
2022/07/07 17:37:37 [INFO] CLI args: []string{"/bin/terraform", "init", "REDACTED"}
2022/07/07 17:37:37 [DEBUG] Attempting to open CLI config file: /root/.terraformrc
2022/07/07 17:37:37 [DEBUG] File doesn't exist, but doesn't need to. Ignoring.
2022/07/07 17:37:37 [DEBUG] ignoring non-existing provider search directory terraform.d/plugins
2022/07/07 17:37:37 [DEBUG] ignoring non-existing provider search directory /root/.terraform.d/plugins
2022/07/07 17:37:37 [DEBUG] ignoring non-existing provider search directory /root/.local/share/terraform/plugins
2022/07/07 17:37:37 [DEBUG] ignoring non-existing provider search directory /usr/local/share/terraform/plugins
Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols:
+ create
Terraform will perform the following actions:
# aws_s3_bucket.b will be created
+ resource "aws_s3_bucket" "b" {
+ acceleration_status = (known after apply)
+ acl = (known after apply)
+ arn = (known after apply)
@kjenney
kjenney / bootstrap.py
Created September 5, 2021 16:42
Python Boto3 Create and Delete Resources
import argparse
from botocore.exceptions import ClientError
import boto3
from cryptography.fernet import Fernet
import json
import logging
from pprint import pprint
import uuid
'''
@kjenney
kjenney / handler.py
Created November 21, 2018 02:18
Boto3 Upload Failure
import os
import io
import json
import boto3
from boto3.exceptions import ResourceNotExistsError
from botocore.exceptions import ClientError
import pprint
import logging
import tempfile
from wand.image import Image
var nock = require('nock')
var http = require('http');
var request = require('request-promise');
nock('http://greetings_api:3000')
.post('/getGreeting')
.matchHeader('content-type', 'application/json')
.matchHeader('language', 'es')
.matchHeader('host', 'greetings_api:3000')
.matchHeader('content-length', 0)
@kjenney
kjenney / coffee-ingress.yml
Last active September 2, 2018 18:46
EKS Test Ingress
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: coffee
namespace: ingress-nginx
spec:
tls:
- hosts:
- cafe.example.com
secretName: cafe-secret