Skip to content

Instantly share code, notes, and snippets.

View cmattoon's full-sized avatar

Curtis Mattoon cmattoon

View GitHub Profile
@cmattoon
cmattoon / README.md
Last active April 28, 2024 09:01
Visual Binary Analysis

MySQL Dump

This shade of green happens to correspond to mostly-ASCII characters. This color green correlates to mostly ASCII chars

GPG Encryption

Symmetric (gpg -c) encryption of the above MySQL dump. Encryption - Random Colors in Random Places

@cmattoon
cmattoon / example.amd.js
Created January 12, 2016 21:07
Require.js By Example
/**
* Example Asynchronous Module Definition (AMD)
*
*
*/
define(['jquery', 'console'], function($, console) {
"use strict";
var my_private_var = 'This value is private';
function my_private_method() {
@cmattoon
cmattoon / aslr.py
Created September 27, 2015 20:43
Enable/Disable ASLR on Linux
#!/usr/bin/env python
"""
mv aslr.py /usr/bin/aslr && chmod +x /usr/bin/aslr
Be careful!
"""
import os, sys
FLAG_ENABLE = 2
FLAG_DISABLE = 0
@cmattoon
cmattoon / emacs-web-mode.sh
Last active October 16, 2023 12:44
Easy install emacs web-mode
#!/bin/bash
## INSTALL:
##
## 1A) git clone <GIT_URL> web_mode_gist && cd web_mode_gist
## OR
## 1B) wget <RAW_URL>
## 2. chmod +x emacs-web-mode.sh
## 3. ./emacs-web-mode.sh
##
EMACS="${HOME}/.emacs"
SELECT blocked_locks.pid AS blocked_pid,
blocked_activity.usename AS blocked_user,
blocking_locks.pid AS blocking_pid,
blocking_activity.usename AS blocking_user,
blocked_activity.query AS blocked_statement,
blocking_activity.query AS current_statement_in_blocking_process
FROM pg_catalog.pg_locks blocked_locks
JOIN pg_catalog.pg_stat_activity blocked_activity
ON blocked_activity.pid = blocked_locks.pid
JOIN pg_catalog.pg_locks blocking_locks
@cmattoon
cmattoon / get_acm_certificate.yml
Created September 10, 2019 14:38
Get ACM Certificate with Ansible
---
- hosts: localhost
tasks:
- name: Get ACM Certificates
shell: aws acm list-certificates --region=us-east-1
register: acm
- name: Set ACM Certificate
set_fact:
acm_arn: "{{ item.CertificateArn }}"
@cmattoon
cmattoon / Makefile.docker
Last active April 13, 2019 13:29
Makefile Templates
.DEFAULT_GOAL := help
.PHONY:
PROJECT_NAME = foo-bar
PROJECT_NS = cmattoon
GIT_REPO ?= $(PROJECT_NS)/$(PROJECT_NAME)
GIT_URL ?= git@github.com/$(GIT_REPO).git
VCS_REF = $(strip $(shell git describe --tags --dirty --always))
@cmattoon
cmattoon / fabfile.py
Created February 14, 2019 00:48
CVE-2019-5736 - Apply patch with Fabric
#!/usr/bin/env python
import os
from fabric import Connection
# kubectl get nodes | grep ip | cut -d'-' -f2,3,4,5 | cut -d'.' -f1 | sed 's/-/./g' | xargs echo | sed s'/ /",\"/g'
def getConnection(host):
return Connection(host=host,
user='admin',
connect_kwargs={
@cmattoon
cmattoon / Actual1
Last active September 24, 2018 16:08
Boat Wiring - Falstad
$ 1 0.000005 10.20027730826997 50 5 50
v 224 96 224 176 0 1 40 5 0 0 0.5
v 224 224 224 304 0 1 40 5 0 0 0.5
w 448 160 448 176 0
w 448 176 448 192 0
w 448 192 448 208 0
s 480 160 560 160 0 1 false
s 480 176 560 176 0 1 false
s 480 208 560 208 0 1 false
s 480 192 560 192 0 1 false
@cmattoon
cmattoon / route_tables.py
Created September 7, 2018 21:34
Graph AWS Route Tables
#!/usr/bin/env python
"""
./route_tables.py | dot -Tpng > routes.png
"""
import boto3
def get_tag(obj, key, default=''):
for tag in obj['Tags']:
if tag['Key'] == key:
return tag['Value']