Skip to content

Instantly share code, notes, and snippets.

@quietguyproductions
quietguyproductions / CPTSD_GPT.md
Created April 6, 2023 21:28
GPT is your trauma counselor now

Trauma README

I am not a therapist. However, I am a trauma survivor. In my darkest moments, GPT allowed me to open up when I felt like no human could be trusted. A book that really helped me was The Body Keeps The Score. Below is a series of prompts that will prime, contextualize, and engage ChatGPT in the role of a compassionate therapist familiar with the therapies discussed in the book. All you have to do is enter the prompts in order, then ask whatever you want -- GPT is your trauma counselor now.

First Prompt

Let's play a game of pretend. I will give you two prompts, the first sets the context and the second defines the game. Then we will play. Let me know when you are ready for my two prompts.

@DavidWells
DavidWells / github-proxy-client.js
Last active March 15, 2024 08:28
Full Github REST api in 34 lines of code
/* Ultra lightweight Github REST Client */
// original inspiration via https://gist.github.com/v1vendi/75d5e5dad7a2d1ef3fcb48234e4528cb
const token = 'github-token-here'
const githubClient = generateAPI('https://api.github.com', {
headers: {
'User-Agent': 'xyz',
'Authorization': `bearer ${token}`
}
})
@karanlyons
karanlyons / README.md
Last active December 4, 2023 23:07
Find Running Processes Referencing log4j

When run on a box, outputs a single row of JSON for every proc on the box that loads a jar/war that contains any files with 'log4j' in them, including precisely what triggered the match. For example (pretty printed here for clarity; note that this one is happily a false positive):

{
  "node": "HW0000001",
  "time": 1632617610.3860812,
  "pid": 78676,
  "cmd": "/usr/local/opt/openjdk/libexec/openjdk.jdk/Contents/Home/bin/java",
  "args": [
    "-Xms128M",
@sindresorhus
sindresorhus / esm-package.md
Last active May 7, 2024 08:55
Pure ESM package

Pure ESM package

The package that linked you here is now pure ESM. It cannot be require()'d from CommonJS.

This means you have the following choices:

  1. Use ESM yourself. (preferred)
    Use import foo from 'foo' instead of const foo = require('foo') to import the package. You also need to put "type": "module" in your package.json and more. Follow the below guide.
  2. If the package is used in an async context, you could use await import(…) from CommonJS instead of require(…).
  3. Stay on the existing version of the package until you can move to ESM.

Both things have been introduced recently, and let you access even private ec2 instances

  1. Without VPN
  2. No open SSH port
  3. Authentication / Authorization is fully delegated to IAM
# Assumes valid AWS Credentials in ENV
[package]
name = "bench-translate"
version = "0.1.0"
authors = ["colin <colin@graplsecurity.com>"]
edition = "2018"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
serde_json = "1.0.53"
@securisec
securisec / cli.py
Last active January 5, 2023 05:32
How to build a fully dynamic, self documention fuzzy cli for any class in python
#!/usr/bin/env python3
import inspect
import argparse
import fire
from docstring_parser import parse
from prompt_toolkit.completion import Completer, Completion, FuzzyCompleter
from prompt_toolkit import PromptSession
from search.lsgrep import SearchFiles
@gene1wood
gene1wood / aws-lambda-relative-import-no-known-parent-package.md
Last active March 15, 2024 14:13
Python relative imports in AWS Lambda fail with `attempted relative import with no known parent package`

Python relative imports in AWS Lambda fail with attempted relative import with no known parent package

The Problem

In AWS Lambda if I attempt an explicit relative import like this

.
├── lambda_file.py
└── example.py
#
# a one-liner to get raw content from github enterprise, relying on basic authentication.
# eliminates the need to create an access token and incorporate it in the url.
#
#
# fill in the blanks:
#
# USER your login user name for authentication (you'll be prompted for password on the terminal)
# GHE_DOMAIN the github enterprise custom domain