Skip to content

Instantly share code, notes, and snippets.

View TWinsnes's full-sized avatar

Thomas Winsnes TWinsnes

View GitHub Profile
@TWinsnes
TWinsnes / pusher-test.html
Last active May 23, 2024 04:56
Page to test pusher connection and events
<!DOCTYPE html>
<html>
<head>
<style>
body { padding-left: 5rem; padding-right: 5rem; }
.label { width: 160px; }
.bigbtn { padding: 0.5rem 2rem; }
</style>
<title>Pusher Test Page</title>
<script src="https://js.pusher.com/8.3/pusher.min.js"></script>
@TWinsnes
TWinsnes / load.sh
Created July 14, 2023 02:34
Shell script to add AWS accounts to Hava from a CSV file
#!/bin/bash
# -------------------------------------
# Hava Source Loader
#
# This short script will load aws car sources into hava from a CSV file
#
# Variables:
# * INPUT - path to csv file to read sources from
# * HAVA_API_KEY - api key to access hava
# * EXTERNAL_ID - external ID for your Hava account. This value must be set to an
@TWinsnes
TWinsnes / main.tf
Created January 23, 2023 20:49
Adding multiple accounts to have using terraform and for_each
# more info about for_each here: https://developer.hashicorp.com/terraform/language/meta-arguments/for_each
provider "hava" {
# alternatively use the HAVA_TOKEN environment variable
api_token = "xxx"
}
local (
accounts = toset([]
{
@TWinsnes
TWinsnes / proxy.js
Created August 23, 2022 07:14
Quick nodejs Proxy for debugging https requests
// Update the target to be the taget url you are hitting
//
// run this standalone and in your app send traffic to localhost:8000
var http = require('http'),
httpProxy = require('http-proxy');
const proxy = httpProxy.createProxyServer({
target: 'https://target.url.com',
secure: false
@TWinsnes
TWinsnes / markdown
Last active July 22, 2022 02:10
Embed Hava diagram in markdown
![Hava embedded architecture diagram](https://embed.hava.io/247ba715-2bf4-4a22-a063-b27be3b9bdf6.png)
@TWinsnes
TWinsnes / gist:ff11fa2a38b6ebc18db2f00ce1feadba
Created April 18, 2020 06:22
Get all commits in a time period for a repository in GitHub using GraphQL
query {
# replace owner name and name of the repositort to scan
repository(owner: "twinsnes", name: "<repo name>"){
name,
refs(refPrefix: "refs/heads/", first: 100){
totalCount,
nodes {
target {
... on Commit {
# replace dates