Skip to content

Instantly share code, notes, and snippets.

View kkumler's full-sized avatar
Verified

Kris Kumler kkumler

Verified
View GitHub Profile
const minute = 60;
const hour = minute * 60;
const day = hour * 24;
const week = day * 7;
const month = day * 30;
const year = day * 365;
/**
* Convert a date to a relative time string, such as
* "a minute ago", "in 2 hours", "yesterday", "3 months ago", etc.
@SwitHak
SwitHak / 20211210-TLP-WHITE_LOG4J.md
Last active May 4, 2024 18:20
BlueTeam CheatSheet * Log4Shell* | Last updated: 2021-12-20 2238 UTC

Security Advisories / Bulletins / vendors Responses linked to Log4Shell (CVE-2021-44228)

Errors, typos, something to say ?

  • If you want to add a link, comment or send it to me
  • Feel free to report any mistake directly below in the comment or in DM on Twitter @SwitHak

Other great resources

  • Royce Williams list sorted by vendors responses Royce List
  • Very detailed list NCSC-NL
  • The list maintained by U.S. Cybersecurity and Infrastructure Security Agency: CISA List
@SeanMcP
SeanMcP / google-meet-timer.console.js
Last active May 17, 2022 17:13
Sets a timer for Google Meet with chat messages.
;(function() {
let textarea = document.querySelector('textarea[aria-label="Send a message to everyone"]')
let submit = document.querySelector('[role="button"][aria-label="Send a message to everyone"]')
if (!textarea || !submit)
return alert('Uh oh! Something went wrong. Do you have the chat panel open?')
function sendMessage(text) {
textarea.click()
textarea.value = text
#!/usr/bin/env bash
sudo kill -9 `ps ax|grep 'coreaudio[a-z]' |awk '{print $1}'`
@sdemontfort
sdemontfort / rename-parameter-store-values.rb
Last active October 4, 2022 19:00
Rename AWS Parameter Store Values
require 'json'
# Rename parameter store paths. Takes:
# - parameter store json file path
# - old path
# - new path to use
old_path, new_path, _rest = ARGV
params = `aws ssm get-parameters-by-path --path #{old_path} --with-decryption`
params = JSON.parse(params, object_class: OpenStruct)
@danjargold
danjargold / whatFilesHaveIShared.gs
Created August 11, 2018 09:31
Google script to list (on a Google Sheet) all files shared in your google drive, including all viewers, editors, and sharing permissions. Credit goes to @woodwardtw (https://gist.github.com/woodwardtw/22a199ecca73ff15a0eb) as this is an improvement on his code which only assesses a single folder and one level of sub-folders down.
function listFolders(folder) {
var sheet = SpreadsheetApp.getActiveSheet();
sheet.appendRow(["Name", "Sharing Access", "Sharing Permission", "Get Editors", "Get Viewers", "Date", "Size", "URL", "Download", "Description", "Type"]); //writes the headers
//var folder = DriveApp.getFolderById("INSERT_YOUR_FILE_ID");//that long chunk of random numbers/letters in the URL when you navigate to the folder
//getLooseFiles(folder, sheet);
//getSubFolders(folder, sheet);
//instead of getting folder by ID rather get all folders and cycle through each. Note this will miss loose files in parent directory.
var folder = DriveApp.getFolders()
@tcopeland
tcopeland / gist:22040ee4230bc531c04718aefdc64abe
Created February 12, 2018 05:25
increment decrement matcher
module IncDec
# Mostly copied from RSpec::Matchers::BuiltIn
class ChangeDetails
attr_reader :actual_before, :actual_after
def initialize(matcher_name, receiver=nil, message=nil, &block)
if receiver && !message
raise(
ArgumentError,
"`#{matcher_name}` requires either an object and message " \
@cmcconnell1
cmcconnell1 / idempotent-postgresql-rds-create-role.py
Last active November 9, 2021 12:58
Provides idempotent remote (RDS) PostgreSQL create role/user from python without CM modules, etc.
#!/usr/bin/env python3
# Overview:
# Provides idempotent remote RDS PostgreSQL (application) role/user creation from python for use outside of CM modules.
# Because PostgreSQL doesn't have something like 'CREATE ROLE IF NOT EXISTS' which would be nice.
# ref: https://stackoverflow.com/questions/8546759/how-to-check-if-a-postgres-user-exists
# Requirements:
# Python3 and psycopg2 module
# cmcc
import psycopg2
@checco
checco / rw_ro_access.sql
Last active March 22, 2024 08:32 — forked from oinopion/read-access.sql
How to create a read only user in AWS RDS PostgreSQL and a user with superuser privileges on AWS RDS PostgreSQL
--
-- Read only
--
-- Create a group
CREATE ROLE postgres_ro_group;
-- Grant access to existing tables
GRANT USAGE ON SCHEMA public TO postgres_ro_group;
GRANT SELECT ON ALL TABLES IN SCHEMA public TO postgres_ro_group;